Class ASTOperator

java.lang.Object
com.hypixel.hytale.server.npc.util.expression.compile.ast.AST
com.hypixel.hytale.server.npc.util.expression.compile.ast.ASTOperator
Direct Known Subclasses:
ASTOperatorBinary, ASTOperatorFunctionCall, ASTOperatorTuple, ASTOperatorUnary

public abstract class ASTOperator extends AST
ASTOperator have at least one child.
Since:
2017-11-22
  • Constructor Details

    • ASTOperator

      public ASTOperator(@Nonnull ValueType returnType, @Nonnull Token token, int tokenPosition)
  • Method Details

    • addArgument

      public void addArgument(@Nonnull AST argument)
    • getArguments

      @Nonnull public List<AST> getArguments()
    • genCode

      public ValueType genCode(@Nonnull List<ExecutionContext.Instruction> list, Scope scope)
      Description copied from class: AST
      Generate an instruction list from AST.

      If provided a scope as argument any references to function and variables are resolved to suppliers/functions from this scope, making the instructions only run with the same scope/context. This makes it possible to bind instructions to a specific object and eliminates the need to update the symbol table, as values can be read directly from the bound objects(s) using the suppliers.

      If the provided scope is null then variables and functions are looked up in the scope passed as argument when executing the instructions.

      Overrides:
      genCode in class AST
      Parameters:
      list - List to append instructions to
      scope - if not null does deep resolve of variables and functions
      Returns:
      Result type of expression
    • fromParsedOperator

      public static void fromParsedOperator(@Nonnull Parser.ParsedToken operand, @Nonnull CompileContext compileContext) throws ParseException
      Throws:
      ParseException