[antlr-interest] Get the line number in my deprecated messages
Monty Zukowski
monty at codetransform.com
Mon May 31 09:19:32 PDT 2004
Yeah, there's a getLine() or somesuch in the Token class. If you're
using a recent ANTLR then it will be filled in automatically as long as
you call newline() in your lexer rule that matches newlines. The java
grammar is a good place to see how this works.
Monty
On May 30, 2004, at 3:51 AM, pwolleba wrote:
>
> I am writing an ANTLR parser for a language developed by my firm. As
> in any languages this is also changing over time and some old syntax
> will have to be ruled out. I though a solution to this problem would
> be to print a deprecated message each time the "old" syntax is found,
> and by doing this give the users some time to remove them.
> Since the files with the language syntax can easily be on several
> thousand lines, I would like to print the line number at the same
> time. I have however not succeeded to find any description to
> retrieve the line number from the parser; I guess it must be there
> somewhere since the exceptions that are thrown contain this
> information.
>
> Any help will be appreciated!
>
> Best regards,
> Per
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
Monty Zukowski
ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit --
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list