[antlr-interest] How to get the line no. of a token at lexer
Nalin Chandrawansha
nalinchandrawansha at yahoo.com
Fri Dec 21 00:47:33 PST 2007
Hi,
Is there any method of retrieving the line no. of a token at lexer?
For example, if we want to catch the line numbers of comments,
LINE_COMMENT : label='//' ~('\n'|'\r')* '\r'? '\n' {System.out.println("Found a comment at line : " +$label.line );} {$channel=HIDDEN;} ;
This doesn't work at lexer though we can use the .line at the paresr rules.
Thank you.
Nalin Chandrawansha
Send instant messages to your online friends http://uk.messenger.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071221/7f3f47ba/attachment.html
More information about the antlr-interest
mailing list