ANTLR Support Libraries 2.7.1+
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
CharBuffer Class Reference

#include <CharBuffer.hpp>

Inheritance diagram for CharBuffer:
Inheritance graph
[legend]
Collaboration diagram for CharBuffer:
Collaboration graph
[legend]

Public Member Functions

 CharBuffer (std ::istream &input)
 Create a character buffer. More...
 
int getChar ()
 Get the next character from the stream. More...
 
- Public Member Functions inherited from InputBuffer
 InputBuffer ()
 
virtual ~InputBuffer ()
 
virtual void reset (void)
 Reset the input buffer to empty state. More...
 
void commit (void)
 
virtual void consume ()
 
virtual void fill (unsigned int amount)
 
virtual int LA (unsigned int i)
 
virtual unsigned int mark ()
 
virtual bool isMarked () const
 Are there any marks active in the InputBuffer. More...
 
virtual void rewind (unsigned int mark)
 
virtual unsigned int entries () const
 
std ::string getLAChars () const
 
std ::string getMarkedChars () const
 

Protected Attributes

std ::istream & input
 
- Protected Attributes inherited from InputBuffer
unsigned int nMarkers
 
unsigned int markerOffset
 
unsigned int numToConsume
 
CircularQueue< int > queue
 

Private Member Functions

 CharBuffer (const CharBuffer &other)
 
CharBufferoperator= (const CharBuffer &other)
 

Additional Inherited Members

- Protected Member Functions inherited from InputBuffer
void syncConsume ()
 

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

Constructor & Destructor Documentation

◆ CharBuffer() [1/2]

CharBuffer::CharBuffer ( std ::istream &  input_)

Create a character buffer.

Create a character buffer. Enable fail and bad exceptions, if supported by platform.

◆ CharBuffer() [2/2]

CharBuffer::CharBuffer ( const CharBuffer other)
private

Member Function Documentation

◆ getChar()

int CharBuffer::getChar ( void  )
virtual

Get the next character from the stream.

Get the next character from the stream. May throw CharStreamIOException when something bad happens (not EOF) (if supported by platform).

Implements InputBuffer.

◆ operator=()

CharBuffer& CharBuffer::operator= ( const CharBuffer other)
private

Member Data Documentation

◆ input

std ::istream& CharBuffer::input
protected

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