Class Tokenizer
java.lang.Object
eu.svjatoslav.commons.string.tokenizer.Tokenizer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddTerminator
(Terminator terminator) addTerminator
(Terminator.TerminationStrategy terminationStrategy, String regexp) addTerminator
(Terminator.TerminationStrategy terminationStrategy, String regexp, String group) boolean
consumeIfNextToken
(String token) void
For debuggingvoid
expectAndConsumeNextTerminatorToken
(Terminator terminator) boolean
void
peekExpectNoneOf
(String... possibilities) boolean
peekIsOneOf
(String... possibilities) void
void
-
Constructor Details
-
Tokenizer
-
Tokenizer
public Tokenizer()
-
-
Method Details
-
setSource
-
addTerminator
-
addTerminator
public Terminator addTerminator(Terminator.TerminationStrategy terminationStrategy, String regexp, String group) -
addTerminator
-
expectAndConsumeNextStringToken
- Throws:
InvalidSyntaxException
-
expectAndConsumeNextTerminatorToken
public TokenizerMatch expectAndConsumeNextTerminatorToken(Terminator terminator) throws InvalidSyntaxException - Throws:
InvalidSyntaxException
-
getNextToken
- Returns:
- next @TokenizerMatch or
null
if end of input is reached.
-
findTerminatorMatch
-
hasMoreContent
public boolean hasMoreContent() -
consumeIfNextToken
- Throws:
InvalidSyntaxException
-
peekNextToken
- Throws:
InvalidSyntaxException
-
peekIsOneOf
- Throws:
InvalidSyntaxException
-
peekExpectNoneOf
- Throws:
InvalidSyntaxException
-
unreadToken
public void unreadToken() -
enlistRemainingTokens
public void enlistRemainingTokens()For debugging -
skipUntilDataEnd
public void skipUntilDataEnd()
-