How can I tell what subtree my tree walker is screwing up on?

Monty Zukowski

Try adding an exception handler to the rule. I cheat and use the _t variable which is passed into every tree rule and is eqivalent to LA(1) in the parser.

constant
    options {
  defaultErrorHandler=false;
}
: INT | FLOAT | HEX | STRING | "null";

exception
catch [ParserException ex] {
  reportError(ex);
  System.out.println("constant PROBLEM TREE:
" + _t.toStringTree());
  throw ex;
}
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact