[antlr-interest] Why does this conflict?

Terence Parr parrt at cs.usfca.edu
Thu May 26 15:05:17 PDT 2005


On May 26, 2005, at 2:48 PM, Matthew Tedder wrote:
> I created this to add boolean literals:
>
> // Boolean Literal
> BOOLIT
>   : "true"
>   | "false"
>   ;
>
> And it seems to conflict with:
>
> DENT
>   options {testLiterals=true;}
>   : ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9')*
>   ;

Hi.  This is a typical issue with ANTLR 2.x.  You need to use  
literals for stuff liek "true".  See the example grammars for how  
they handle literals :)

v3 won't have this problem.

Terence
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com



More information about the antlr-interest mailing list