Package com.blackrook.rookscript.lang
Enum Class ScriptCommandType
- All Implemented Interfaces:
Serializable
,Comparable<ScriptCommandType>
,java.lang.constant.Constable
Directive type for scripts.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAbsolute.Add.Bitwise And.Call function.Call host function.Call a namespaced host function.If the stack top is an error, jump to label.Divide.Equal.Greater than.Greater than or equal.Performs a single iteration, expecting an OBJECTREF:ScriptIteratorType on the stack top when this is executed.Jump to index.Jump to index based on POP.Jump to index if POP is false.Jump to label if stack top is true-equivalent, else pop.Jump to label if stack top is not null, else pop.Jump to index if POP is true.Left Bit Shift.Less than.Less than or equal.Turns the topmost value into a boolean-equivalent value (the same as a not-not).Logical And.Logical Not.Logical Or.Modulo.Multiply.Negate.Do nothing.Bitwise NOT.Not Equal.Bitwise Or.POP value into nothing.Optionally preserves the topmost stack value, then POPs values until the [amount]'th sentinel was popped, then pushes the preserved value onto the stack.Sets a list value.Sets a map value.POP into variable variable.POP into variable variable.PUSH value.Pushes a Check Sentinel Object onto the stack.PUSH a list value.PUSH a list value.PUSH a new blank list initialized with values.PUSH a new blank list.PUSH a new blank map initialized with values.PUSHes a map value using a key.PUSHes a map value using a key.PUSH a new blank map.PUSH null literal.PUSH scoped variable.PUSH variable.Return value.Right Bit Shift.Right Bit Shift Padded.Set's a variable to a value.Pops a variable, creates an iterator for it, and sets a variable for it.Set's a variable to another variable's value.Strict Equal.Strict Not Equal.Subtract.Bitwise Xor. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
execute
(ScriptInstance scriptInstance, Object operand1, Object operand2) Executes this directive.static ScriptCommandType
Returns the enum constant of this class with the specified name.static ScriptCommandType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NOOP
Do nothing. No operand. -
RETURN
Return value. No operand. Restores previous command index / frame. -
CALL
Call function. Operand is label. Pushes and sets a new command index. -
CALL_HOST
Call host function. Operand is function name. -
CALL_HOST_NAMESPACE
Call a namespaced host function. Operand1 is namespace name. Operand2 is function name. -
JUMP
Jump to index. Operand is label. Sets a new command index. -
JUMP_BRANCH
Jump to index based on POP. Operand1 is label if true. Operand2 is label if false. Sets a new command index. -
JUMP_TRUE
Jump to index if POP is true. Operand is label if true. Sets a new command index. -
JUMP_FALSE
Jump to index if POP is false. Operand is label if false. Sets a new command index. -
JUMP_FALSECOALESCE
Jump to label if stack top is true-equivalent, else pop. Operand is label if false. Sets a new command index. -
JUMP_NULLCOALESCE
Jump to label if stack top is not null, else pop. Operand is label if false. Sets a new command index. -
ITERATE
Performs a single iteration, expecting an OBJECTREF:ScriptIteratorType on the stack top when this is executed. If stack top is not OBJECTREF:ScriptIteratorType, Exception - script was compiled badly. If stack top's ScriptIteratorType.hasNext() is null, POP, then JUMP to [label]. Else, call ScriptIteratorType.next(), then push value. If operand2 is true, also push key. Operand1 is label. Operand2 is value/key-value flag. Sets a new command index and one POP, or 1-2 PUSHes. -
CHECK_ERROR
If the stack top is an error, jump to label. Operand1 is label. Pushes nothing. -
PUSH
PUSH value. Operand is Boolean, Double, Long, String, Object. Pushes one value. -
PUSH_NULL
PUSH null literal. No Operands. Pushes one value. -
PUSH_VARIABLE
PUSH variable. Operand1 is String - variable name. Pushes one value. -
PUSH_SCOPE_VARIABLE
PUSH scoped variable. Operand1 is String - scope name. Operand2 is String - variable name. Pushes one value, or null if no scope. -
PUSH_LIST_NEW
PUSH a new blank list. No operands. -
PUSH_LIST_INIT
PUSH a new blank list initialized with values. Pops a value for list length. Pops [length] values into array backwards (order pushed). Pushes array value into stack. No operands. -
PUSH_LIST_INDEX
PUSH a list value. Pops two values - an index and the array. Pushes one value onto stack. No operands. -
PUSH_LIST_INDEX_CONTENTS
PUSH a list value. Pops ZERO values - only inspects two spots down in the stack! Pushes one value onto stack. No operands. -
PUSH_MAP_NEW
PUSH a new blank map. No operands. -
PUSH_MAP_INIT
PUSH a new blank map initialized with values. Pops a value for amount of entries. Pops [amount] values into map. Pushes map value into stack. No operands. -
PUSH_MAP_KEY
PUSHes a map value using a key. Pops two values - key and map. If map value is not a map, pushes NULL. No operands. -
PUSH_MAP_KEY_CONTENTS
PUSHes a map value using a key. Pops ZERO values - only inspects two spots down in the stack! Pushes one value onto stack. No operands. -
SET_ITERATOR_VARIABLE
Pops a variable, creates an iterator for it, and sets a variable for it. Pops one value. Sets a variable. Operand is variable name. -
PUSH_CHECK
Pushes a Check Sentinel Object onto the stack. Pushes one value onto stack. No operands. -
POP
POP value into nothing. No operands. -
POP_VARIABLE
POP into variable variable. Operand is String - variable name. -
POP_SCOPE_VARIABLE
POP into variable variable. Operand is String - variable name. -
POP_LIST
Sets a list value. Pops three values - the value, the index, and then the list. No operands. -
POP_MAP
Sets a map value. Pops three values - the value, the key, and then the map. No operands. -
POP_CHECK
Optionally preserves the topmost stack value, then POPs values until the [amount]'th sentinel was popped, then pushes the preserved value onto the stack. Operand1 is amount of sentinel objects to pop. Operand2 is the preserve top flag (true = do it, false = don't). -
SET
Set's a variable to a value. Operand1 is String - variable name. Operand2 is Object value. -
SET_VARIABLE
Set's a variable to another variable's value. Operand1 is String - variable name. Operand2 is String - variable name. -
NOT
Bitwise NOT. Pushes one value. -
NEGATE
Negate. Pops one value. Pushes one value. -
ABSOLUTE
Absolute. Pops one value. Pushes one value. -
LOGICAL
Turns the topmost value into a boolean-equivalent value (the same as a not-not). Pops one value. Pushes one value. -
LOGICAL_NOT
Logical Not. Pops one value. Pushes one value. -
ADD
Add. Pops two values. Pushes one value. -
SUBTRACT
Subtract. Pops two values. Pushes one value. -
MULTIPLY
Multiply. Pops two values. Pushes one value. -
DIVIDE
Divide. Pops two values. Pushes one value. -
MODULO
Modulo. Pops two values. Pushes one value. -
AND
Bitwise And. Pops two values. Pushes one value. -
OR
Bitwise Or. Pops two values. Pushes one value. -
XOR
Bitwise Xor. Pops two values. Pushes one value. -
LOGICAL_AND
Logical And. Pops two values. Pushes one value. -
LOGICAL_OR
Logical Or. Pops two values. Pushes one value. -
LEFT_SHIFT
Left Bit Shift. Pops two values. Pushes one value. -
RIGHT_SHIFT
Right Bit Shift. Pops two values. Pushes one value. -
RIGHT_SHIFT_PADDED
Right Bit Shift Padded. Pops two values. Pushes one value. -
LESS
Less than. Pops two values. Pushes one value. -
LESS_OR_EQUAL
Less than or equal. Pops two values. Pushes one value. -
GREATER
Greater than. Pops two values. Pushes one value. -
GREATER_OR_EQUAL
Greater than or equal. Pops two values. Pushes one value. -
EQUAL
Equal. Pops two values. Pushes one value. -
NOT_EQUAL
Not Equal. Pops two values. Pushes one value. -
STRICT_EQUAL
Strict Equal. Pops two values. Pushes one value. -
STRICT_NOT_EQUAL
Strict Not Equal. Pops two values. Pushes one value.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
execute
Executes this directive.- Parameters:
scriptInstance
- the originating script instance.operand1
- the first operand.operand2
- the second operand.- Returns:
- if false, this halts script execution, else if true, continue.
-