|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teatrove.tea.parsetree.Node
org.teatrove.tea.parsetree.Expression
public class Expression
An Expression is a piece of code that, when executed, produces a value. All expressions have a type which represents the type of value is produces.
| Nested Class Summary | |
|---|---|
static class |
Expression.Conversion
|
| Constructor Summary | |
|---|---|
Expression(SourceInfo info)
|
|
| Method Summary | |
|---|---|
Object |
accept(NodeVisitor visitor)
Every subclass of Node must override this method with the following: return visitor.visit(this). |
Object |
clone()
Returns a clone of this Node and all its children. |
void |
convertTo(Type toType)
Applies a type conversion to this expression which is chained to all previous conversions. |
void |
convertTo(Type toType,
boolean preferCast)
Applies a type conversion to this expression which is chained to all previous conversions. |
void |
forceConversion(Type toType,
boolean preferCast)
|
LinkedList<Expression.Conversion> |
getConversionChain()
Returns a list of Conversion objects representing the all the conversions that have been applied to this Expression. |
Type |
getInitialType()
Returns the type of this expression before any conversions were applied, or null if the type isn't set. |
Type |
getType()
The type of an expression is not necessarily set by a parser. |
Object |
getValue()
Most expressions can't generate a value at compile-time, so this method simply returns null. |
boolean |
isExceptionPossible()
Returns true if an exception can be thrown while executing this Expression. |
boolean |
isValueKnown()
Returns true if the value generated by this expression is known at compile-time. |
void |
setInitialType(Type type)
Sets the intial type in the conversion chain, but does not clear the conversions. |
void |
setType(Type type)
Sets the type of this expression, clearing the conversion chain. |
| Methods inherited from class org.teatrove.tea.parsetree.Node |
|---|
getSourceInfo, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Expression(SourceInfo info)
| Method Detail |
|---|
public Object accept(NodeVisitor visitor)
Nodereturn visitor.visit(this).
accept in class Nodevisitor - A visitor of this Node
NodeVisitorpublic Object clone()
Node
clone in class Nodepublic boolean isExceptionPossible()
public Type getType()
public Type getInitialType()
public final void convertTo(Type toType)
toType - the type to convert to.
public void convertTo(Type toType,
boolean preferCast)
toType - the type to convert to.preferCast - a hint that the conversion should be performed by a
type cast operation, by default is true.
IllegalArgumentException - when the conversion is illegal.
public void forceConversion(Type toType,
boolean preferCast)
public LinkedList<Expression.Conversion> getConversionChain()
convertTo(org.teatrove.tea.compiler.Type).
public void setType(Type type)
public void setInitialType(Type type)
public boolean isValueKnown()
Literalpublic Object getValue()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||