|
|||||||||||
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.QHole | +--org.quasiliteral.quasiterm.QAtHole
Untamed: An at-hole of a quasi-literal term expression extracts the specimen into a binding.
An at-hole is not a valid ValueMaker, and so neither is any quasi tree that contains an at-hole. If encountered during substitution, an at-hole throws. It would be good to make this error occur earlier.
As a MatchMaker, this requires the specimen to meet its constraints (optional tag, optional requirement of zero arity), and then extracts it into the binding at [hole-number]+index.
Field Summary | |
static StaticMaker |
QAtHoleMaker
Enabled: |
(package private) static long |
serialVersionUID
|
Fields inherited from class org.quasiliteral.quasiterm.QHole |
myHoleNum, myIsFunctorHole, myOptTag |
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) |
QAtHole(AstroBuilder builder,
AstroTag optTag,
int holeNum,
boolean isFunctorHole,
SourceSpan optSpan)
Makes a hole that extracts a specimen into a binding. |
Method Summary | |
(package private) QAstro |
asFunctor()
Returns a variant of this Astro that may serve as a functor of a QTerm. |
(package private) QHole |
asTagged(Astro ident)
|
(package private) void |
endShape(FlexList optBindings,
int[] prefix,
int shape)
Truncate and snapshot the bindings at [myHoleNum]+prefix to shape. |
Object[] |
getSpreadUncall()
Enabled: Uses 'QAtHoleMaker(myBuilder, myOptTag, myHoleNum, myIsFunctorHole, myOptSpan)' |
int |
matchBindSlice(ConstList args,
ConstList specimenList,
FlexList bindings,
int[] index)
Enabled: This extracts the specimen into the binding at [myHoleNum]+index. |
void |
prettyPrintOn(TextWriter out)
Enabled: |
AstroArg |
qbuild(QuasiBuilder qbuilder)
Enabled: |
(package private) int |
startShape(ConstList args,
FlexList optBindings,
int[] prefix,
int shapeSoFar)
An at-hole doesn't contribute to the shape, so just returns shapeSoFar, but initializes the binding at [myHoleNum]+prefix to a new empty FlexList. |
ConstList |
substSlice(ConstList args,
int[] index)
Enabled: This throws, complaining that a quasi-tree with an @-hole may not be used as a ValueMaker. |
Methods inherited from class org.quasiliteral.quasiterm.QHole |
getArgs, getHeight, getOptData, getTag, multiGet, multiPut, optCoerce, withArgs, withoutArgs |
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 QAtHoleMaker
Constructor Detail |
QAtHole(AstroBuilder builder, AstroTag optTag, int holeNum, boolean isFunctorHole, SourceSpan optSpan)
The invariants of a QAtHole are not checked here, but rather are enforced by the callers in this class and in QTermBuilder.
For the meanings of the parameters, see the QHole
constructor,
which has the same parameters.
Method Detail |
public Object[] getSpreadUncall()
public AstroArg qbuild(QuasiBuilder qbuilder)
qbuild
in class QAstroArg
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
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)
This first ensures the specimen meets our own constraints.
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].
QHole asTagged(Astro ident)
asTagged
in class QHole
QAstro asFunctor()
QAstro
If this Astro (or derivatives) should not be used as a functor, then this operation should throw.
asFunctor
in class QAstro
public void prettyPrintOn(TextWriter out) throws IOException
prettyPrintOn
in class QAstroArg
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |