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
Constructors -
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.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 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
-