[antlr-interest] error locations: how to emulate #line functionality in Java?

Terence Parr parrt at cs.usfca.edu
Thu Nov 25 10:24:31 PST 2004



On Nov 25, 2004, at 8:56 AM, Alexey Demakov wrote:
> In C language there are preprocessor directive #line used by lex/yacc
> that tell compiler which file name and line number should be used in 
> error messages.
> As far as I know, Java doesn't provide such functionality in any way.
> So, I see the only method to emulate it is to store translation table 
> with correspondence
> between source and generated files and line numbers and translate 
> compiler
> error messages back at source level.
> May be you have better ideas? If solution will be suitable not only 
> for Java - it will be great.

Hi,

I believe that if you toy with the .class files you can change the 
file/line info table. :)  I plan on doing that for my cyclic DFAs for 
which I generate byte codes directly.  I think I can get them to point 
back into the grammar file. :)

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!





 
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