[antlr-interest] Skip subtree in tree grammar

Martijn Reuvers martijn.reuvers at gmail.com
Wed May 6 10:56:18 PDT 2009


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


More information about the antlr-interest mailing list