[antlr-interest] C++ Comments

Henry Butowsky henryb at ntlworld.com
Thu Oct 27 06:29:14 PDT 2005


Hi Guys I'm using the following rule in my Lexer to skip C++ style comments

CPP_COMMENT: ("//" (~'\n')* '\n')
	{ newline(); $setType(antlr::Token::SKIP); };

Upon executing this rule the lexer is "aborted" ( in 
CalcLexer::nextToken() )


when I use the string ("//" (~'\n')*) it deletes all text to the end-of 
file ? There is some problem with the '\n' -- Any ideas ?
Many thx Henry





More information about the antlr-interest mailing list