Class Parser.OperatorParser
java.lang.Object
com.google.auto.value.processor.escapevelocity.Parser.OperatorParser
- Enclosing class:
- Parser
An operator-precedence parser for the binary operations we understand. It implements an
algorithm from Wikipedia
that uses recursion rather than having an explicit stack of operators and values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Parser.Operator
The operator we have just scanned, in the same way thatParser.c
is the character we have just read. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
UpdatescurrentOperator
to be an operator read from the input, orParser.Operator.STOP
if there is none.(package private) ExpressionNode
parse
(ExpressionNode lhs, int minPrecedence) Parse a subexpression whose left-hand side islhs
and where we only consider operators with precedence at leastminPrecedence
.
-
Field Details
-
currentOperator
The operator we have just scanned, in the same way thatParser.c
is the character we have just read. If we were not able to scan an operator, this will beParser.Operator.STOP
.
-
-
Constructor Details
-
OperatorParser
OperatorParser() throws IOException- Throws:
IOException
-
-
Method Details
-
parse
Parse a subexpression whose left-hand side islhs
and where we only consider operators with precedence at leastminPrecedence
.- Returns:
- the parsed subexpression
- Throws:
IOException
-
nextOperator
UpdatescurrentOperator
to be an operator read from the input, orParser.Operator.STOP
if there is none.- Throws:
IOException
-