Contents
- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getScope()
- getOperandStack()
- getExecutionContext()
- compile(String, Scope, boolean)
- compile(String, Scope, boolean, List)
- compile(String, boolean)
- getInstructions()
- setInstructions(List)
- getResultType()
- getAsOperand()
- checkResultType(ValueType)
- pushOperand(Parser.ParsedToken)
- processOperator(Parser.ParsedToken)
- processFunction(int)
- processTuple(Parser.ParsedToken, int)
- done()
Class CompileContext
java.lang.Object
com.hypixel.hytale.server.npc.util.expression.compile.CompileContext
- All Implemented Interfaces:
Parser.ParsedTokenConsumer
Helper class for compiling an expression to an instruction list.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckResultType(ValueType type) Compile a JavaScript style expression string to an instruction list.Compile a JavaScript style expression string to an instruction list.compile(String expression, Scope compileScope, boolean fullResolve, List<ExecutionContext.Instruction> instructions) Compile a JavaScript style expression string to an instruction list.voiddone()Called when expression parsed completely.getScope()voidprocessFunction(int argumentCount) Process a function call.voidprocessOperator(Parser.ParsedToken operator) Process a single operator.voidprocessTuple(Parser.ParsedToken openingToken, int argumentCount) Process a tuple.voidpushOperand(Parser.ParsedToken parsedToken) Process a single operand (identifier, number or string)voidsetInstructions(List<ExecutionContext.Instruction> instructionList)
-
Constructor Details
-
CompileContext
public CompileContext() -
CompileContext
-
-
Method Details
-
getScope
-
getOperandStack
-
getExecutionContext
-
compile
Compile a JavaScript style expression string to an instruction list.- Parameters:
expression- String to compilecompileScope- The symbol table to usefullResolve- If true symbol lookups are resolved directly with suppliers from the scope else lookup instructions are created- Returns:
- The return type of the expression (instruction can be read with getInstructions())
-
compile
public ValueType compile(@Nonnull String expression, Scope compileScope, boolean fullResolve, List<ExecutionContext.Instruction> instructions) Compile a JavaScript style expression string to an instruction list.- Parameters:
expression- String to compilecompileScope- The symbol table to usefullResolve- If true symbol lookups are resolved directly with suppliers from the scope else lookup instructions are createdinstructions- list to store instructions too (will be cleared)- Returns:
- The return type of the expression (instruction can be read with getInstructions())
-
compile
Compile a JavaScript style expression string to an instruction list.- Parameters:
expression- String to compilefullResolve- If true symbol lookups are resolved directly with suppliers from the scope else lookup instructions are created- Returns:
- The return type of the expression (instruction can be read with getInstructions())
-
getInstructions
-
setInstructions
-
getResultType
-
getAsOperand
-
checkResultType
-
pushOperand
Description copied from interface:Parser.ParsedTokenConsumerProcess a single operand (identifier, number or string)- Specified by:
pushOperandin interfaceParser.ParsedTokenConsumer- Parameters:
parsedToken- ParsedToken with operand
-
processOperator
Description copied from interface:Parser.ParsedTokenConsumerProcess a single operator.- Specified by:
processOperatorin interfaceParser.ParsedTokenConsumer- Parameters:
operator- ParsedToken with operator- Throws:
ParseException- In case of parser or lexer error
-
processFunction
Description copied from interface:Parser.ParsedTokenConsumerProcess a function call.The function name precedes the arguments on operand stack.
- Specified by:
processFunctionin interfaceParser.ParsedTokenConsumer- Parameters:
argumentCount- number of arguments passed to function- Throws:
ParseException
-
processTuple
Description copied from interface:Parser.ParsedTokenConsumerProcess a tuple.- Specified by:
processTuplein interfaceParser.ParsedTokenConsumer- Parameters:
argumentCount- number of arguments passed to function
-
done
public void done()Description copied from interface:Parser.ParsedTokenConsumerCalled when expression parsed completely.- Specified by:
donein interfaceParser.ParsedTokenConsumer
-