public interface PendedOperator
This interface represents the operator wrapper temporally created while
the
Compiler
creates the list of Instruction
objects in
Reverse Polish notation.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
comparePrecedence
(Operator that) Compares the precedences of this and the specified operator.com.maroontress.clione.Token
getToken()
Returns the token if this is a left parenthesis or throwsIllegalStateException
otherwise.static PendedOperator
newLeftParen
(com.maroontress.clione.Token token) Returns a newPendedOperator
object that represents a left parenthesis.static PendedOperator
Returns a newPendedOperator
object that represents the specified operator.Returns the operator that this wraps if this is not a left parenthesis, otherwiseOptional.empty()
.
-
Method Details
-
toOperator
Returns the operator that this wraps if this is not a left parenthesis, otherwiseOptional.empty()
.- Returns:
- The operator that this wraps or
Optional.empty()
.
-
comparePrecedence
Compares the precedences of this and the specified operator.- Parameters:
that
- The operator to compare the precedence of.- Returns:
- A negative integer, zero, or a positive integer as the
precedence of this is less than, equal to, or greater than one of
that
.
-
getToken
com.maroontress.clione.Token getToken()Returns the token if this is a left parenthesis or throwsIllegalStateException
otherwise.- Returns:
- The token.
-
newLeftParen
Returns a newPendedOperator
object that represents a left parenthesis.- Parameters:
token
- The token representing a left parenthesis.- Returns:
- The new
PendedOperator
object.
-
of
Returns a newPendedOperator
object that represents the specified operator.- Parameters:
operator
- The operator to wrap.- Returns:
- The new
PendedOperator
object.
-