Class ParenthesisedExpressionReader
java.lang.Object
ch.andre601.expressionparser.parsers.ValueReader
ch.andre601.expressionparser.parsers.ParenthesisedExpressionReader
ValueReader converting a set of token into an ExpressionTemplate if the first token is the same
as the first token provided and the follow-up tokens containing the second provided token.-
Constructor Summary
ConstructorsConstructorDescriptionParenthesisedExpressionReader(Token openingParenthesis, Token closingParenthesis) Sets the tokens to look for when parsing. -
Method Summary
Modifier and TypeMethodDescriptionread(ExpressionTemplateParser parser, List<Token> tokens, ParseWarnCollector collector) Takes the first Token from the token list and checks, if it is the set opening parenthesis Token.
-
Constructor Details
-
ParenthesisedExpressionReader
Sets the tokens to look for when parsing.- Parameters:
openingParenthesis- First token to look for representing an opening parenthesis.closingParenthesis- Second token to look for representing a closing parenthesis.
-
-
Method Details
-
read
public ExpressionTemplate read(ExpressionTemplateParser parser, List<Token> tokens, ParseWarnCollector collector) Takes the first Token from the token list and checks, if it is the set opening parenthesis Token.
If true, iterates through the remaining Token list until a closing parenthesis Token matching the one set is found, or the end of the list is reached and returns a with the retrieved values.
May return null if no opening parenthesis Token matching the one set is found.- Specified by:
readin classValueReader- Parameters:
parser- ExpressionTemplateParser instance to use. The default ExpressionTemplateParser provides itself here.tokens- List of tokens to parse into an ExpressionTemplate.collector-ParseWarnCollectorinstance to use.- Returns:
- Possibly null
ExpressionTemplate.
-