Class NonQuotedLiteralTokenReader

java.lang.Object
ch.andre601.expressionparser.tokens.readers.TokenReader
ch.andre601.expressionparser.tokens.readers.NonQuotedLiteralTokenReader

public class NonQuotedLiteralTokenReader extends TokenReader
TokenReader instance that parses the provided Text by iterating through it until it finds a space character or hits the end of the text, to then convert into a StringToken instance.
  • Constructor Details

    • NonQuotedLiteralTokenReader

      public NonQuotedLiteralTokenReader(int priority)
      Constructor for creating a new NonQuotedLiteralTokenReader.
      Parameters:
      priority - The priority this TokenReader should have.
  • Method Details

    • read

      public Token read(String text, ParsePosition position, ParseWarnCollector collector)
      Iterates through the provided String until it finds a Whitespace Character at which point it returns a new StringToken whose value is the retrieved String up until the whitespace character.
      Should the current index end up being larger than the Text length will null be returned instead with a Warning added to the ParseWarnCollector.
      Specified by:
      read in class TokenReader
      Parameters:
      text - The text to parse.
      position - The current position within the text.
      collector - Instance of the ParseWarnCollector used for the parsing.
      Returns:
      New StringToken containing the retrieved text.