[antlr-interest] error locations: how to emulate #line functionality in Java?
Alexey Demakov
demakov at ispras.ru
Mon Nov 29 01:10:47 PST 2004
From: "Terence Parr" <parrt at cs.usfca.edu>
> 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.
>
> 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. :)
It is useful for source level debugging, but I primary interested in
translation of compile-time error messages.
Regards,
Alexey
-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com
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