[antlr-interest] SL_COMMENT rule from java.g example
Terence Parr
parrt at jguru.com
Mon Nov 19 11:01:56 PST 2001
On Monday, November 19, 2001, at 05:50 AM, rradh at yahoo.com wrote:
> Hi,
>
> I have the same definition of the SL_COMMENT rule (from java.g in the
> examples/cpp/java/ directory), in my language.
>
> SL_COMMENT
> : "//"
> (~('\n'|'\r'))* ('\n'|'\r'('\n')?)
> {$setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); newline();}
> ;
>
> The language is "Cpp".
>
> The problem I am having is that if there is no terminating '\n' in a
> single line comment. I get an "Abort" message and the program
> terminates, despite the presence of '\n' being optional.
Try grabbing the latest one from the website...i think I fixed that
one. Hmm...maybe not.
you could just make that subrule optional.
Ter
--
Chief Scientist & Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list