[antlr-interest] Understanding of testLiterals=true

cgodfrey86 cgodfrey at epnet.com
Thu May 15 06:32:04 PDT 2003


Hello,

I just wanted to make validate my understanding of test literals=true 
option.

This grammar file is fine when Token GT_OP is defined in the tokens 
section. If instead, I defined a rule for the GT_OP token as 

GT_OP : "gt";

I get lexical nondeterminism error.

So, am I correct in the understanding that testLiterals will test 
only what is defined in the tokens section?

userquery.g: warning:lexical nondeterminism between rules GT_OP and 
TAG upon
userquery.g:     k==1:'g'
userquery.g:     k==2:'t'
userquery.g:     k==3:<end-of-token>
userquery.g:     k==4:<end-of-token>

options
{
	language = "CSharp";
}

class UserLexer extends Lexer;
options {
  k=4;
  testLiterals=true;

}

tokens {
GT_OP = "gt";
}


TAG
options { testLiterals=true; }
 	:
	('a'..'z')('a'..'z')
	;


 

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




More information about the antlr-interest mailing list