[antlr-interest] single line comment

William Lam <xeenman at yahoo.com> xeenman at yahoo.com
Mon Jan 27 18:39:07 PST 2003


Hi I am trying to implement a single line comment in my lexer.  I 
looked at the java.g single line comment.  It works great if a 
newline is at the end of the comment, but fails when an EOF is 
encountered, saying 

unexpected char: ?

I browsed through the archives and message 4617 talks about this 
problem.

SL_COMMENT
	:	"//"
		(~('\n'|'\r'))* ('\n'|'\r'('\n')?)
		{$setType(Token.SKIP); newline();}
	;


 

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



More information about the antlr-interest mailing list