[antlr-interest] Parser Problem for comment
virg g
06virg at gmail.com
Tue Jun 9 03:01:41 PDT 2009
Hi,
I am using Antlr 3.
I have a instruction file where each instruction starts with new line and
it has fixed syntax. So I have written grammar file for the syntax check for
some of the instructions. But I have problem with Comment line.
In my instructions, line comment is represented by single quote (') ( no
closing quote is required). So if the line starts with single quote, then
that entire line I need to skip.
This is the rule for Comment
COMMENT : '\'' ~('\n'|'\r')* {$channel=HIDDEN;} ;
This is working well, if there is no single quote occurs within the
instruction. If single quote occurs in the instruction other than at the
beginning of the file, the text after single quote is treating as a comment.
So How to write a rule only if line starts with single quote then it is
comment not any where else? please help me.
Thanks in advance
Virg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090609/5de7ee20/attachment.html
More information about the antlr-interest
mailing list