antlr::InputBuffer Class Reference
#include <InputBuffer.hpp>
List of all members.
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 |
( |
|
) |
[inline] |
Create a character buffer
virtual antlr::InputBuffer::~InputBuffer |
( |
|
) |
[inline, virtual] |
antlr::InputBuffer::InputBuffer |
( |
const InputBuffer & |
other |
) |
[private] |
Member Function Documentation
void antlr::InputBuffer::commit |
( |
void |
|
) |
[inline] |
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.
virtual void antlr::InputBuffer::consume |
( |
|
) |
[inline, virtual] |
Mark another character for deferred consumption
unsigned int antlr::InputBuffer::entries |
( |
|
) |
const [virtual] |
Get the number of non-consumed characters
void antlr::InputBuffer::fill |
( |
unsigned int |
amount |
) |
[virtual] |
Ensure that the character buffer is sufficiently full
virtual int antlr::InputBuffer::getChar |
( |
|
) |
[pure virtual] |
Override this in subclasses to get the next character
std::string antlr::InputBuffer::getLAChars |
( |
void |
|
) |
const |
get the current lookahead characters as a string
- Warning:
- it may treat 0 and EOF values wrong
std::string antlr::InputBuffer::getMarkedChars |
( |
void |
|
) |
const |
get the current marked characters as a string
- Warning:
- it may treat 0 and EOF values wrong
virtual bool antlr::InputBuffer::isMarked |
( |
|
) |
const [inline, virtual] |
virtual int antlr::InputBuffer::LA |
( |
unsigned int |
i |
) |
[inline, virtual] |
Get a lookahead character
unsigned int antlr::InputBuffer::mark |
( |
|
) |
[virtual] |
Return an integer marker that can be used to rewind the buffer to its current state.
virtual void antlr::InputBuffer::reset |
( |
void |
|
) |
[inline, virtual] |
Reset the input buffer to empty state.
void antlr::InputBuffer::rewind |
( |
unsigned int |
mark |
) |
[virtual] |
Rewind the character buffer to a marker.
- Parameters:
-
| mark | Marker returned previously from mark() |
void antlr::InputBuffer::syncConsume |
( |
|
) |
[inline, protected] |
Sync up deferred consumption
Member Data Documentation
The documentation for this class was generated from the following files: