Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools Pccts > Get line number...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 115 of 134
Post > Topic >>

Get line numbers with Antlr parser

by Ulrich Hobelmann <u.hobelmann@[EMAIL PROTECTED] > May 16, 2006 at 03:43 PM

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 do***entation 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
disappears.

(or is this a bug?)

Best regards,
   Ulrich
 




 3 Posts in Topic:
Get line numbers with Antlr parser
Ulrich Hobelmann <u.ho  2006-05-16 15:43:47 
Re: Get line numbers with Antlr parser
Ulrich Hobelmann <u.ho  2006-05-18 23:52:38 
Re: Get line numbers with Antlr parser
Kai Koehne <java.3.kko  2006-05-18 23:52:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 14:30:21 CDT 2008.