[antlr-interest] single line comment

mzukowski at yci.com mzukowski at yci.com
Tue Jan 28 08:08:51 PST 2003


I believe you can explicitly match EOF in the lexer, I know you can in the
parser....
Try it and see.

Monty

-----Original Message-----
From: William Lam <xeenman at yahoo.com> [mailto:xeenman at yahoo.com]
Sent: Monday, January 27, 2003 6:39 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] single line comment


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/ 


 

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



More information about the antlr-interest mailing list