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 |
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.
antlr.InputBuffer.InputBuffer | ( | ) |
Create an input buffer
References antlr.InputBuffer.queue.
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.getLAChars | ( | ) |
String antlr.InputBuffer.getMarkedChars | ( | ) |
References antlr.CharQueue.elementAt(), antlr.InputBuffer.markerOffset, and antlr.InputBuffer.queue.
boolean antlr.InputBuffer.isMarked | ( | ) |
Reimplemented in antlr.debug.DebuggingInputBuffer.
References antlr.InputBuffer.nMarkers.
Referenced by antlr.debug.DebuggingInputBuffer.isMarked().
char antlr.InputBuffer.LA | ( | int | i | ) | throws CharStreamException |
Get a lookahead character
Reimplemented in antlr.debug.DebuggingInputBuffer.
References antlr.CharQueue.elementAt(), antlr.InputBuffer.fill(), antlr.InputBuffer.markerOffset, and antlr.InputBuffer.queue.
Referenced by antlr.debug.DebuggingInputBuffer.consume(), antlr.CharScanner.consume(), antlr.debug.DebuggingInputBuffer.LA(), and antlr.CharScanner.LA().
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.reset | ( | ) |
Reset the input buffer
References antlr.InputBuffer.markerOffset, antlr.InputBuffer.nMarkers, antlr.InputBuffer.numToConsume, antlr.InputBuffer.queue, and antlr.CharQueue.reset().
Referenced by antlr.LexerSharedInputState.reset().
void antlr.InputBuffer.rewind | ( | int | mark | ) |
Rewind the character buffer to a marker.
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().
void antlr.InputBuffer.syncConsume | ( | ) | [protected] |
Sync up deferred consumption
References antlr.InputBuffer.markerOffset, antlr.InputBuffer.nMarkers, antlr.InputBuffer.numToConsume, antlr.InputBuffer.queue, and antlr.CharQueue.removeFirst().
Referenced by antlr.CharBuffer.fill(), antlr.ByteBuffer.fill(), antlr.InputBuffer.mark(), and antlr.InputBuffer.rewind().
int antlr.InputBuffer.markerOffset = 0 [protected] |
int antlr.InputBuffer.nMarkers = 0 [protected] |
int antlr.InputBuffer.numToConsume = 0 [protected] |
Referenced by antlr.InputBuffer.consume(), antlr.InputBuffer.reset(), and antlr.InputBuffer.syncConsume().
CharQueue antlr.InputBuffer.queue [protected] |