[antlr-interest] Enhancement request for identifying imaginary tokens

Terence Parr parrt at cs.usfca.edu
Fri Dec 14 09:32:15 PST 2007


Hi Stephen, i'm not sure what you are asking for.  You must say what  
root node to create.  How would antlr know what you want?

thanks,

Ter
On Dec 13, 2007, at 2:47 PM, Hardy, Stephen wrote:

> Maybe I missed something, but it would be nice if there was an  
> option to
> automatically "identify" all imaginary tokens.  Currently, this  
> requires
> explicit identification as per the following example:
>
> struct_declarator
>    : declarator (':' constant_expression)?	
>        -> ^(STRUCT_DECLARATOR[$start] declarator constant_expression?)
>    | ':' constant_expression			
>        -> ^(STRUCT_DECLARATOR_ANON_BITFIELD[$start]
> constant_expression)
>    ;
>
>
> Admittedly, it's not all that difficult to put the
> MY_IMAGINARY_TOKEN[$start] construct everywhere in the tree writing
> part, but it does make the code less readable.  Having an option to do
> this by default would be very handy when debugging tree walkers.
> Something like
>
> options {
>  IdentifyImaginaryTokensWithStart = true;
> }
>
> Regards,
> SJH
>



More information about the antlr-interest mailing list