Using custom attribute for a general parser. Is possible in D ?
bioinfornatics via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 23 08:17:51 PDT 2014
I bask originally this qustion in this thread :
http://forum.dlang.org/post/rsnswykpjfzenplivkhm@forum.dlang.org
but another thread is better as that is not exactly same topic.
I would like to use custom annotate/attribute on members as:
struct A
{
@Parser(
start = "( word ) => word[0] == '>'",
end = "( word ) => word[0] == '\n'" )
string header;
}
but it seem we can't use curstom annotation in D and mxin in this
case are not easy.
This custom attribute is a metadata to explain how to retrieve
this field from a file. This will aloow to create a global parser
and give to this parrser data structure to get back.
Parser could to b an input range were
hront give currentfilled struct and popfront will look foward in
buffer given by file.byChunk() using this metadata.
When all field are filled give the instance to front …
More information about the Digitalmars-d-learn
mailing list