[antlr-interest] Re: empty file and lexer tokens

Terence Parr parrt at jguru.com
Sat Oct 26 09:54:33 PDT 2002


On Friday, October 25, 2002, at 08:30  AM, Sriram Durbha wrote:

> Given:
>
> 	class MyLexer extends Lexer;
> 	options {
> 		k = 3;
> 	}
>
> 	LT : "lt" | "A1" ;
> 	GT : "gt" | "A2" ;
>
> I get:
>
> 	warning: lexical nondeterminism between rules LT and GT upon
> 	test.g:0:       k==1:'A'
> 	test.g:0:       k==2:'t'
> 	test.g:0:       k==3:<end-of-token>
>
> but why?  'l' is clearly distinguishable from 'g' and '1' is clearly 
> distinguishable from '2'.

This is a linear approximation weakness.  See

http://www.jguru.com/faq/view.jsp?EID=264825

Solution?  Well I would match all of that as ID and then have them 
tested as literals I guess.

Ter
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

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



More information about the antlr-interest mailing list