OpenMD 3.1
Molecular Dynamics in the Open
|
A Stream of characters fed to the lexer from a InputStream that can be rewound via mark()/rewind() methods. More...
#include <CharBuffer.hpp>
Public Member Functions | |
CharBuffer (std ::istream &input) | |
Create a character buffer. | |
int | getChar () |
Get the next character from the stream. | |
Public Member Functions inherited from antlr::InputBuffer | |
InputBuffer () | |
Create a character buffer. | |
virtual void | reset (void) |
Reset the input buffer to empty state. | |
void | commit (void) |
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. | |
virtual void | consume () |
Mark another character for deferred consumption. | |
virtual void | fill (unsigned int amount) |
Ensure that the character buffer is sufficiently full. | |
virtual int | LA (unsigned int i) |
Get a lookahead character. | |
virtual unsigned int | mark () |
Return an integer marker that can be used to rewind the buffer to its current state. | |
virtual bool | isMarked () const |
Are there any marks active in the InputBuffer. | |
virtual void | rewind (unsigned int mark) |
Rewind the character buffer to a marker. | |
virtual unsigned int | entries () const |
Get the number of non-consumed characters. | |
std::string | getLAChars () const |
get the current lookahead characters as a string | |
std::string | getMarkedChars () const |
get the current marked characters as a string | |
Additional Inherited Members | |
Protected Member Functions inherited from antlr::InputBuffer | |
void | syncConsume () |
Sync up deferred consumption. | |
Protected Attributes inherited from antlr::InputBuffer | |
unsigned int | nMarkers |
unsigned int | markerOffset |
unsigned int | numToConsume |
CircularQueue< int > | 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 consume(), but deferred until needed by LA or LT.
Definition at line 35 of file CharBuffer.hpp.
antlr::CharBuffer::CharBuffer | ( | std ::istream & | input_ | ) |
Create a character buffer.
Enable fail and bad exceptions, if supported by platform.
Definition at line 30 of file CharBuffer.cpp.
|
virtual |
Get the next character from the stream.
May throw CharStreamIOException when something bad happens (not EOF) (if supported by platform).
Implements antlr::InputBuffer.
Definition at line 40 of file CharBuffer.cpp.