OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
antlr::CharBuffer Class Reference

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

#include <CharBuffer.hpp>

+ Inheritance diagram for antlr::CharBuffer:

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
 

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 consume(), but deferred until needed by LA or LT.

See also
antlr.CharQueue

Definition at line 35 of file CharBuffer.hpp.

Constructor & Destructor Documentation

◆ CharBuffer()

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.

Member Function Documentation

◆ getChar()

int antlr::CharBuffer::getChar ( void )
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.


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