|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.mapping.PropertySet
gnu.mapping.Procedure
gnu.mapping.Procedure0
gnu.expr.Expression
public abstract class Expression
Abstract class for syntactic forms that evaluate to a value. Scheme S-expressions get re-written to these before evaluation.
Field Summary | |
---|---|
protected int |
flags
|
protected static int |
NEXT_AVAIL_FLAG
|
static Expression[] |
noExpressions
|
Fields inherited from class gnu.mapping.PropertySet |
---|
nameKey |
Constructor Summary | |
---|---|
Expression()
|
Method Summary | |
---|---|
void |
apply(CallContext ctx)
Evaluate the expression. |
java.lang.Object |
apply0()
|
void |
compile(Compilation comp,
Declaration lhs)
Compile an expression with checking suitable for a known Declaration. |
abstract void |
compile(Compilation comp,
Target target)
|
void |
compile(Compilation comp,
Type type)
|
static void |
compileButFirst(Expression exp,
Compilation comp)
Compile all but the first sub-"statement". |
void |
compileNotePosition(Compilation comp,
Target target,
Expression position)
Compile, but take note of line number. |
void |
compileWithPosition(Compilation comp,
Target target)
Same as compile, but emit line number beforehard. |
void |
compileWithPosition(Compilation comp,
Target target,
Expression position)
Same as 2-argument compileWithPosition, but use some other Expression's line number. |
java.lang.Object |
eval(CallContext ctx)
|
java.lang.Object |
eval(Environment env)
|
int |
getColumnNumber()
Return current column number. |
java.lang.String |
getFileName()
Normally same as getSystemId. |
boolean |
getFlag(int flag)
|
int |
getFlags()
|
int |
getLineNumber()
Get the line number of (the start of) this Expression. |
java.lang.String |
getPublicId()
|
java.lang.String |
getSystemId()
|
Type |
getType()
Return the Type used to represent the values of this Expression. |
Expression |
inline(ApplyExp exp,
InlineCalls walker,
Declaration decl,
boolean argsInlined)
Apply inlining transformations on a given ApplyExp. |
boolean |
isStableSourceLocation()
True if position is unlikely to change. |
static Expression |
makeWhile(java.lang.Object cond,
java.lang.Object body,
Compilation parser)
Helper method to create a `while' statement. |
int |
match0(CallContext ctx)
Pass zero arguments. |
protected abstract boolean |
mustCompile()
|
void |
print(Consumer out)
|
abstract void |
print(OutPort ps)
|
void |
printLineColumn(OutPort out)
Print line and column number if specified. |
void |
setFile(java.lang.String filename)
|
void |
setFlag(boolean setting,
int flag)
|
void |
setFlag(int flag)
|
void |
setLine(Compilation comp)
Set line number from current position in Compilation . |
Expression |
setLine(Expression old)
|
void |
setLine(int lineno)
|
void |
setLine(int lineno,
int colno)
|
void |
setLocation(SourceLocator location)
Copies the current location. |
boolean |
side_effects()
True if evaluating may have side-effects. |
java.lang.String |
toString()
|
java.lang.Object |
valueIfConstant()
Return value if it is constant, or null if non-constant or unknown. |
protected Expression |
walk(ExpWalker walker)
|
protected void |
walkChildren(ExpWalker walker)
|
Methods inherited from class gnu.mapping.Procedure0 |
---|
apply1, apply2, apply3, apply4, applyN, numArgs |
Methods inherited from class gnu.mapping.Procedure |
---|
apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, match1, match2, match3, match4, matchN, maxArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation |
Methods inherited from class gnu.mapping.PropertySet |
---|
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Expression[] noExpressions
protected int flags
protected static final int NEXT_AVAIL_FLAG
Constructor Detail |
---|
public Expression()
Method Detail |
---|
public final java.lang.Object eval(CallContext ctx) throws java.lang.Throwable
java.lang.Throwable
public final java.lang.Object eval(Environment env) throws java.lang.Throwable
java.lang.Throwable
protected abstract boolean mustCompile()
public final int match0(CallContext ctx)
Procedure
match0
in class Procedure
public final java.lang.Object apply0() throws java.lang.Throwable
apply0
in class Procedure0
java.lang.Throwable
public void apply(CallContext ctx) throws java.lang.Throwable
apply
in class Procedure
java.lang.Throwable
public final void print(Consumer out)
print
in interface Printable
public abstract void print(OutPort ps)
public void printLineColumn(OutPort out)
public abstract void compile(Compilation comp, Target target)
public final void compileWithPosition(Compilation comp, Target target)
public final void compileWithPosition(Compilation comp, Target target, Expression position)
public final void compileNotePosition(Compilation comp, Target target, Expression position)
public final void compile(Compilation comp, Type type)
public final void compile(Compilation comp, Declaration lhs)
public static void compileButFirst(Expression exp, Compilation comp)
protected Expression walk(ExpWalker walker)
protected void walkChildren(ExpWalker walker)
public Expression inline(ApplyExp exp, InlineCalls walker, Declaration decl, boolean argsInlined)
exp
- an application whose function expression can be simplified
to this expression.walker
- the context for the current inlining passdecl
- if non-null, a Declaration bound to this expression.argsInlined
- true iff exp.getArgs()
have been walked.
public static Expression makeWhile(java.lang.Object cond, java.lang.Object body, Compilation parser)
public final void setLocation(SourceLocator location)
public final Expression setLine(Expression old)
public final void setFile(java.lang.String filename)
public final void setLine(int lineno, int colno)
public final void setLine(int lineno)
public final java.lang.String getFileName()
SourceLocator
public void setLine(Compilation comp)
Compilation
.
public java.lang.String getPublicId()
getPublicId
in interface javax.xml.transform.SourceLocator
getPublicId
in interface org.xml.sax.Locator
public java.lang.String getSystemId()
getSystemId
in interface javax.xml.transform.SourceLocator
getSystemId
in interface org.xml.sax.Locator
public final int getLineNumber()
getLineNumber
in interface javax.xml.transform.SourceLocator
getLineNumber
in interface org.xml.sax.Locator
public final int getColumnNumber()
SourceLocator
getColumnNumber
in interface javax.xml.transform.SourceLocator
getColumnNumber
in interface org.xml.sax.Locator
public boolean isStableSourceLocation()
SourceLocator
public Type getType()
public java.lang.Object valueIfConstant()
public void setFlag(boolean setting, int flag)
public void setFlag(int flag)
public int getFlags()
public boolean getFlag(int flag)
public boolean side_effects()
public java.lang.String toString()
toString
in class Procedure
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |