Class PostParse

  extended by org.norecess.antlr.PostParse

public class PostParse
extends Object

Allows processing of parser output. PostScan.parseAs(String) returns post-parse objects. Assert describes how to deal with these objects in a practical way; read that documentation first.

For those wanting more details...

There are typically two things you want to do with the results of a successful parse:

Jeremy D. Frens

Constructor Summary
PostParse(org.antlr.runtime.tree.Tree tree, IANTLRFrontEnd frontEnd)
          Constructs a post-parse object.
Method Summary
 org.antlr.runtime.tree.Tree getTree()
          Returns the tree saved in this object.
 Object treeParseAs(String production)
          Creates an instance of your tree parser and invokes the specified production.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public PostParse(org.antlr.runtime.tree.Tree tree,
                 IANTLRFrontEnd frontEnd)
Constructs a post-parse object. PostScan.parseAs(String) uses this, and it's unlikely that it would be generally useful.

tree - the result of a parse.
frontEnd - the factory for creating a tree parser.
Method Detail


public org.antlr.runtime.tree.Tree getTree()
Returns the tree saved in this object. Usually this is the result from PostScan.parseAs(String).

the tree from the parse.


public Object treeParseAs(String production)
Creates an instance of your tree parser and invokes the specified production. The value returned by the tree-parser production is returned by this method. Since this method is usally called in a JUnit assertion, the return type of Object is sufficient.

production - the production rule from the tree parser to invoke.
whatever the production rule generates.