java.lang.Object
io.jenetics.ext.internal.parser.Parser<T>
- Type Parameters:
T
- the token type
- Direct Known Subclasses:
TokenParser
Parser implementation for parsing a given token sequences.
- Since:
- 7.1
- Version:
- 7.1
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Parser
Create a new parser object with the giventokenizer
and lookahead countk
.- Parameters:
tokenizer
- the token sourcethis
parser usesk
- the lookahead count
-
-
Method Details
-
LT
Return the lookahead token with the given index. The index starts at1
. The returned token might benull
.- Parameters:
index
- lookahead index- Returns:
- the token at the given index
-
match
Try to match and consume the next token of the giventype
. If the current token is not from the given type, aParsingException
is thrown.- Parameters:
token
- the token type to match- Returns:
- the matched token
- Throws:
ParsingException
- if the current token doesn't match the desiredtoken
-
consume
Consumes the next token.
-