|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.runtime.misc.FastQueue<T>
org.antlr.runtime.misc.LookaheadStream<T>
public abstract class LookaheadStream<T>
A lookahead queue that knows how to mark/release locations in the buffer for backtracking purposes. Any markers force the FastQueue superclass to keep all tokens until no more markers; then can reset to avoid growing a huge buffer.
Field Summary | |
---|---|
protected int |
currentElementIndex
Absolute token index. |
T |
eof
Track object returned by nextElement upon end of stream; Return it later when they ask for LT passed end of input. |
protected int |
lastMarker
Track the last mark() call result value for use in rewind(). |
protected int |
markDepth
tracks how deep mark() calls are nested |
protected T |
prevElement
|
static int |
UNINITIALIZED_EOF_ELEMENT_INDEX
|
Fields inherited from class org.antlr.runtime.misc.FastQueue |
---|
data, p, range |
Constructor Summary | |
---|---|
LookaheadStream()
|
Method Summary | |
---|---|
void |
consume()
Make sure we have at least one element to remove, even if EOF |
void |
fill(int n)
add n elements to buffer |
int |
index()
|
abstract boolean |
isEOF(T o)
|
protected T |
LB(int k)
|
T |
LT(int k)
|
int |
mark()
|
abstract T |
nextElement()
Implement nextElement to supply a stream of elements to this lookahead buffer. |
void |
release(int marker)
|
T |
remove()
Get and remove first element in queue; override FastQueue.remove(); it's the same, just checks for backtracking. |
void |
reset()
|
void |
rewind()
|
void |
rewind(int marker)
|
void |
seek(int index)
Seek to a 0-indexed position within data buffer. |
int |
size()
Size of entire stream is unknown; we only know buffer size from FastQueue |
protected void |
syncAhead(int need)
Make sure we have 'need' elements from current position p. |
Methods inherited from class org.antlr.runtime.misc.FastQueue |
---|
add, clear, elementAt, head, range, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int UNINITIALIZED_EOF_ELEMENT_INDEX
protected int currentElementIndex
protected T prevElement
public T eof
protected int lastMarker
protected int markDepth
Constructor Detail |
---|
public LookaheadStream()
Method Detail |
---|
public void reset()
reset
in class FastQueue<T>
public abstract T nextElement()
public abstract boolean isEOF(T o)
public T remove()
remove
in class FastQueue<T>
public void consume()
protected void syncAhead(int need)
public void fill(int n)
public int size()
size
in class FastQueue<T>
public T LT(int k)
public int index()
public int mark()
public void release(int marker)
public void rewind(int marker)
public void rewind()
public void seek(int index)
protected T LB(int k)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |