org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T > Class Reference

Inheritance diagram for org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >:

Inheritance graph
[legend]
Collaboration diagram for org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void reset ()
abstract T nextElement ()
abstract boolean isEOF (T o)
remove ()
void consume ()
void fill (int n)
int size ()
LT (int k)
int index ()
int mark ()
void release (int marker)
void rewind (int marker)
void rewind ()
void seek (int index)

Public Attributes

eof = null

Static Public Attributes

static final int UNINITIALIZED_EOF_ELEMENT_INDEX = Integer.MAX_VALUE

Protected Member Functions

void syncAhead (int need)
LB (int k)

Protected Attributes

int currentElementIndex = 0
prevElement
int lastMarker
int markDepth = 0


Detailed Description

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.

Definition at line 39 of file LookaheadStream.java.


Member Function Documentation

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.reset (  ) 

abstract T org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.nextElement (  )  [pure virtual]

Implement nextElement to supply a stream of elements to this lookahead buffer. Return eof upon end of the stream we're pulling from.

abstract boolean org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.isEOF ( o  )  [pure virtual]

T org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.remove (  ) 

Get and remove first element in queue; override FastQueue.remove(); it's the same, just checks for backtracking.

Reimplemented from org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.

Definition at line 77 of file LookaheadStream.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.consume (  ) 

Make sure we have at least one element to remove, even if EOF

Definition at line 89 of file LookaheadStream.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.syncAhead ( int  need  )  [protected]

Make sure we have 'need' elements from current position p. Last valid p index is data.size()-1. p+need-1 is the data index 'need' elements ahead. If we need 1 element, (p+1-1)==p must be < data.size().

Definition at line 99 of file LookaheadStream.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.fill ( int  n  ) 

add n elements to buffer

Definition at line 105 of file LookaheadStream.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.size (  ) 

Size of entire stream is unknown; we only know buffer size from FastQueue

Reimplemented from org.antlr.runtime.misc.org.antlr.runtime.misc.FastQueue< T >.

Definition at line 114 of file LookaheadStream.java.

T org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.LT ( int  k  ) 

Definition at line 116 of file LookaheadStream.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.index (  ) 

Definition at line 127 of file LookaheadStream.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.mark (  ) 

Definition at line 129 of file LookaheadStream.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.release ( int  marker  ) 

Definition at line 135 of file LookaheadStream.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.rewind ( int  marker  ) 

Definition at line 139 of file LookaheadStream.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.rewind (  ) 

Definition at line 145 of file LookaheadStream.java.

void org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.seek ( int  index  ) 

Seek to a 0-indexed position within data buffer. Can't handle case where you seek beyond end of existing buffer. Normally used to seek backwards in the buffer. Does not force loading of nodes. Doesn't see to absolute position in input stream since this stream is unbuffered. Seeks only into our moving window of elements.

Definition at line 155 of file LookaheadStream.java.

T org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.LB ( int  k  )  [protected]

Definition at line 157 of file LookaheadStream.java.


Member Data Documentation

final int org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.UNINITIALIZED_EOF_ELEMENT_INDEX = Integer.MAX_VALUE [static]

Definition at line 40 of file LookaheadStream.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.currentElementIndex = 0 [protected]

Absolute token index. It's the index of the symbol about to be read via LT(1). Goes from 0 to numtokens.

Definition at line 45 of file LookaheadStream.java.

T org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.prevElement [protected]

Definition at line 47 of file LookaheadStream.java.

T org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.eof = null

Track object returned by nextElement upon end of stream; Return it later when they ask for LT passed end of input.

Definition at line 52 of file LookaheadStream.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.lastMarker [protected]

Track the last mark() call result value for use in rewind().

Definition at line 55 of file LookaheadStream.java.

int org.antlr.runtime.misc.org.antlr.runtime.misc.LookaheadStream< T >.markDepth = 0 [protected]

tracks how deep mark() calls are nested

Definition at line 58 of file LookaheadStream.java.


The documentation for this class was generated from the following file:

Generated on Tue Jul 19 11:42:08 2011 for ANTLR API by  doxygen 1.5.5