[antlr-interest] "start of line" issue in lexer
Micheal J
open.zone at virgin.net
Wed Jun 21 09:46:09 PDT 2006
Look at the csharp_v1 example in 'examples/csharp/csharp_v1'. The lexer
deals with preprocessor directives that must similarly be the first
non-whitespace token on a line.
In general, the examples provide a rich source of ideas.
Micheal
-----------------------
The best way to contact me is via the list/forum. My time is very limited.
-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Michiel Vermandel
Sent: 21 June 2006 15:39
To: antlr-interest at antlr.org
Subject: [antlr-interest] "start of line" issue in lexer
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/ee9e1c05/attachment.html
More information about the antlr-interest
mailing list