|
|||||||||||
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.QDollarHole
Untamed: A dollar hole of a quasi-literal term expression is filled in with a substitution arg.
As a ValueMaker, this evaluates to the corresponding substitution arg,
given that it meets all encoded conditions (see QHole
).
As a MatchMaker, this compares ("<=>") a specimen term against the substitution argument. The substitution argument must again meet all encoded conditions.
Field Summary | |
static StaticMaker |
QDollarHoleMaker
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) |
QDollarHole(AstroBuilder builder,
AstroTag optTag,
int holeNum,
boolean isFunctorHole,
SourceSpan optSpan)
Makes a hole that is filled in by a substitution arg. |
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)
Do nothing. |
Object[] |
getSpreadUncall()
Enabled: Uses 'QDollarHoleMaker(myBuilder, myOptTag, myHoleNum, myIsFunctorHole, myOptSpan)' |
int |
matchBindSlice(ConstList args,
ConstList specimenList,
FlexList bindings,
int[] index)
Enabled: This compares ("<=>") the substitution arg at [myHoleNum]+index against the specimenList[0]. |
void |
prettyPrintOn(TextWriter out)
Enabled: |
AstroArg |
qbuild(QuasiBuilder qbuilder)
Enabled: |
(package private) int |
startShape(ConstList args,
FlexList optBindings,
int[] prefix,
int shapeSoFar)
If the substitution arg at [myHoleHum]+prefix is actually a list for further indexing, what's the size of that list? |
ConstList |
substSlice(ConstList args,
int[] index)
Enabled: This extracts the substitution arg at [myHoleNum]+index, requires that it matches, and returns a singleton list containing that arg (which should be a literal term). |
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 QDollarHoleMaker
Constructor Detail |
QDollarHole(AstroBuilder builder, AstroTag optTag, int holeNum, boolean isFunctorHole, SourceSpan optSpan)
The invariants of a QDollarHole 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)
If it's not a list, it could still act as a list by repetition, but then it's of indeterminate size, so just return shapeSoFar. If it is a list, then if shapeSoFar has already been determined (ie, not -1), then require these to agree.
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 that the substitution arg 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 |