[antlr-interest] found optional path in nextToken()

mzukowski at bco.com mzukowski at bco.com
Tue Dec 11 09:35:24 PST 2001


nextToken() is the lexer rule synthesized from all of your non-protected
lexer rules.  Your VALUE rule is a ()* loop--which means it's ok to match
nothing.  Surely you don't want empty tokens returned from your lexer
infinitely many times.  Change it to ()+.

Monty

> -----Original Message-----
> From: praveenray [mailto:pray at eagleinvsys.com]
> Sent: Tuesday, December 11, 2001 9:33 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] found optional path in nextToken()
> 
> 
> Does anyone know when does this warning get generated?
> I am trying to parse Colon delimited file :
> 10:my_value1:20:my_value2:30:my_value3
> etc.
> 
> Here's my .g file :
> 
> 
> header
> {
> }
> 
> options
> {
> 	language = "Cpp";
> }
> 
> class SetFillParser extends Parser;
> options {
> 	exportVocab = SetFill;
> 	buildAST = false;
> }
> 
> 
> set	:	(row)+
> 	;
> 
> row	:	VALUE COLON (tag_value)+
> 	;
> 
> tag_value	:	DIGIT COLON VALUE
> 	;
> 
> class SetFillLexer extends Lexer;
> options
> {
> 	importVocab = SetFill;
> 	k=2;
> 	charVocabulary = '\0'..'\377';
> }
> 
> 
> COLON	:	':'
> 	;
> 
> protected 
> DIGIT	:	'0'..'9'
> 	;
> 
> protected 
> NON_DIGIT	:	~('0'..'9'|':')
> 	;
> 
> VALUE
> {
> 	bool bNonDigit = false;
> }
> 	:	(
> 		DIGIT
> 		| NON_DIGIT {bNonDigit = true; }
> 		)*
> 	;
> 
> 
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
> 
> 

 

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



More information about the antlr-interest mailing list