[antlr-interest] "start of line" issue in lexer

Michiel Vermandel Michiel_Vermandel at axi.be
Wed Jun 21 07:38:48 PDT 2006


Hi,

I need a lexer rule to skip comment in a part of code-text.

The rule should only be used if "rem" is at the start of the line or only 
preceeded by whitespaces and/or tabs.

so given this part of code:


rem setting a to 5
set a=5;
rem setting lvrem to a
set lvrem = a;


the first and the third line should be concidered as comment.
the fourth line should be left alone.

building a rule for the case in line 3 is quite easy because I can search 
for new line characters, but for the very first line that is not possible 
since there are no preceeding new line characters.

how do I have to handle this?

Thanks a lott!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060621/c435de07/attachment.html


More information about the antlr-interest mailing list