[antlr-interest] Problem with Single Line Comments
mzukowski at yci.com
mzukowski at yci.com
Mon May 12 07:40:09 PDT 2003
What is the input and what is the exception thrown?
Monty
-----Original Message-----
From: ramyasivadas [mailto:ramyasivadas at yahoo.co.in]
Sent: Monday, May 12, 2003 4:00 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Problem with Single Line Comments
Hi,
I have defined single line comment and multiline comment as follows:
SL_COMMENT
: "//"
(~('\n'|'\r'))* ('\n'|'\r'('\n')?)?
{ _ttype =
ANTLR_USE_NAMESPACE(antlr)Token::SKIP; }
;
ML_COMMENT
: "/*"
( { LA(2)!='/' }? '*'
| '\n' { newline(); }
| ~('*'|'\n')
)*
"*/"
{ _ttype =
ANTLR_USE_NAMESPACE(antlr)Token::SKIP; }
;
When a file with the comments are parsed, an exception is thrown
depending on the string that appears following the "//" and the "/*"
characters.
I just want the parser to ignore the string that follows immediately
after the "//" or "/*" till the newline is encountered.
Can anyone please suggest me a solution for the problem.
Thanks in advance.
Regards,
Ramya
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