[antlr-interest] Bug in Attribute Access

Matt Fowles matt.fowles at gmail.com
Wed Mar 30 12:08:09 PDT 2011


All~

Notice the trivial parens in the good version and the lack of them in
the bad version:


fowles at morbo:~/co/sb-fail/streambase/compiler$ cat /tmp/Foo.g
grammar Foo;

options { output=AST; }

monkey : 'monkey';
ninja : 'ninja';

good : v1=(monkey)? v2=(ninja)? {$v1 != null && $v2 != null}? -> ^($v1 $v2);
bad  : v1=monkey?   v2=ninja?   {$v1 != null && $v2 != null}? -> ^($v1 $v2);

fowles at morbo:~$ java -cp lib/antlr-3.3-complete.jar org.antlr.Tool
-verbose -o /tmp/ /tmp/Foo.g
ANTLR Parser Generator  Version 3.3 Nov 30, 2010 12:50:56
/tmp/Foo.g
error(117): /tmp/Foo.g:9:33: missing attribute access on rule scope: v1
error(117): /tmp/Foo.g:9:33: missing attribute access on rule scope: v2


I tried to submit this directly to JIRA, but can't find the link to
create a new account.

Matt


More information about the antlr-interest mailing list