- Type Parameters:
V- the token value type
Parser implementation for parsing explicit
Token sequences.- Since:
- 7.1
- Version:
- 7.1
-
Constructor Summary
ConstructorsConstructorDescriptionTokenParser(Tokenizer<Token<V>> tokenizer, int k) Create a new parser object with the giventokenizerand lookahead countk. -
Method Summary
Modifier and TypeMethodDescriptionintLA(int index) Return the token type code for the given lookahead index.match(Token.Type type) Try to match and consume the next token of the giventype.
-
Constructor Details
-
TokenParser
Create a new parser object with the giventokenizerand lookahead countk.- Parameters:
tokenizer- the token sourcethisparser usesk- the lookahead count
-
-
Method Details
-
LA
Return the token type code for the given lookahead index.- Parameters:
index- lookahead index- Returns:
- the token type code for the given lookahead index
-
match
Try to match and consume the next token of the giventype. If the current token is not from the given type, aParsingExceptionis thrown.- Parameters:
type- the token type to match- Returns:
- the matched token
- Throws:
NullPointerException- if the given tokentypeisnullParsingException- if the current token doesn't match the desired tokentype
-