java.lang.Object
com.maroontress.intexpr.impl.Operator
- All Implemented Interfaces:
Instruction
The instruction that pops the operand(s) from the stack, executes the
function with the operand(s), and pushes the return value to the stack.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(Deque<SyntaxNode> stack) Interacts with the specified stack of theSyntaxNodeobject to build aSyntaxTreeobject.intapply(int[] stack, int offset) Interacts with the specified stack of an integer.getSpec()Returns theOperatorSpecobject of this operator.com.maroontress.clione.TokengetToken()Returns the token of this operator.of(com.maroontress.clione.Token token, OperatorType type) Creates a newOperatorobject corresponding to the specified token andOperatorType.toString()
-
Method Details
-
of
Creates a newOperatorobject corresponding to the specified token andOperatorType.- Parameters:
token- The token corresponding to the operator.type- The operator type (OperatorType.UNARYorOperatorType.BINARY).- Returns:
- The new operator.
-
getSpec
Returns theOperatorSpecobject of this operator.- Returns:
- The
OperatorSpecobject.
-
getToken
public com.maroontress.clione.Token getToken()Returns the token of this operator.- Returns:
- The token.
-
accept
Interacts with the specified stack of theSyntaxNodeobject to build aSyntaxTreeobject.- Specified by:
acceptin interfaceInstruction- Parameters:
stack- The stack of aSyntaxNodeobject.
-
apply
public int apply(int[] stack, int offset) Interacts with the specified stack of an integer.- Specified by:
applyin interfaceInstruction- Parameters:
stack- The stack of an integer.offset- The position of the top of the stack.- Returns:
- The new offset of the top of the stack.
-
toString
-