[antlr-interest] please help on lexer rules antlr v3
Michiel Vermandel
Michiel_Vermandel at axi.be
Wed Sep 27 06:50:04 PDT 2006
Hi,
I have the following two rules in my lexer.
DIRECTIVE: '--' (TAB | SPACE)* ('axi.locate' | 'axi.reject');
// Single-line comments
SL_COMMENT: '--' (~('\n'|'\r'))* ('\n'|'\r'('\n')?) { channel=99; };
the general idea is that
-- axi.locate
-- axi.reject
are compiler directives,
-- followed by anything else
is a comment.
now (obviously :-/ ) everything starting with -- is consumed by the
SL_COMMENT rule.
What is the best way to solve this problem so that the compiler directives
are consumed by the DIRECTIVE lexer rule and the comments by the
SL_COMMENT lexer rule?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060927/19cf1be5/attachment.html
More information about the antlr-interest
mailing list