Public Member Functions | Protected Member Functions | Protected Attributes

antlr.InputBuffer Class Reference

Inheritance diagram for antlr.InputBuffer:
antlr.ByteBuffer antlr.CharBuffer antlr.debug.DebuggingInputBuffer

List of all members.

Public Member Functions

 InputBuffer ()
void commit ()
void consume ()
abstract void fill (int amount) throws CharStreamException
String getLAChars ()
String getMarkedChars ()
boolean isMarked ()
char LA (int i) throws CharStreamException
int mark ()
void rewind (int mark)
void reset ()

Protected Member Functions

void syncConsume ()

Protected Attributes

int nMarkers = 0
int markerOffset = 0
int numToConsume = 0
CharQueue queue

Detailed Description

A Stream of characters fed to the lexer from a InputStream that can be rewound via mark()/rewind() methods.

A dynamic array is used to buffer up all the input characters. Normally, "k" characters are stored in the buffer. More characters may be stored during guess mode (testing syntactic predicate), or when LT(i>k) is referenced. Consumption of characters is deferred. In other words, reading the next character is not done by conume(), but deferred until needed by LA or LT.

See also:
antlr.CharQueue

Constructor & Destructor Documentation

antlr.InputBuffer.InputBuffer (  ) 

Create an input buffer

References antlr.InputBuffer.queue.


Member Function Documentation

void antlr.InputBuffer.commit (  ) 

This method updates the state of the input buffer so that the text matched since the most recent mark() is no longer held by the buffer. So, you either do a mark/rewind for failed predicate or mark/commit to keep on parsing without rewinding the input.

References antlr.InputBuffer.nMarkers.

Referenced by antlr.CharScanner.commit().

void antlr.InputBuffer.consume (  ) 

Mark another character for deferred consumption

Reimplemented in antlr.debug.DebuggingInputBuffer.

References antlr.InputBuffer.numToConsume.

Referenced by antlr.debug.DebuggingInputBuffer.consume(), and antlr.CharScanner.consume().

abstract void antlr.InputBuffer.fill ( int  amount  )  throws CharStreamException [pure virtual]

Ensure that the input buffer is sufficiently full

Implemented in antlr.ByteBuffer, antlr.CharBuffer, and antlr.debug.DebuggingInputBuffer.

Referenced by antlr.debug.DebuggingInputBuffer.fill(), and antlr.InputBuffer.LA().

String antlr.InputBuffer.getMarkedChars (  ) 
boolean antlr.InputBuffer.isMarked (  ) 
int antlr.InputBuffer.mark (  ) 

Return an integer marker that can be used to rewind the buffer to its current state.

Reimplemented in antlr.debug.DebuggingInputBuffer.

References antlr.InputBuffer.markerOffset, antlr.InputBuffer.nMarkers, and antlr.InputBuffer.syncConsume().

Referenced by antlr.debug.DebuggingInputBuffer.mark(), and antlr.CharScanner.mark().

void antlr.InputBuffer.rewind ( int  mark  ) 

Rewind the character buffer to a marker.

Parameters:
mark Marker returned previously from mark()

Reimplemented in antlr.debug.DebuggingInputBuffer.

References antlr.InputBuffer.markerOffset, antlr.InputBuffer.nMarkers, and antlr.InputBuffer.syncConsume().

Referenced by antlr.debug.DebuggingInputBuffer.rewind(), and antlr.CharScanner.rewind().


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties