[antlr-interest] Token rewrite
xkrebstarx
xkrebstarx at gmail.com
Tue Aug 21 08:50:07 PDT 2007
Hey guys,
I have a token in my grammar...
NUMBER : INTEGER | FLOAT
;
where,
fragment INTEGER : '0'..'9'+|'#'('0'..'9'|'A'..'F'|'a'..'f')+ ;
fragment FLOAT :
'0'..'9'+('.''0'..'9'+|(('e'|'E')('+'|'-')?'0'..'9'+'.''0'..'9'+)) ;
and I wanted to note the type in the AST, through rewrites and an imaginary
node, such as this...
NUMBER : INTEGER -> ^(INT_TAG INTEGER)
FLOAT -> ^(FLT_TAG FLOAT)
;
How can I do something like this?
thanx,
xkrebstarx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070821/7b665b4f/attachment.html
More information about the antlr-interest
mailing list