[antlr-interest] Re: Get the line number in my deprecated messages
pwolleba
pwolleba at hotmail.com
Wed Jun 2 05:40:40 PDT 2004
Thanks for your response Monty, it got me one step further!! :o)
As far I can see the getLine method is inside the CharScanner class,
I can however not see any solution for reaching this class from my
parser class.
If there is someone, reading this newsgroup, that has implemented a
deprecated message in their parsers I would be really happy if you
could send me an example on how you did it.
I have so far not found 1 single example that demonstrates this
problem.
Best regards,
Per
--- In antlr-interest at yahoogroups.com, Monty Zukowski <monty at c...>
wrote:
> 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