org.quasiliteral.astro
Class BaseBuilder

java.lang.Object
  |
  +--org.quasiliteral.astro.BaseBuilder
All Implemented Interfaces:
AstroBuilder
Direct Known Subclasses:
ASTBuilder, QBuilder, TermBuilder

public abstract class BaseBuilder
extends Object
implements AstroBuilder

Untamed:

Author:
Mark S. Miller

Field Summary
private  AstroSchema mySchema
           
 
Constructor Summary
protected BaseBuilder(AstroSchema schema)
           
 
Method Summary
 Astro bag(Object args)
          Enabled:
 Astro composite(AstroTag tag, Object data, SourceSpan optSpan)
          Enabled: Returns a complex token rather than a AST.
 AstroSchema getSchema()
          Enabled:
 Astro leafChar(char data, SourceSpan optSpan)
          Enabled:
 Astro leafData(Object data, SourceSpan optSpan)
          Enabled: @param data Must not be null
 Astro leafFloat64(double data, SourceSpan optSpan)
          Enabled:
 Astro leafInteger(BigInteger data, SourceSpan optSpan)
          Enabled:
protected abstract  Astro leafInternal(AstroTag tag, Object optData, SourceSpan optSpan)
          Actually makes the kind of leaf this builder makes.
 Astro leafLong(long data, SourceSpan optSpan)
          Enabled:
 Astro leafString(String data, SourceSpan optSpan)
          Enabled:
 Astro leafTag(AstroTag tag, SourceSpan optSource)
          Enabled: @return :AstroToken
 Astro leafTwine(Twine data, SourceSpan optSpan)
          Enabled:
 Object list(AstroArg first)
          Enabled:
 Object list(AstroArg first, AstroArg second)
          Enabled:
 Object list(AstroArg first, AstroArg second, AstroArg third)
          Enabled:
 Object list(AstroArg first, AstroArg second, AstroArg third, AstroArg fourth)
          Enabled:
 Astro start(Astro top)
          Enabled: Just returns top
 Astro term(Astro functor)
          Enabled:
 Astro tuple(Object args)
          Enabled:
 Object unpack(Astro litString)
          Enabled:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.quasiliteral.astro.AstroBuilder
list, term, with
 

Field Detail

mySchema

private final AstroSchema mySchema
Constructor Detail

BaseBuilder

protected BaseBuilder(AstroSchema schema)
Method Detail

getSchema

public AstroSchema getSchema()
Enabled:

Specified by:
getSchema in interface AstroBuilder

start

public Astro start(Astro top)
Enabled: Just returns top

Specified by:
start in interface AstroBuilder

leafInternal

protected abstract Astro leafInternal(AstroTag tag,
                                      Object optData,
                                      SourceSpan optSpan)
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.

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.

leafTag

public Astro leafTag(AstroTag tag,
                     SourceSpan optSource)
Enabled: @return :AstroToken

Specified by:
leafTag in interface AstroBuilder

composite

public Astro composite(AstroTag tag,
                       Object data,
                       SourceSpan optSpan)
Enabled: Returns a complex token rather than a AST.

Specified by:
composite in interface AstroBuilder
Parameters:
data - Nust not be null
Returns:
:AstroToken

leafData

public Astro leafData(Object data,
                      SourceSpan optSpan)
Enabled: @param data Must not be null

Specified by:
leafData in interface AstroBuilder
Returns:
:AstroToken

leafChar

public Astro leafChar(char data,
                      SourceSpan optSpan)
Enabled:

Specified by:
leafChar in interface AstroBuilder

leafLong

public Astro leafLong(long data,
                      SourceSpan optSpan)
Enabled:

Specified by:
leafLong in interface AstroBuilder

leafInteger

public Astro leafInteger(BigInteger data,
                         SourceSpan optSpan)
Enabled:

Specified by:
leafInteger in interface AstroBuilder

leafFloat64

public Astro leafFloat64(double data,
                         SourceSpan optSpan)
Enabled:

Specified by:
leafFloat64 in interface AstroBuilder

leafString

public Astro leafString(String data,
                        SourceSpan optSpan)
Enabled:

Specified by:
leafString in interface AstroBuilder

leafTwine

public Astro leafTwine(Twine data,
                       SourceSpan optSpan)
Enabled:

Specified by:
leafTwine in interface AstroBuilder

term

public Astro term(Astro functor)
Enabled:

Specified by:
term in interface AstroBuilder

tuple

public Astro tuple(Object args)
Enabled:

Specified by:
tuple in interface AstroBuilder

bag

public Astro bag(Object args)
Enabled:

Specified by:
bag in interface AstroBuilder

list

public Object list(AstroArg first)
Enabled:

Specified by:
list in interface AstroBuilder
Returns:
:Args

list

public Object list(AstroArg first,
                   AstroArg second)
Enabled:

Specified by:
list in interface AstroBuilder

list

public Object list(AstroArg first,
                   AstroArg second,
                   AstroArg third)
Enabled:

Specified by:
list in interface AstroBuilder

list

public Object list(AstroArg first,
                   AstroArg second,
                   AstroArg third,
                   AstroArg fourth)
Enabled:

Specified by:
list in interface AstroBuilder

unpack

public Object unpack(Astro litString)
Enabled:

Specified by:
unpack in interface AstroBuilder
Returns:
:Args


comments?