|Get line numbers with Antlr parser email@example.com (Ulrich Hobelmann) (2006-05-16)|
|Re: Get line numbers with Antlr parser firstname.lastname@example.org (Antoine Reilles) (2006-05-18)|
|Re: Get line numbers with Antlr parser email@example.com (Kai Koehne) (2006-05-18)|
|Re: Get line numbers with Antlr parser firstname.lastname@example.org (Ulrich Hobelmann) (2006-05-18)|
|From:||Ulrich Hobelmann <email@example.com>|
|Date:||16 May 2006 15:43:47 -0400|
Hi, I'm using the Java1.5 parser + tree parser by Mike Studman.
My problem: I need to extract the line numbers from the parser.
Funny thing: in one part of the parser it works, but in the tree parser
it doesn't. In java15.g I added some printlns to print getLine() of
some nodes, and they printed the lines. The very same nodes are also
put into a tree structure to read by the java-tree parser (obviously).
Now for some reason the line information disappears while the tree is
being built. In java15.tree.g I can add printlns, but the line number
of the *same* node as in java15.g is suddenly 0, while it was, say 15,
only a second (and I assume a "return") before.
Why is this?
What can / do I have to do, to get the line numbers to the high level,
where I need it?
I also tried various ways of modifying the trees built, including
creating a custom tree (using #() instead of the ^ often used in
java15.g) with some nodes that only have line info. Every time the line
info seems to disappear.
Unfortunately Antlr documentation isn't really helpful. It only
mentions that there *is* the newline() method and that getLine() can be
used, but it doesn't explain why between files the line information
(or is this a bug?)
Return to the
Search the comp.compilers archives again.