AST macros

Walter Bright newshound at digitalmars.com
Sat Mar 17 19:00:34 PDT 2007


> As I can see the content of macro body will be inserted into AST in the 
> place of invocation. But there is not much differences with existing 
> C/C++ macro handling (insertion of right __FILE__, __LINE__ is good 
> thing anyway).
> 
> Is there allowed any access to previous parsed entity? For example, can 
> I define macro:
> 
> macro some_class_extender(class_name) {
>   ...modification of 'class_name' class structure...
> }
> 
> class MyCoolClass { ... }
> some_class_extender( MyCoolClass );
> 
> and get the modified version of MyCoolClass after some_class_externder 
> invocation?
> 
> --Regards,
> Yauheni Akhotnikau

Right now, I see AST macros as manipulating expressions and statements, 
not declarations.



More information about the Digitalmars-d mailing list