Class QuotedLiteralTokenReader
java.lang.Object
ch.andre601.expressionparser.tokens.readers.TokenReader
ch.andre601.expressionparser.tokens.readers.QuotedLiteralTokenReader
TokenReader instance
that parses the provided text by looking for the appearance of the provided
char.
Should one be found will everything until the next appearance of this char, or until the end of the text, be included in a new
StringToken instance
.-
Constructor Summary
ConstructorDescriptionQuotedLiteralTokenReader
(int priority, char character) Constructor for creating a new QuotedLiteralTokenReader. -
Method Summary
Modifier and TypeMethodDescriptionread
(String text, ParsePosition position, ParseWarnCollector collector) Checks if the current position is less than the text length and if the character at current position is the character set in this TokenReader.Methods inherited from class ch.andre601.expressionparser.tokens.readers.TokenReader
getPriority
-
Constructor Details
-
QuotedLiteralTokenReader
public QuotedLiteralTokenReader(int priority, char character) Constructor for creating a new QuotedLiteralTokenReader.- Parameters:
priority
- The priority this TokenReader should have.character
- Character used as the quote character.
-
-
Method Details
-
read
Checks if the current position is less than the text length and if the character at current position is the character set in this TokenReader.
Should it be true, iterates through the remaining text until it finds another instance of the character, or hits the end of the text, after which aStringToken
with the found String will be returned.
May returnnull
if the current position is equal or larger than text length, or the character at current position is not the one set.- Specified by:
read
in classTokenReader
- Parameters:
text
- The text to parse.position
- The current position within the text.collector
- Instance of theParseWarnCollector
used for the parsing.- Returns:
- Possibly-null
Token
.
-