[antlr-interest] Skip subtree in tree grammar
Jim Idle
jimi at temporal-wave.com
Wed May 6 11:04:27 PDT 2009
Martijn Reuvers wrote:
> Hi Gavin,
>
> I tried as you suggested ( I use antlr 3.1.3 ):
>
> bool_function_content[Boolean value]
> : {$value != null && $value.booleanValue()}?=> function_content*
> | .*
> ;
> But weird enough it comes with a lot of compile errors (92) that it
> cannot find the 'value' symbol (I already tried without $ in front of
> it and that does not help), e.g:
>
> cannot find symbol
> [javac] symbol : variable value
> [javac] location: class basic.test07.ResTree.DFA19
> [javac] if ( (LA19_74==DOWN) && ((value !=
> null && value.booleanValue()))) {s = 15;}
>
> If I look at the source generated (treeparser) these errors are inside
> a DFA19 (which extends DFA), and indeed there the value parameter is
> not defined. If I remove the | .* option, it generates properly and
> compiles fine. Any idea why this is happening?
>
> Martijn
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
You cannot use local parameters in predicates. You need to assign them
into a scope and reference the scope.
Jim
More information about the antlr-interest
mailing list