[antlr-interest] Token replacement

向雅 fyaoxy at gmail.com
Mon May 19 18:02:48 PDT 2008


Hi,

I found that about node creating most clear in
org.antlr.runtime.tree.TreeAdaptor API javadoc.

For your case, maybe add a parser ruler is an option.

Regards,
Qinxian

2008/5/20 Marko Simovic <antlr.markobarko at gmail.com>:

> Hi, i have the following rule:
>
> someRule: something op='where' condition 'else' something;
>
> i'm trying to rewrite it by doing:
>
> -> ^(Function 'if' condition something+)
>
> i do this in order to keep the AST processing code unchanged (as it
> already handles the 'if' function correctly; and the 'where' syntax is
> just a variant of the same conditional syntax)
>
> however, the rewrite just generates the number '45' for that 'if'??
>
> i tried doing this:
>
> -> ^(Function 'if'[$op] condition something+)
>
> but that seems to be unsupported.
>
> what can i do?
>
>


-- 
致敬
向雅
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080520/919369e9/attachment.html 


More information about the antlr-interest mailing list