Keeping things on Lexer
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jorge_Pinto
Posted On:   Friday, March 11, 2005 10:38 AM

Hello, I'm trying to keep things a little bit more on the Lexer before going to the parser, i have a small example that i cannot see it working and the theory says "it should work". i'll post the exact code: class STLexer extends Lexer; options { k=4;} TIME: "tA" | "tiB"; IDENTIFIER : ('a'..'z')+; this code compiles ok, but if i change "tB" to "tiB", it gives me this error. ANTLR Parser Generator Version 2.7.5 (20050128) 1989-2005 jGuru.com ST.g: warning:lexical nondeterminism b   More>>


Hello,


I'm trying to keep things a little bit more on the Lexer before going to the parser, i have a small example that i cannot see it working and the theory says "it should work".


i'll post the exact code:



class STLexer extends Lexer;

options { k=4;}

TIME: "tA" | "tiB";

IDENTIFIER : ('a'..'z')+;




this code compiles ok, but if i change "tB" to "tiB", it gives me this error.



ANTLR Parser Generator Version 2.7.5 (20050128) 1989-2005 jGuru.com

ST.g: warning:lexical nondeterminism between rules TIME and IDENTIFIER upon

ST.g: k==1:'t'

ST.g: k==2:'i'

ST.g: k==3:

ST.g: k==4:




Now, i know i can do this easily on the parser, but is that the only way to do it? can't i return to the parser simply the token TIME.


Or to do this, i have to hardcode the match on "tiB"?


This should be simple... any help appreciated.


Jorge Pinto

   <<Less

Re: Keeping things on Lexer

Posted By:   James_Cerra  
Posted On:   Tuesday, March 15, 2005 08:23 PM

I don't understand. It already says ""tiB"". Is there a typo?
About | Sitemap | Contact