[antlr-interest] subrules and testLiterals=true

Adrian Herscu bmf1972 at fastmail.fm
Thu Apr 26 12:48:54 PDT 2007


Hi all,

I am trying to make the following lexer rules work:

PACKAGE_QNAME
	:	PACKAGE_NAME { $setType( PACKAGE_NAME ); } ( DOT PACKAGE_NAME { 
$setType( PACKAGE_QNAME ); } )*
	;

PACKAGE_NAME
	options {testLiterals = true;}
	:	'a'..'z' ('a'..'z'|'0'..'9')*
	;

In the parser I have:

packageDefinition
	:	"package" PACKAGE_QNAME SEMI!
	;


I cannot find a way to apply the testLiterals=true option to the 
PACKAGE_NAME subrule in the PACKAGE_QNAME rule.

Please help,
Adrian.



More information about the antlr-interest mailing list