TT
- Enumerates the scanner-specific token typespublic abstract class AbstractScanner<TT extends Enum<TT>> extends Object implements StringScanner<TT>
AbstractScanner.Token
s.StringScanner.produce()
Modifier and Type | Class and Description |
---|---|
static class |
AbstractScanner.Token<TT extends Enum<TT>>
Representation of a scanned token.
|
Modifier and Type | Field and Description |
---|---|
protected CharSequence |
cs
The string currently being scanned; typically one line from an input document.
|
protected int |
offset
The position within
cs of the next token to be scanned. |
protected int |
previousTokenOffset
The position within
cs of the previously scanned token. |
Constructor and Description |
---|
AbstractScanner() |
Modifier and Type | Method and Description |
---|---|
int |
getOffset() |
int |
getPreviousTokenOffset() |
AbstractScanner<TT> |
setInput(CharSequence cs) |
ProducerWhichThrows<AbstractScanner.Token<TT>,ScanException> |
suppress(Collection<TT> suppressedTokenTypes)
Creates and returns a producer which skips tokens of the suppressedTokenTypes.
|
ProducerWhichThrows<AbstractScanner.Token<TT>,ScanException> |
suppress(TT suppressedTokenType)
Creates and returns a producer which skips tokens of the suppressedTokenType.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
produce
protected CharSequence cs
protected int offset
cs
of the next token to be scanned.protected int previousTokenOffset
cs
of the previously scanned token.public AbstractScanner<TT> setInput(CharSequence cs)
setInput
in interface StringScanner<TT extends Enum<TT>>
cs
- The CharSequence
from which following calls to StringScanner.produce()
will scan tokenspublic int getOffset()
getOffset
in interface StringScanner<TT extends Enum<TT>>
StringScanner.setInput(CharSequence)
where the previously
scanned token ends, or 0 after the call to StringScanner.setInput(CharSequence)
and before the first
call to StringScanner.produce()
public int getPreviousTokenOffset()
getPreviousTokenOffset
in interface StringScanner<TT extends Enum<TT>>
StringScanner.setInput(CharSequence)
where the previously
scanned token begins, or -1 after the call to StringScanner.setInput(CharSequence)
and before the first
call to StringScanner.produce()
public ProducerWhichThrows<AbstractScanner.Token<TT>,ScanException> suppress(TT suppressedTokenType)
public ProducerWhichThrows<AbstractScanner.Token<TT>,ScanException> suppress(Collection<TT> suppressedTokenTypes)
public String toString()
toString
in interface ProducerWhichThrows<AbstractScanner.Token<TT extends Enum<TT>>,ScanException>
toString
in class Object
Copyright © 2018 Arno Unkrig. All rights reserved.