Package org.codehaus.mojo.natives.parser
Class LetterState
- java.lang.Object
-
- org.codehaus.mojo.natives.parser.AbstractParserState
-
- org.codehaus.mojo.natives.parser.LetterState
-
public final class LetterState extends AbstractParserState
This parser state checks consumed characters against a specific character.
-
-
Field Summary
Fields Modifier and Type Field Description private AbstractParserState
nextState
Next state if a match is found.private AbstractParserState
noMatchState
Next state if not match is found.private char
thisLetter
Character to match.
-
Constructor Summary
Constructors Constructor Description LetterState(AbstractParser parser, char matchLetter, AbstractParserState nextStateArg, AbstractParserState noMatchStateArg)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractParserState
consume(char ch)
Consumes a character and returns the next state for the parser.-
Methods inherited from class org.codehaus.mojo.natives.parser.AbstractParserState
getParser
-
-
-
-
Field Detail
-
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 Detail
-
LetterState
public LetterState(AbstractParser parser, char matchLetter, AbstractParserState nextStateArg, AbstractParserState noMatchStateArg)
Constructor.- Parameters:
parser
- parsermatchLetter
- letter to matchnextStateArg
- next state if a match on the letternoMatchStateArg
- state if no match on letter
-
-
Method Detail
-
consume
public AbstractParserState consume(char ch)
Consumes a character and returns the next state for the parser.- Specified by:
consume
in classAbstractParserState
- Parameters:
ch
- next character- Returns:
- the configured nextState if ch is the expected character or the configure noMatchState otherwise.
-
-