Interface Expression

All Known Implementing Classes:
BinaryOperation, BracketedExpression, Constant, FunctionCall, Lambda, ListDeclaration, ParameterToken, PropertyAccess, SelectAllExpression, StructDeclaration

public interface Expression

An as yet Unrealized expression AST.

Implementing bits of AST should not consider the underlying source code to be part of the objects identity, only the meaningful bits of the AST. For the most part, this boils down to ignoring whitespace and location the source.

  • Method Details

    • toSource

      String toSource()
    • isA

      default <T extends Expression> Optional<T> isA(Class<T> type)

      Functional style instanceof method

    • getBoundary

      Optional<Pair<Token,Token>> getBoundary()
      Returns:
      a pair of tokens that represent the start and end of this expression, to be used when giving users information about where errors have occurred. If the expression has been rebuilt then the boundary may be empty or it may be from the original expression. Intended for use in problems to trace errors back to their source.
    • accept

      <T, R> R accept(ExpressionVisitor<T,R> visitor, T data)