[antlr-interest] Combining multiple tokens
Jeffrey Cameron
jeffreycameron at gmail.com
Sun Oct 18 14:01:57 PDT 2009
I have two parser rules in my grammar where I am trying to wrap the
complete, concatenated text of a series of tokens into a single token for a
tree grammar. The rules look like this:
*#1:*
cell : (~(VBAR|EOL))* ;
in this case I would like to write something like this:
cell : (~(VBAR|EOL))* -> TABLECELL[$cell.text] ;
but when I put that syntax in I get an exception.
*#2:*
line_to_eol : ( options {greedy=false;} : . )* EOL ;
I would like to do something like the same as above but ignore the EOL
token, so something like this:
line_to_eol : stuff+=( options {greedy=false;} : . )* EOL ->
TEXT[$stuff.text] ;
Can someone tell me when I am doing wrong in here and how to correct it? I'm
a bit stuck here and every other part of my grammar is working as expected.
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091018/6cc791b2/attachment.html
More information about the antlr-interest
mailing list