|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.quasiliteral.quasiterm.QAstroArg | +--org.quasiliteral.quasiterm.QAstro | +--org.quasiliteral.quasiterm.QFunctor
Untamed: A quasi-literal functor of a Term
.
As a ValueMaker, this acts like a 0-arity Term. As a MatchMaker, this matches only the functor info of a specimen term, and ignores the specimen's arguments.
Field Summary | |
private Object |
myOptData
|
private AstroTag |
myTag
|
static StaticMaker |
QFunctorMaker
Enabled: |
(package private) static long |
serialVersionUID
|
Fields inherited from class org.quasiliteral.quasiterm.QAstroArg |
EListGuard, EMPTY_INDEX, myBuilder, myOptSpan |
Fields inherited from interface org.erights.e.elib.tables.Selfless |
HONORARY, HONORED_NAMES |
Fields inherited from interface org.erights.e.elib.serial.PassByConstruction |
HONORARY, HONORED_NAMES |
Fields inherited from interface org.erights.e.elib.serial.Persistent |
HONORARY, HONORED_NAMES |
Constructor Summary | |
(package private) |
QFunctor(AstroBuilder builder,
AstroTag tag,
Object optData,
SourceSpan optSpan)
Makes a QTerm that matches or generates a Astro. |
Method Summary | |
(package private) QAstro |
asFunctor()
Returns a variant of this Astro that may serve as a functor of a QTerm. |
(package private) void |
endShape(FlexList optBindings,
int[] prefix,
int shape)
Do nothing. |
ConstList |
getArgs()
Enabled: @return An empty list of QAstroArg |
int |
getHeight()
Enabled: A functor as a Term is a leaf, and so has height 1 |
Object |
getOptData()
Enabled: Either literal data or null. |
Object[] |
getSpreadUncall()
Enabled: Uses 'QFunctorMaker(myBuilder, myTag, myOptData, myOptSpan)' |
AstroTag |
getTag()
Enabled: Represents the token-type of the functor of this term. |
int |
matchBindSlice(ConstList args,
ConstList specimenList,
FlexList bindings,
int[] index)
Enabled: Attempts to match against the Astro specimenList[0]. |
void |
prettyPrintOn(TextWriter out)
Enabled: |
AstroArg |
qbuild(QuasiBuilder qbuilder)
Enabled: |
(package private) int |
startShape(ConstList args,
FlexList optBindings,
int[] prefix,
int shapeSoFar)
Just returns shapeSoFar, since this has no shape and no children |
ConstList |
substSlice(ConstList args,
int[] index)
Enabled: @return A single list of a single Astro, whose functor is based on literal functor info of this qfunctor |
Astro |
withArgs(ConstList qArgs)
Enabled: |
Astro |
withoutArgs()
Enabled: |
Methods inherited from class org.quasiliteral.quasiterm.QAstro |
build, getOptArgData, getOptArgData, getOptArgString, getOptString, getOptTagCode, matchBind, matchBind, substitute |
Methods inherited from class org.quasiliteral.quasiterm.QAstroArg |
__printOn, asText, getOptSpan, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.quasiliteral.astro.AstroArg |
getOptSpan |
Field Detail |
static final long serialVersionUID
public static final StaticMaker QFunctorMaker
private final AstroTag myTag
private final Object myOptData
Constructor Detail |
QFunctor(AstroBuilder builder, AstroTag tag, Object optData, SourceSpan optSpan)
The invariants of a QTerm are not checked here, but rather are enforced by the callers in this class and in QTermBuilder.
builder
- Used to build the result of a substitutetag
- Identifies a token type in a particular grammar or set
of related grammars, used as the functor (or "label") of
this QTermoptData
- Either Character
,
BigInteger
, Double
,
or Twine
or null. If not null, then the tag
must represent the canonical literal type for this
kind of data in this schema.optSpan
- Where is the source text this node was extracted from?Method Detail |
public Object[] getSpreadUncall()
public AstroArg qbuild(QuasiBuilder qbuilder)
qbuild
in class QAstroArg
public AstroTag getTag()
public Object getOptData()
public ConstList getArgs()
public Astro withoutArgs()
public Astro withArgs(ConstList qArgs)
public ConstList substSlice(ConstList args, int[] index)
substSlice
in class QAstroArg
index
- Further indexes after a hole's hole-num. For example,
If a dollar-hole's hole-num is 3 and index is [4,5], then
the dollar-hole would evaluate to args[3][4][5].
public int matchBindSlice(ConstList args, ConstList specimenList, FlexList bindings, int[] index)
matchBindSlice
in class QAstroArg
args
- See the doc on 'args' in #substitute(Object[],
String)
specimenList
- :(ConstList of(Astro))bindings
- Like 'args', but by extraction from specimenindex
- Further indexes after a hole's hole-num. For example,
If a dollar-hole's hole-num is 3 and index is [4,5], then
the dollar-hole would access args[3][4][5]. Similarly,
an at-hole with hole-num 3 would store into
bindings[3][4][5].
public int getHeight()
getHeight
in class QAstroArg
public void prettyPrintOn(TextWriter out) throws IOException
prettyPrintOn
in class QAstroArg
IOException
QAstro asFunctor()
QAstro
If this Astro (or derivatives) should not be used as a functor, then this operation should throw.
asFunctor
in class QAstro
int startShape(ConstList args, FlexList optBindings, int[] prefix, int shapeSoFar)
startShape
in class QAstroArg
void endShape(FlexList optBindings, int[] prefix, int shape)
endShape
in class QAstroArg
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |