avrora.syntax
Class Expr.StringLiteral
java.lang.Object
avrora.syntax.ASTNode
avrora.syntax.Expr
avrora.syntax.Expr.Term
avrora.syntax.Expr.StringLiteral
- Enclosing class:
- Expr
- public static class Expr.StringLiteral
- extends Expr.Term
The StringLiteral
class represents a string literal within the program. A string literal
can be used within a list of initialized data and occupies a span of bytes. However, it cannot be
evaluated to an integer. It is treated specifially in the simplification phase.
Field Summary |
java.lang.String |
value
|
Method Summary |
int |
evaluate(int currentByteAddress,
Context c)
The evaluate() method computes the value of the expression in this context and returns
its value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
value
public final java.lang.String value
Expr.StringLiteral
public Expr.StringLiteral(AbstractToken tok)
evaluate
public int evaluate(int currentByteAddress,
Context c)
- The
evaluate()
method computes the value of the expression in this context and returns
its value. A string cannot be evaluated to a 32-bit integer; this method throws an exception.
- Specified by:
evaluate
in class Expr
- Parameters:
currentByteAddress
- the current byte address within the programc
- the context in which to evaluate this expression
- Returns:
- the value of the expression as a 32-bit integer
- Throws:
Avrora.InternalError
- because a string cannot be evaluated to a 32-bit integer