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

Terence Parr parrt at cs.usfca.edu
Sun Dec 9 15:26:29 PST 2007


Hi Kalen,

Well, this is more of a "don't allow ^(...) matching" in a nontree  
parser bug.

TreeParser defines:

	public static final int DOWN = Token.DOWN;

so it will compile no problem.

Adding issue

http://www.antlr.org:8888/browse/ANTLR-198

Ter

On Dec 3, 2007, at 5:53 PM, Kalen Petersen wrote:

> Been using antlr for a few weeks now and it's great, but today I  
> stumbled across this bug.
> 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.
> This is observed with the version of antlr included in ANTLRWorks  
> 1.1.5.
> Thanks,
>
> --Kalen
> grammar DownBug;
> 	
> bug_rule
> 	:   ^('+' bug_rule)
> 	|   '+' bug_rule
> 	|   ZERO
> 	;
>
> ZERO
> 	:	'0'+
> 	;
> 	
> WS	:	'\n' {$channel=HIDDEN;}
> 	;



More information about the antlr-interest mailing list