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.OperatorThe operator we have just scanned, in the same way thatParser.cis the character we have just read. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidUpdatescurrentOperatorto be an operator read from the input, orParser.Operator.STOPif there is none.(package private) ExpressionNodeparse(ExpressionNode lhs, int minPrecedence) Parse a subexpression whose left-hand side islhsand where we only consider operators with precedence at leastminPrecedence.
-
Field Details
-
currentOperator
The operator we have just scanned, in the same way thatParser.cis 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 islhsand where we only consider operators with precedence at leastminPrecedence.- Returns:
- the parsed subexpression
- Throws:
IOException
-
nextOperator
UpdatescurrentOperatorto be an operator read from the input, orParser.Operator.STOPif there is none.- Throws:
IOException
-