[antlr-interest] token nondeterminism problem

manuel aldana aldana at gmx.de
Sun Mar 5 05:47:48 PST 2006


hey,

i've got a very simple problem, never the less i could not figure out 
(google, maillist, manuals etc.) how to overcome it.

I get this annoying nondeterminism message through this keywords vs. 
identifier problem. I read, that the solution lies in defining tokens{ 
xx } and setting testLiterals=true; to the IDENTIFIER part.

But how is it possible to put lexing-rules to the tokens definition? e.g.:
-------------------------------
class MyLexer extends Lexer;
tokens{
   BLA;		
}

BLA='x'|'y';

ID options{testLiterals:true}: ('a'..'z')+;
------------------------------------------

I know compiler is raising error this way. Setting BLA 'protected' would 
compile and avoid nondeterminism warnings but I would like to have rules 
in the tokens definition. is that possible?

thanks a lot!


-- 
  manuel aldana
  aldana at gmx.de
  aldana at cs.tu-berlin.de


More information about the antlr-interest mailing list