[antlr-interest] [Newbie] "keywords vs. identifiers": how can I fix this?

Thiago F.G. Albuquerque tfga at terra.com.br
Thu Apr 10 08:27:30 PDT 2003


Hi,

I know this is probably a FAQ, but I couldn't figure it out for myself.

This is the classic "keywords vs. identifiers" problem.

I'm trying to make a lexer (just the lexer, no parser yet). Here are the rules:

ID : LETRA (LETRA | DIGITO)* ;

INT : (DIGITO)+ ;

BOOL : "true"
      | "false"
      ;

ANTLR Parser Generator   Version 2.7.2   1989-2003 jGuru.com
grammar.g: warning:lexical nondeterminism between rules ID and BOOL upon
grammar.g:     k==1:'f','t'

How can I fix this?

The docs say:

"(...) literals may be specified in the lexer grammar by means of the 
literal option."

But there's no option named "literal".

I looked in the FAQ, but still didn't manage to get an answer.

Any help is apreciated.

Thiago


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list