[antlr-interest] Combining multiple tokens
Graham Wideman
gwlist at grahamwideman.com
Sun Oct 18 14:24:42 PDT 2009
I'm not entirely sure I understand the particulars of what you're trying to do
but...
At 10/18/2009 05:01 PM, Jeffrey Cameron wrote:
>
> 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] ;
I think you probably want syntax that's more like:
-> ^(TABLECELL, $cell)
See:
http://www.antlr.org/wiki/display/ANTLR3/Tree+construction
If that doesn't get you going, it might be good to post clarifying:
> I am trying to wrap the complete, concatenated text
> of a series of tokens into a single token for a tree grammar.
... are you are writing this *in* a tree grammar, or in a combined grammar
trying to produce a tree? Also describe what actual errors you are seeing.
-- Graham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091018/2cfbab19/attachment.html
More information about the antlr-interest
mailing list