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 TypeMethodDescriptionintcomparePrecedence(Operator that) Compares the precedences of this and the specified operator.com.maroontress.clione.TokengetToken()Returns the token if this is a left parenthesis or throwsIllegalStateExceptionotherwise.static PendedOperatornewLeftParen(com.maroontress.clione.Token token) Returns a newPendedOperatorobject that represents a left parenthesis.static PendedOperatorReturns a newPendedOperatorobject 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 throwsIllegalStateExceptionotherwise.- Returns:
- The token.
-
newLeftParen
Returns a newPendedOperatorobject that represents a left parenthesis.- Parameters:
token- The token representing a left parenthesis.- Returns:
- The new
PendedOperatorobject.
-
of
Returns a newPendedOperatorobject that represents the specified operator.- Parameters:
operator- The operator to wrap.- Returns:
- The new
PendedOperatorobject.
-