Loading ...
Sorry, an error occurred while loading the content.

9526Re: [antlr-interest] Line number information for Tree Parser exceptions

Expand Messages
  • Ric Klaren
    Oct 1, 2003
      On Tue, Sep 30, 2003 at 09:03:41PM -0000, veekook wrote:
      > Is there any way to augment exceptions thrown by the tree parser (eg
      > MismatchedTokenException) to maintain line numbers? I've subclassed
      > CommonAST to include line numbers in my AST, but is there a method
      > for getting at the line numbers for an offending rule from a catch
      > block embedded in a tree grammar rule? The following doesn't work
      > because tree exceptions don't track line numbers.

      In java this should work in C++ I just now see that something wasn't ported
      over from java mode. If the exception is generated by the match method of
      the treeparser then the node attribute in the exception should be set.
      Which means you're one cast away from the line number. Check out

      Depending on how you built your trees some nodes may lack line information.


      ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722 ----
      Xander: "Buffy, we need to do something *now*"
      Angel: "We need a distraction."
      Buffy: "Right."
      Angel: "What are you going to do?"
      Buffy: "I'm going to kill them all. That oughtta distract 'em..."
    • Show all 4 messages in this topic