org.quasiliteral.quasiterm
Class QBuilder

java.lang.Object
  |
  +--org.quasiliteral.astro.BaseBuilder
        |
        +--org.quasiliteral.quasiterm.QBuilder
All Implemented Interfaces:
AstroBuilder, QuasiBuilder, QuasiExprParser, QuasiPatternParser

public class QBuilder
extends BaseBuilder
implements QuasiBuilder, QuasiExprParser, QuasiPatternParser

Untamed:

Author:
Mark S. Miller

Field Summary
private  AstroBuilder myBuilder
           
static QBuilder term__quasiParser
          Enabled:
 
Fields inherited from class org.quasiliteral.astro.BaseBuilder
 
Constructor Summary
QBuilder(AstroBuilder builder)
          Enabled:
 
Method Summary
 Astro atHole(Astro litInt)
          Enabled: The at-hole that's returned is initially a term-hole, but may get converted to a functor-hole by QAstro.asFunctor().
 AstroArg choice(AstroArg leftArg, AstroArg rightArg)
          Enabled:
 Astro composite(AstroTag tag, Object data, SourceSpan optSpan)
          Enabled: For QTerms, this is non-atomic
 boolean doesQuasis()
          Enabled:
 Astro dollarHole(Astro litInt)
          Enabled: The dollar-hole that's returned is initially a term-hole, but may get converted to a functor-hole by QAstro.asFunctor().
 AstroArg group(Object args)
          Enabled:
 AstroArg interleave(AstroArg leftArg, AstroArg rightArg)
          Enabled:
protected  Astro leafInternal(AstroTag tag, Object optData, SourceSpan optSpan)
          Actually makes the kind of leaf this builder makes.
 Object list()
          Enabled:
 MatchMaker matchMaker(Twine template)
          Enabled:
 MatchMaker matchMaker(Twine template, int[] dlrHoles, int[] atHoles)
          Enabled:
 AstroArg some(AstroArg optSub, String quant)
          Enabled:
 Astro taggedHole(Astro ident, Astro functorHole)
          Enabled:
 Astro term(Astro functor)
          Enabled: Just returns 'functor' itself.
 Astro term(Astro functor, Object args)
          Enabled: Returns the QTerm '(...)'.
 ValueMaker valueMaker(Twine template)
          Enabled:
 ValueMaker valueMaker(Twine template, int[] dlrHoles)
          Enabled:
 Object with(Object list, AstroArg next)
          Enabled:
 
Methods inherited from class org.quasiliteral.astro.BaseBuilder
bag, getSchema, leafChar, leafData, leafFloat64, leafInteger, leafLong, leafString, leafTag, leafTwine, list, list, list, list, start, tuple, unpack
 
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
bag, getSchema, leafChar, leafData, leafFloat64, leafInteger, leafLong, leafString, leafTag, leafTwine, list, list, list, list, start, tuple, unpack
 

Field Detail

term__quasiParser

public static final QBuilder term__quasiParser
Enabled:


myBuilder

private final AstroBuilder myBuilder
Constructor Detail

QBuilder

public QBuilder(AstroBuilder builder)
Enabled:

Method Detail

valueMaker

public ValueMaker valueMaker(Twine template,
                             int[] dlrHoles)
Enabled:

Specified by:
valueMaker in interface QuasiExprParser

valueMaker

public ValueMaker valueMaker(Twine template)
Enabled:

Specified by:
valueMaker in interface QuasiExprParser

matchMaker

public MatchMaker matchMaker(Twine template,
                             int[] dlrHoles,
                             int[] atHoles)
Enabled:

Specified by:
matchMaker in interface QuasiPatternParser

matchMaker

public MatchMaker matchMaker(Twine template)
Enabled:

Specified by:
matchMaker in interface QuasiPatternParser

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.

composite

public Astro composite(AstroTag tag,
                       Object data,
                       SourceSpan optSpan)
Enabled: For QTerms, this is non-atomic

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

term

public Astro term(Astro functor,
                  Object args)
Enabled: Returns the QTerm '(...)'.

Note that the QTerm constructor will first convert 'functor' using QAstro.asFunctor(), so if 'functor' is originally a term-hole, the functor of the resulting QTerm will be a corresponding functor-hole.

Specified by:
term in interface AstroBuilder
Parameters:
args - :Args

term

public Astro term(Astro functor)
Enabled: Just returns 'functor' itself.

Note that, if 'functor' is a term-hole (one that doesn't constrain the literal term to be zero-arity), then so will the result, since it's the same.

Specified by:
term in interface AstroBuilder
Overrides:
term in class BaseBuilder

list

public Object list()
Enabled:

Specified by:
list in interface AstroBuilder
Returns:
:Args

with

public Object with(Object list,
                   AstroArg next)
Enabled:

Specified by:
with in interface AstroBuilder
Parameters:
list - :Args
Returns:
:Args

doesQuasis

public boolean doesQuasis()
Enabled:

Specified by:
doesQuasis in interface QuasiBuilder

taggedHole

public Astro taggedHole(Astro ident,
                        Astro functorHole)
Enabled:

Specified by:
taggedHole in interface QuasiBuilder

choice

public AstroArg choice(AstroArg leftArg,
                       AstroArg rightArg)
Enabled:

Specified by:
choice in interface QuasiBuilder

interleave

public AstroArg interleave(AstroArg leftArg,
                           AstroArg rightArg)
Enabled:

Specified by:
interleave in interface QuasiBuilder

some

public AstroArg some(AstroArg optSub,
                     String quant)
Enabled:

Specified by:
some in interface QuasiBuilder

group

public AstroArg group(Object args)
Enabled:

Specified by:
group in interface QuasiBuilder
Parameters:
args - is a list of AstroArg.

dollarHole

public Astro dollarHole(Astro litInt)
Enabled: The dollar-hole that's returned is initially a term-hole, but may get converted to a functor-hole by QAstro.asFunctor().

Specified by:
dollarHole in interface QuasiBuilder

atHole

public Astro atHole(Astro litInt)
Enabled: The at-hole that's returned is initially a term-hole, but may get converted to a functor-hole by QAstro.asFunctor().

Specified by:
atHole in interface QuasiBuilder


comments?