Class LetterState

java.lang.Object
net.sf.antcontrib.cpptasks.parser.AbstractParserState
net.sf.antcontrib.cpptasks.parser.LetterState

public final class LetterState extends AbstractParserState
This parser state checks consumed characters against a specific character.
  • Field Details

    • nextState

      private final AbstractParserState nextState
      Next state if a match is found.
    • noMatchState

      private final AbstractParserState noMatchState
      Next state if not match is found.
    • thisLetter

      private final char thisLetter
      Character to match.
  • Constructor Details

    • LetterState

      public LetterState(AbstractParser parser, char matchLetter, AbstractParserState nextStateArg, AbstractParserState noMatchStateArg)
      Constructor.
      Parameters:
      parser - parser
      matchLetter - letter to match
      nextStateArg - next state if a match on the letter
      noMatchStateArg - state if no match on letter
  • Method Details

    • 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.