[antlr-interest] ANTLRv3 emits literal DOWN instead of Token.Down

Gavin Lambert antlr at mirality.co.nz
Mon Dec 3 23:45:25 PST 2007


At 14:53 4/12/2007, Kalen Petersen wrote:
 >The attached grammar produces invalid code in both java and C#
 >targets.
 >In the lookahead, it emits "DOWN" instead of "Token.Down" as
 >in the recognition stage.  This is on line 37 in 
DownBugParser.java.
[...]
 >grammar DownBug;
 >	
 >bug_rule
 >	:   ^('+' bug_rule)
 >	|   '+' bug_rule
 >	|   ZERO
 >	;

Hmm.  I'm surprised that even compiles.  That doesn't seem like a 
valid construct to me -- you're using ^ like an AST node (which 
shouldn't work outside a rewrite rule or tree parser).



More information about the antlr-interest mailing list