TT - Enumerates the scanner-specific token typespublic class StatelessScanner<TT extends Enum<TT>> extends AbstractScanner<TT>
AbstractScanner.Tokens. Before produce() is called, the scanner must be
configured by invoking its addRule(String, Enum) methods. These define how character sequences are
converted into AbstractScanner.Tokens.
For an example usage, see the source code of Scanner
AbstractScanner.Token<TT extends Enum<TT>>cs, offset, previousTokenOffset| Constructor and Description |
|---|
StatelessScanner() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRule(String regex,
TT tokenType)
Adds a rule that produces the given tokenType if the next characters of the input match the given
regex.
|
AbstractScanner.Token<TT> |
produce()
Before
StringScanner.setInput(CharSequence) is called, this method returns null. |
getOffset, getPreviousTokenOffset, setInput, suppress, suppress, toStringpublic void addRule(String regex, TT tokenType)
@Nullable public AbstractScanner.Token<TT> produce() throws ScanException
StringScannerStringScanner.setInput(CharSequence) is called, this method returns null. After StringScanner.setInput(CharSequence) was called, this method breaks the input char character sequence up into tokens and
returns them one by one. When the input char sequence is exhausted, null is returned until StringScanner.setInput(CharSequence) is called again.null iff the input string is exhaustedScanExceptionCopyright © 2018 Arno Unkrig. All rights reserved.