org.norecess.antlr
Class PostParse

java.lang.Object
  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:

Author:
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

PostParse

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.

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

getTree

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

Returns:
the tree from the parse.

treeParseAs

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.

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