Contents
Class Expression
java.lang.Object
com.hypixel.hytale.server.npc.util.expression.Expression
Simple JavaScript-style expression evaluation.
Supports strong type checking (currently Numbers, Boolean and Strings). Supports compilation to list/arrays of instructions (which are Consumer like objects) executed on a stack machine. Supports scopes/symbol tables with functions and variables. Symbols can be resolved to Suppliers when compiling so that further lookup into symbol table can be avoided (improving performance when expression is always executed within te same object context).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompile(String expression, Scope compileScope, List<ExecutionContext.Instruction> instructions) compile(String expression, Scope scope, List<ExecutionContext.Instruction> instructions, boolean fullResolve) static ValueTypecompileStatic(String expression, Scope scope, List<ExecutionContext.Instruction> instructions) execute(ExecutionContext.Instruction[] instructions, Scope scope) execute(List<ExecutionContext.Instruction> instructions, Scope scope)
-
Constructor Details
-
Expression
public Expression()
-
-
Method Details
-
compile
public ValueType compile(@Nonnull String expression, Scope scope, @Nonnull List<ExecutionContext.Instruction> instructions, boolean fullResolve) -
compile
public ValueType compile(@Nonnull String expression, Scope compileScope, @Nonnull List<ExecutionContext.Instruction> instructions) -
execute
@Nonnull public ExecutionContext execute(@Nonnull List<ExecutionContext.Instruction> instructions, Scope scope) -
execute
@Nonnull public ExecutionContext execute(@Nonnull ExecutionContext.Instruction[] instructions, Scope scope) -
evaluate
-
compileStatic
public static ValueType compileStatic(@Nonnull String expression, Scope scope, @Nonnull List<ExecutionContext.Instruction> instructions) -
getLexerInstance
-