org.quasiliteral.antlr
Class ASTBuilder

java.lang.Object
  |
  +--org.quasiliteral.astro.BaseBuilder
        |
        +--org.quasiliteral.antlr.ASTBuilder
All Implemented Interfaces:
AstroBuilder

public class ASTBuilder
extends BaseBuilder

Untamed: The default implementation (and default superclass) for implementing AstroBuilder simply, for building AstroAST-trees with AstroToken leaves.

The type parameterization of AstroBuilder is:

     Leaf is AstroToken
     Node is AstroAST
     Arg is AstroAST
     Args is null (for empty list) or AstroAST (for it and its siblings).
 

Author:
Mark S. Miller

Field Summary
 
Fields inherited from class org.quasiliteral.astro.BaseBuilder
 
Constructor Summary
ASTBuilder(AstroSchema schema)
          Enabled:
 
Method Summary
protected  Astro leafInternal(AstroTag tag, Object optData, SourceSpan optSpan)
          Actually makes the kind of leaf this builder makes.
 Object list()
          Enabled: @return null
 Astro term(Astro functor, Object optArgs)
          Enabled: @param functor :(AstroAST | AstroToken)
 String toString()
          Suppressed:
 Object with(Object list, AstroArg next)
          Enabled: Modifies the last sibling in 'list' to be 'next', which itself is modified to not have any further siblings.
 
Methods inherited from class org.quasiliteral.astro.BaseBuilder
bag, composite, getSchema, leafChar, leafData, leafFloat64, leafInteger, leafLong, leafString, leafTag, leafTwine, list, list, list, list, start, term, tuple, unpack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASTBuilder

public ASTBuilder(AstroSchema schema)
Enabled:

Method Detail

toString

public String toString()
Suppressed:

Overrides:
toString in class Object
Returns:
a string representation of the object.

leafInternal

protected Astro leafInternal(AstroTag tag,
                             Object optData,
                             SourceSpan optSpan)
Description copied from class: BaseBuilder
Actually makes the kind of leaf this builder makes.

This is '*Internal' and 'protected' because it assumes that the general invariants among the arguments are already ensured. It is up to the callers of leafInternal to ensure this.

Specified by:
leafInternal in class BaseBuilder
Parameters:
tag - Identifies a token type in a particular grammar or set of related grammars.
optData - null, or a Character, BigInteger, Double, or Twine presumably calculated from lexing this token. If not null, then if the tag is the corresponding literal-type-tag, then this is still a leaf. Otherwise, it's a composite.
Returns:
:AstroToken

term

public Astro term(Astro functor,
                  Object optArgs)
Enabled: @param functor :(AstroAST | AstroToken)

Parameters:
optArgs - :(AstroAST | null)
Returns:
:AstroAST

list

public Object list()
Enabled: @return null

Returns:
:Args

with

public Object with(Object list,
                   AstroArg next)
Enabled: Modifies the last sibling in 'list' to be 'next', which itself is modified to not have any further siblings.

Parameters:
list - :(AstroAST | null)
next - :AstroAST
Returns:
:AstroAST


comments?