UDA + Pegged AST Hack
Daniel N
ufo at orbiting.us
Thu Nov 29 02:53:03 PST 2012
On Wednesday, 28 November 2012 at 22:04:14 UTC, Philippe Sigaud
wrote:
> I don't understand what you're trying to do. Could you please
> explain it a
> bit more? UDA's a quite new and I'd be very interested in their
> interaction
> with compile-time code manipulation.
I'm trying to find a safe spot in the middle of a file, where I
can start parsing, normally you have to parse the entire file to
understand it, ex with your grammar files, there are many
keywords inside huge strings, so basically I let the compiler
handle comments and white-space parsing, which allows to me to
make a stable localized parser for a subset of the language.
> What I don't get is how the [__LINE__] part in magic contains
> significant
> info.
It allows me to retrieve the entire original source for a
declaration... it kinda emulates a ".sourceof" trait / property.
:)
More information about the Digitalmars-d
mailing list