|
antlraux package v0.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--antlr.BaseAST | +--antlr.CommonAST | +--antlraux.util.LexInfoAST | +--antlraux.context.asts.TypeAST | +--antlraux.context.asts.ExpressionAST
This class can be used to modelize the AST of an expression. It
features an expression type (a Type
),
an RValue, LValue, and value.
Warning: TypeAST
, ExpressionAST
and ScopeAST
copy first child and sibling with their only constructor. See their
constructor's comments for details.
Field Summary | |
protected java.lang.Object |
EValue
This is a calculated value. |
protected boolean |
LValue
An expression with left value set to true can be put on the left sign of an assignation; otherwise, they can't. |
protected boolean |
RValue
An expression with no Rvalue cannot be used on the right side of an assignation, because they are not "readable". |
protected static boolean |
verboseStringConversion
|
Fields inherited from class antlr.BaseAST |
down, right |
Fields inherited from interface antlraux.util.LexInfo |
DEFAULT_COLUMN, DEFAULT_FILENAME, DEFAULT_LINE |
Constructor Summary | |
ExpressionAST()
|
|
ExpressionAST(antlr.collections.AST other)
This constructor copies the first child and next sibling of other using the initialize(AST) method |
Method Summary | |
java.lang.Object |
getEValue()
|
boolean |
getLValue()
|
boolean |
getRValue()
|
void |
initialize(antlr.collections.AST ast)
Warning: this implementation of initialize copies the first child and next sibling of ast. |
void |
setEValue(java.lang.Object o)
|
void |
setLValue(boolean b)
|
void |
setRValue(boolean b)
|
static void |
setVerboseStringConversion(boolean b)
If set to true, this adds some additional information to the string generated by toString()
(shows the AST's type, RValue, LValue and EValue) |
java.lang.String |
toString()
Returns a String representing the information in the root of the node. |
Methods inherited from class antlraux.context.asts.TypeAST |
getExpType, setExpType |
Methods inherited from class antlraux.util.LexInfoAST |
addChildLeft, addChildLeftWithSiblings, addSibling, copyLexInfo, getColumn, getFilename, getLastChild, getLastSibling, getLexInfoString, getLine, getPrevChild, initialize, replaceChild, replaceChildWithSiblings, setColumn, setFilename, setLine, tabulate, toStringList, toStringList, toStringTree |
Methods inherited from class antlr.CommonAST |
getText, getType, initialize, setText, setType |
Methods inherited from class antlr.BaseAST |
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean LValue
a = 3;An expression without LValue could be a literal or an addition:
"Hello"="world"; // Incorrect; "Hello" does not have LValue a+b = c; // Incorrect: a+b has no LValueKeep in mind that these are examples. Of course your languajes could consider having literals with lvalues...
protected boolean RValue
void voidFunction() {...} ... int a = voidFunction(); // Incorrect; Rvalue requiredOf course this is an example. Some languajes might find useful setting LValue to true in this kind of function calls (thus recuperating a void value).
protected java.lang.Object EValue
class MyDumbClass{ public int staticInt = 1+5+6; }The value for literal "1" will be the integer 1, the value for literal "5" will be the integer 5, and the value for "6" will the the integer 6. This way, "1+5+6" can be evaluated in compile time (and set to 12).
Other use for this field is in iterpreters: The only way of calculating values is having them dynamically stored in the ASTs.
protected static boolean verboseStringConversion
Constructor Detail |
public ExpressionAST()
public ExpressionAST(antlr.collections.AST other)
initialize(AST)
method
Method Detail |
public void setLValue(boolean b)
public void setRValue(boolean b)
public void setEValue(java.lang.Object o)
public boolean getLValue()
public boolean getRValue()
public java.lang.Object getEValue()
public void initialize(antlr.collections.AST ast)
initialize
in interface antlr.collections.AST
initialize
in class TypeAST
ast
- The AST whose information is to be copiedpublic static void setVerboseStringConversion(boolean b)
toString()
(shows the AST's type, RValue, LValue and EValue)
public java.lang.String toString()
LexInfoAST
LexInfoAST.setVerboseStringConversion(boolean)
has been set to true, it adds the lex information of
the AST (using LexInfoAST.getLexInfoString()
)
toString
in interface antlr.collections.AST
toString
in class TypeAST
|
antlraux package v0.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |