Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.core.isdl.ast
Class Literal

    java.lang.Object
      avrora.core.isdl.ast.Expr
          avrora.core.isdl.ast.Literal

Direct Known Subclasses:
  Literal.BoolExpr, Literal.IntExpr

public abstract class Literal
extends Expr

The `Literal` class represents a literal (constant value) as part of an expression. Literals have known, constant values, either boolean or integer.

Nested Class Summary
`static class` | `Literal.BoolExpr` The `BoolExpr` inner class represents a boolean literal that has a known, constant value (true or false).
`static class` | `Literal.IntExpr` The `IntExpr` inner class represents an integer literal that has a known, constant value.

Field Summary
`Token` | `token` The `token` fields stores a reference to the original token representing this literal.

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(Token t)`

Method Summary
`void` | `accept(ExprVisitor 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.
`boolean` | `isConstantExpr()` The `isConstantExpr()` method tests whether this expression is a constant expression (i.e. it is reducable to a constant and has no references to variables, maps, etc).
`boolean` | `isLiteral()` The `isLiteral()` method tests whether this expression is a known constant directly (i.e. a literal).

Methods inherited from class avrora.core.isdl.ast.Expr
`accept, accept, getBitWidth, getPrecedence, innerString, isBitRangeExpr, isMap, isVariable, tokenToBool, tokenToInt`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### token

    public final Token token

  The `token` fields stores a reference to the original token representing this literal.

Constructor Detail

### Literal

    public Literal(Token t)

Method Detail

### isLiteral

    public boolean isLiteral()

  Description copied from class: `Expr`
  The `isLiteral()` method tests whether this expression is a known constant directly (i.e. a literal).

  Overrides:
    `isLiteral` in class `Expr`
  Returns:
    true if this expression is a literal; false otherwise

### isConstantExpr

    public boolean isConstantExpr()

  The `isConstantExpr()` method tests whether this expression is a constant expression (i.e. it is reducable to a constant and has no references to variables, maps, etc). For literals, this method will always return true because a literal is a constant value.

  Overrides:
    `isConstantExpr` in class `Expr`
  Returns:
    true if this expression can be evaluated to a constant; false otherwise

### accept

    public void accept(ExprVisitor 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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD