ast
Class ConstExpr
java.lang.Object
ast.ASTNode
ast.Expr
ast.ConstExpr
- Direct Known Subclasses:
- ConstBooleanExpr, ConstIntExpr, ConstStringExpr
public abstract class ConstExpr
- extends Expr
The abstract ConstExpr class represents constant expressions
(int constants, boolean constants, String constants). It contains a
a constant value. Subclasses of this class can be handled similarly
within the compiler, so most functionality can be implemented in the
visitor method for this class.
- See Also:
ASTNode
,
Expr
Field Summary |
protected java.lang.String |
constant
Constant value |
Constructor Summary |
ConstExpr(int lineNum,
java.lang.String constant)
ConstExpr constructor |
Method Summary |
abstract java.lang.Object |
accept(visitor.Visitor v,
java.lang.Object o)
Visitor method |
java.lang.String |
getConstant()
Get the constant value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
constant
protected java.lang.String constant
- Constant value
ConstExpr
public ConstExpr(int lineNum,
java.lang.String constant)
- ConstExpr constructor
- Parameters:
lineNum
- source line number corresponding to this AST nodeconstant
- constant value
getConstant
public java.lang.String getConstant()
- Get the constant value
- Returns:
- constant value
accept
public abstract java.lang.Object accept(visitor.Visitor v,
java.lang.Object o)
- Visitor method
- Specified by:
accept
in class Expr
- Parameters:
v
- visitor objecto
- object to pass down
- Returns:
- result of visiting this node
- See Also:
Visitor