avrora.core.isdl.ast
Class Literal.BoolExpr
java.lang.Object
avrora.core.isdl.ast.Expr
avrora.core.isdl.ast.Literal
avrora.core.isdl.ast.Literal.BoolExpr
- Enclosing class:
- Literal
- public static class Literal.BoolExpr
- extends Literal
The BoolExpr
inner class represents a boolean literal that has a known, constant value
(true or false).
Field Summary |
boolean |
value
The value class stores the constant boolean 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.BoolExpr(boolean b)
The constructor of the BoolExpr class evaluates the token's string value as a boolean
and stores it in the publicly accessable value field, as well as storing a reference
to the original token |
Literal.BoolExpr(Token v)
The constructor of the BoolExpr class evaluates the token's string value as a boolean
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 |
getPrecedence()
The getPrecedence() method gets the binding precedence for this expression. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
value
public final boolean value
- The
value
class stores the constant boolean value of this literal.
Literal.BoolExpr
public Literal.BoolExpr(Token v)
- The constructor of the
BoolExpr
class evaluates the token's string value as a boolean
and stores it in the publicly accessable value
field, as well as storing a reference
to the original token
- Parameters:
v
- the token representing the value of this boolean
Literal.BoolExpr
public Literal.BoolExpr(boolean b)
- The constructor of the
BoolExpr
class evaluates the token's string value as a boolean
and stores it in the publicly accessable value
field, as well as storing a reference
to the original token
- Parameters:
b
- the value of this boolean
accept
public 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.
- Specified by:
accept
in class Expr
- Parameters:
v
- the visitor to accept
accept
public Expr accept(CodeRebuilder r,
java.lang.Object env)
- Description copied from class:
Expr
- The
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.
- Specified by:
accept
in class Expr
- Parameters:
r
- the rebuilder to accept
- Returns:
- the result of calling the appropriate
visit()
method of the rebuilder
toString
public java.lang.String toString()
getPrecedence
public int getPrecedence()
- Description copied from class:
Expr
- The
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.
- Specified by:
getPrecedence
in class Expr
- Returns:
- an integer representing the precedence of this expression; higher numbers are higher
precedence