|
||||||||||
| 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
org.teatrove.tea.parsetree.ParenExpression
public class ParenExpression
A ParenExpression is a thin wrapper around an Expression that was delimited by parenthesis in the source code. A parse tree does not necessarily need a ParenExpression, but it is useful when reconstructing something that resembles the source code.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.teatrove.tea.parsetree.Expression |
|---|
Expression.Conversion |
| Constructor Summary | |
|---|---|
ParenExpression(SourceInfo info,
Expression expr)
|
|
| 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,
boolean preferCast)
Applies a type conversion to this expression which is chained to all previous conversions. |
LinkedList<Expression.Conversion> |
getConversionChain()
Returns a list of Conversion objects representing the all the conversions that have been applied to this Expression. |
Expression |
getExpression()
|
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 |
isNullSafe()
|
boolean |
isValueKnown()
Returns true if the value generated by this expression is known at compile-time. |
void |
setExpression(Expression expr)
|
void |
setInitialType(Type type)
Sets the intial type in the conversion chain, but does not clear the conversions. |
void |
setNullSafe(boolean nullSafe)
|
void |
setType(Type type)
Sets the type of this expression, clearing the conversion chain. |
| Methods inherited from class org.teatrove.tea.parsetree.Expression |
|---|
convertTo, forceConversion |
| 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 ParenExpression(SourceInfo info,
Expression expr)
| Method Detail |
|---|
public Object accept(NodeVisitor visitor)
Nodereturn visitor.visit(this).
accept in class Expressionvisitor - A visitor of this Node
NodeVisitorpublic Object clone()
Node
clone in class Expressionpublic boolean isExceptionPossible()
Expression
isExceptionPossible in class Expressionpublic Type getType()
Expression
getType in class Expressionpublic Type getInitialType()
Expression
getInitialType in class Expression
public void convertTo(Type toType,
boolean preferCast)
Expression
convertTo in class ExpressiontoType - the type to convert to.preferCast - a hint that the conversion should be performed by a
type cast operation, by default is true.public LinkedList<Expression.Conversion> getConversionChain()
ExpressionExpression.convertTo(org.teatrove.tea.compiler.Type).
getConversionChain in class Expressionpublic void setType(Type type)
Expression
setType in class Expressionpublic void setInitialType(Type type)
Expression
setInitialType in class Expressionpublic boolean isValueKnown()
Expression
isValueKnown in class ExpressionLiteralpublic Object getValue()
Expression
getValue in class Expressionpublic Expression getExpression()
public void setExpression(Expression expr)
public boolean isNullSafe()
isNullSafe in interface NullSafepublic void setNullSafe(boolean nullSafe)
setNullSafe in interface NullSafe
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||