TT
- Enumerates the scanner-specific token typespublic class StatelessScanner<TT extends Enum<TT>> extends AbstractScanner<TT>
AbstractScanner.Token
s. 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.Token
s.
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, toString
public void addRule(String regex, TT tokenType)
@Nullable public AbstractScanner.Token<TT> produce() throws ScanException
StringScanner
StringScanner.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 exhaustedScanException
Copyright © 2018 Arno Unkrig. All rights reserved.