[antlr-interest] Having trouble with line numbers in ML_COMMENTS
Gavin Lambert
antlr at mirality.co.nz
Thu Mar 22 01:08:17 PDT 2007
At 19:39 22/03/2007, Alex Shneyderman wrote:
>the problem I am seeing is taht the whenever my source has one
of
>those the line numbering is one lees it should be. If I have two
>ML_COMMENTS the numbering is off by 2 and so on. I have a dirty
>fix for it like so:
[...]
>but I can not understand why the original version is not working
>correctly.
>And of course my dirty fix will fail miserably when some one
codes
>like so:
>
>1. /* ml comment on one line */ int i = 0;
>
>my int i will be on the second line.
>
>So, I wonder if anyone can explain it and suggest what to do?
Are you sure all your other rules containing newline characters
call newline() similarly? In particular, how does your main
newline/whitespace rule look? Possibly you've forgotten a set of
brackets or something so it's not doing what you think it's doing.
More information about the antlr-interest
mailing list