[antlr-interest] Token replacement

Marko Simovic antlr.markobarko at gmail.com
Mon May 19 13:42:27 PDT 2008


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?



More information about the antlr-interest mailing list