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

## avrora.syntax
Class Expr.Func

    java.lang.Object
      avrora.syntax.ASTNode
          avrora.syntax.Expr
              avrora.syntax.Expr.Func

Enclosing class:
  Expr

public static class Expr.Func
extends Expr

The `Func` class represents a builtin function that is applied to an operand. For example, a function might be "high" which returns the high byte of a 16-bit operand, "log2" which returns the logarithm, etc.

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
`Expr` | `argument`
`AbstractToken` | `func`
`AbstractToken` | `last`

Constructor Summary
`Expr.Func(AbstractToken tok, Expr arg, AbstractToken l)`

Method Summary
`int` | `evaluate(int currentByteAddress, Context c)` The `evaluate()` method computes the value of the expression in this context and returns its value.
`AbstractToken` | `getLeftMostToken()` The `getLeftMostToken()` method gets the first token associated with the abstract syntax tree node.
`AbstractToken` | `getRightMostToken()` The `getRightMostToken()` method gets the last token associated with the abstract syntax tree node.
`java.lang.String` | `toString()`

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

Field Detail

### func

    public final AbstractToken func

### argument

    public final Expr argument

### last

    public final AbstractToken last

Constructor Detail

### Expr.Func

    public Expr.Func(AbstractToken tok,
                     Expr arg,
                     AbstractToken l)

Method Detail

### evaluate

    public int evaluate(int currentByteAddress,
                        Context c)

  The `evaluate()` method computes the value of the expression in this context and returns its value. This implementation works straightforwardly by first evaluating the operand, and then computing the result of the function.

  Specified by:
    `evaluate` in class `Expr`
  Parameters:
    `currentByteAddress` - the current byte address within the program
    `c` - the context in which to evaluate this expression
  Returns:
    the value of the expression as a 32-bit integer

### getLeftMostToken

    public AbstractToken getLeftMostToken()

  Description copied from class: `ASTNode`
  The `getLeftMostToken()` method gets the first token associated with the abstract syntax tree node.

  Specified by:
    `getLeftMostToken` in class `ASTNode`
  Returns:
    an `AbstractToken` instance representing the first token that is a part of this syntactic item.

### getRightMostToken

    public AbstractToken getRightMostToken()

  Description copied from class: `ASTNode`
  The `getRightMostToken()` method gets the last token associated with the abstract syntax tree node.

  Specified by:
    `getRightMostToken` in class `ASTNode`
  Returns:
    an `AbstractToken` instance representing the last token that is a part of this syntactic item.

### toString

    public java.lang.String toString()

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