Class WhitespaceOrLetterState


  • public final class WhitespaceOrLetterState
    extends AbstractParserState
    This parser state checks consumed characters against a specific character or whitespace.
    Author:
    Curt Arnold
    • Constructor Detail

      • WhitespaceOrLetterState

        public WhitespaceOrLetterState​(AbstractParser parser,
                                       char matchLetter,
                                       AbstractParserState nextStateArg)
        Constructor.
        Parameters:
        parser - parser
        matchLetter - letter to match
        nextStateArg - next state if a match on the letter
    • Method Detail

      • consume

        public AbstractParserState consume​(char ch)
        Consumes a character and returns the next state for the parser.
        Specified by:
        consume in class AbstractParserState
        Parameters:
        ch - next character @returns the configured nextState if ch is the expected character or the configure noMatchState otherwise.
        Returns:
        next state