[antlr-interest] Problem #2: template lists expanding to weird stuff?
Peter Nann
peter.nann at vecommerce.com.au
Wed Apr 16 07:47:42 PDT 2008
Now, my grammar has a more serious template using Lists and the '+='
operator.
It is getting rather strange expanded output which looks like:
<one-of> [@2,2:2='x',<4>,1:2] </one-of>
What the heck is going on there?
It looks like the List object has expanded itself using some strange
toString() method.
Any clues on this one?
Updated grammar:
----------------------
grammar Test;
options {output=template; rewrite=true;}
test
: '[' ( items+=WORD )* ']'
-> template(items={$items})
<< \<one-of\> <items; separator=", ">
\</one-of\> >> ;
WORD : ('a'..'z'|'-'|'_'|'\'') ('a'..'z'|'-'|'_'|'\'')* ;
WS : ( ' ' | '\t' | '\r' | '\n' )+ {$channel = HIDDEN;} ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080417/e3940919/attachment.html
More information about the antlr-interest
mailing list