|
||||||||||
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 | |
---|---|
T |
eof
Returned by nextElement upon end of stream; we add to buffer also |
protected int |
eofElementIndex
Set to buffer index of eof when nextElement returns eof |
protected int |
lastMarker
Track the last mark() call result value for use in rewind(). |
protected int |
markDepth
tracks how deep mark() calls are nested |
static int |
UNINITIALIZED_EOF_ELEMENT_INDEX
|
Fields inherited from class org.antlr.runtime.misc.FastQueue |
---|
data, p |
Constructor Summary | |
---|---|
LookaheadStream(T eof)
|
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 |
java.lang.Object |
getCurrentSymbol()
|
int |
index()
|
protected java.lang.Object |
LB(int k)
Look backwards k nodes |
java.lang.Object |
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() |
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 |
void |
sync(int need)
Make sure we have 'need' elements from current position p. |
Methods inherited from class org.antlr.runtime.misc.FastQueue |
---|
add, clear, get, head, 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 eofElementIndex
public T eof
protected int lastMarker
protected int markDepth
Constructor Detail |
---|
public LookaheadStream(T eof)
Method Detail |
---|
public void reset()
reset
in class FastQueue<T>
public abstract T nextElement()
public T remove()
remove
in class FastQueue<T>
public void consume()
public void sync(int need)
public void fill(int n)
public int size()
size
in class FastQueue<T>
public java.lang.Object LT(int k)
protected java.lang.Object LB(int k)
public java.lang.Object getCurrentSymbol()
public int index()
public int mark()
public void release(int marker)
public void rewind(int marker)
public void rewind()
public void seek(int index)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |