java.lang.Object
com.maroontress.intexpr.impl.Constant
- All Implemented Interfaces:
Instruction
This class provides the instruction that places an integer constant (as an
operand) to a stack.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(Deque<SyntaxNode> stack) Interacts with the specified stack of theSyntaxNode
object to build aSyntaxTree
object.int
apply
(int[] stack, int offset) Interacts with the specified stack of an integer.toString()
-
Constructor Details
-
Constant
public Constant(com.maroontress.clione.Token token) Creates a new instance.- Parameters:
token
- The token representing an integer constant.
-
-
Method Details
-
accept
Interacts with the specified stack of theSyntaxNode
object to build aSyntaxTree
object.- Specified by:
accept
in interfaceInstruction
- Parameters:
stack
- The stack of aSyntaxNode
object.
-
apply
public int apply(int[] stack, int offset) Interacts with the specified stack of an integer.- Specified by:
apply
in 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
-