public class CaseExp extends Expression
case case-key case-clause+
case case-key case-clause* case-else-clause
case-key ::= expression
case-clause ::= ((datum*) expression+)
| ((datum*) => expression)
case-else-clause ::= (else expression+)
| (else => expression)
| Modifier and Type | Class and Description |
|---|---|
static class |
CaseExp.CaseClause
This class represent a clause of the case expression,
of the form ((datum*) expression+) or (else expression+)
|
flags, NEXT_AVAIL_FLAG, noExpressions, type, VALIDATEDcompilerKey, compilerXKey, validateApplyKey, validateXApplyKeynameKey| Constructor and Description |
|---|
CaseExp(Expression key,
CaseExp.CaseClause[] clauses)
Constructor for a case expression with no else clause.
|
CaseExp(Expression key,
CaseExp.CaseClause[] clauses,
CaseExp.CaseClause elseClause)
Constructor for a case expression with an else clause.
|
| Modifier and Type | Method and Description |
|---|---|
void |
apply(CallContext ctx)
Evaluate the expression.
|
protected Type |
calculateDatumsType()
Computes the union type of the case expression datums.
|
protected java.lang.Object |
calculateDatumValue(Expression datum)
Given the expression generated from a datum
returns the value of the datum as an Object.
|
protected Type |
calculateType() |
void |
compile(Compilation comp,
Target target) |
protected boolean |
mustCompile() |
void |
print(gnu.kawa.io.OutPort out) |
boolean |
searchValue(java.lang.Object keyValue)
Search a clause containing the specified key.
|
Expression |
selectCase(java.lang.Object keyValue)
Search for a clause containing the specified key.
|
protected <R,D> R |
visit(ExpVisitor<R,D> visitor,
D d) |
protected <R,D> void |
visitChildren(ExpVisitor<R,D> visitor,
D d) |
apply0, checkLiteralKeyword, compile, compile, compileButFirst, compileNotePosition, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getSystemId, getType, getTypeRaw, isSingleValue, isStableSourceLocation, makeWhile, match0, maybeSetLine, neverReturns, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLocation, setType, side_effects, toString, validateApply, valueIfConstantapply, check0, check1, check2, check3, check4, checkArgCount, checkN, getReturnType, getSetter, getSourceLocation, isSideEffectFree, match1, match2, match3, match4, matchN, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocationgetName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbolpublic CaseExp(Expression key, CaseExp.CaseClause[] clauses)
public CaseExp(Expression key, CaseExp.CaseClause[] clauses, CaseExp.CaseClause elseClause)
protected boolean mustCompile()
mustCompile in class Expressionpublic void apply(CallContext ctx) throws java.lang.Throwable
Expressionapply in class Expressionjava.lang.Throwablepublic void print(gnu.kawa.io.OutPort out)
print in class Expressionpublic void compile(Compilation comp, Target target)
compile in class Expressionprotected <R,D> R visit(ExpVisitor<R,D> visitor, D d)
visit in class Expressionprotected <R,D> void visitChildren(ExpVisitor<R,D> visitor, D d)
visitChildren in class Expressionprotected java.lang.Object calculateDatumValue(Expression datum)
protected Type calculateType()
calculateType in class Expressionprotected Type calculateDatumsType()
public boolean searchValue(java.lang.Object keyValue)
public Expression selectCase(java.lang.Object keyValue)