|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.core.isdl.ast.Expr avrora.core.isdl.ast.Literal avrora.core.isdl.ast.Literal.IntExpr
The IntExpr
inner class represents an integer literal that has a known, constant value.
Nested Class Summary |
Nested classes inherited from class avrora.core.isdl.ast.Literal |
Literal.BoolExpr, Literal.IntExpr |
Field Summary | |
int |
value
The value class stores the constant integer value of this literal. |
Fields inherited from class avrora.core.isdl.ast.Literal |
token |
Fields inherited from class avrora.core.isdl.ast.Expr |
PREC_A_ADD, PREC_A_AND, PREC_A_MUL, PREC_A_OR, PREC_A_SHIFT, PREC_A_XOR, PREC_L_AND, PREC_L_EQU, PREC_L_OR, PREC_L_REL, PREC_L_XOR, PREC_TERM, PREC_UN |
Constructor Summary | |
Literal.IntExpr(int v)
The constructor of the IntExpr class evaluates the token's string value to an integer
and stores it in the publicly accessable value field, as well as storing a reference
to the original token. |
|
Literal.IntExpr(Token v)
The constructor of the IntExpr class evaluates the token's string value to an integer
and stores it in the publicly accessable value field, as well as storing a reference
to the original token. |
Method Summary | |
Expr |
accept(CodeRebuilder r,
java.lang.Object env)
The accept() method implements one half of the visitor pattern for rebuilding of
expressions. |
void |
accept(CodeVisitor v)
The accept() method implements one half of the visitor pattern so that client visitors
can traverse the syntax tree easily and in an extensible way. |
int |
getBitWidth()
The getBitWidth() method returns the known bit size of this expression which is needed
in computing the size of an encoding. |
int |
getPrecedence()
The getPrecedence() method gets the binding precedence for this expression. |
java.lang.String |
toString()
|
Methods inherited from class avrora.core.isdl.ast.Literal |
accept, isConstantExpr, isLiteral |
Methods inherited from class avrora.core.isdl.ast.Expr |
innerString, isBitRangeExpr, isMap, isVariable, tokenToBool, tokenToInt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public final int value
value
class stores the constant integer value of this literal.
Constructor Detail |
public Literal.IntExpr(Token v)
IntExpr
class evaluates the token's string value to an integer
and stores it in the publicly accessable value
field, as well as storing a reference
to the original token.
v
- the token representing the value of this integerpublic Literal.IntExpr(int v)
IntExpr
class evaluates the token's string value to an integer
and stores it in the publicly accessable value
field, as well as storing a reference
to the original token.
v
- the token representing the value of this integerMethod Detail |
public int getBitWidth()
getBitWidth()
method returns the known bit size of this expression which is needed
in computing the size of an encoding. For integer literals, the known bit width is only defined for
binary constants (e.g. "0b0101011"), in which case it is the number of bits after the "0b" prefix.
getBitWidth
in class Expr
public void accept(CodeVisitor v)
accept()
method implements one half of the visitor pattern so that client visitors
can traverse the syntax tree easily and in an extensible way.
accept
in class Expr
v
- the visitor to acceptpublic Expr accept(CodeRebuilder r, java.lang.Object env)
Expr
accept()
method implements one half of the visitor pattern for rebuilding of
expressions. This visitor allows code to be slightly modified while only writing visit methods for the
parts of the syntax tree affected.
accept
in class Expr
r
- the rebuilder to accept
visit()
method of the rebuilderpublic java.lang.String toString()
public int getPrecedence()
Expr
getPrecedence()
method gets the binding precedence for this expression. This is used
to compute when inner expressions must be nested within parentheses in order to preserve the implied
order of evaluation.
getPrecedence
in class Expr
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |