Class Expr.StringLiteral

  extended byavrora.syntax.ASTNode
      extended byavrora.syntax.Expr
          extended byavrora.syntax.Expr.Term
              extended byavrora.syntax.Expr.StringLiteral
Enclosing class:

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.

Nested Class Summary
Nested classes inherited from class avrora.syntax.Expr
Expr.BinOp, Expr.CharLiteral, Expr.Constant, Expr.Func, Expr.RelativeAddress, Expr.StringLiteral, Expr.Term, Expr.UnOp, Expr.Variable
Field Summary
 java.lang.String value
Fields inherited from class avrora.syntax.Expr.Term
Constructor Summary
Expr.StringLiteral(AbstractToken tok)
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 avrora.syntax.Expr.Term
getLeftMostToken, getRightMostToken, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


public final java.lang.String value
Constructor Detail


public Expr.StringLiteral(AbstractToken tok)
Method Detail


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
currentByteAddress - the current byte address within the program
c - the context in which to evaluate this expression
the value of the expression as a 32-bit integer
Avrora.InternalError - because a string cannot be evaluated to a 32-bit integer