Doxygen
|
This class describes a character stream that maintains line and column number positions of the characters. More...
#include <vhdlparser/CharStream.h>
Public Member Functions | |
void | setTabSize (int i) |
int | getTabSize (int i) |
virtual int | getColumn () |
virtual int | getLine () |
virtual int | getEndColumn () |
virtual int | getEndLine () |
virtual int | getBeginColumn () |
virtual int | getBeginLine () |
virtual bool | getTrackLineColumn () |
virtual void | setTrackLineColumn (bool val) |
virtual void | backup (int amount) |
Backs up the input stream by amount steps. | |
virtual JJChar | BeginToken () |
Returns the next character that marks the beginning of the next token. | |
virtual JJChar | readChar () |
Returns the next character from the selected input. | |
virtual void | ExpandBuff (bool wrapAround) |
virtual void | FillBuff () |
virtual JJString | GetImage () |
Returns a string made up of characters from the marked token beginning to the current buffer position. | |
virtual JJString | GetSuffix (int len) |
Returns an array of characters that make up the suffix of length 'len' for the currently matched token. | |
virtual void | DeleteBuffers () |
The lexer calls this function to indicate that it is done with the stream and hence implementations can free any resources held by this class. | |
virtual | ~CharStream () |
bool | endOfInput () |
CharStream (const JJChar *buf, int sz, int startline, int startcolumn, int buffersize) | |
CharStream (const JJChar *buf, int sz, int startline, int startcolumn) | |
CharStream (const JJString &str, int startline, int startcolumn, int buffersize) | |
CharStream (const JJString &str, int startline, int startcolumn) | |
CharStream (ReaderStream *input_stream, int startline, int startcolumn, int buffersize) | |
CharStream (ReaderStream *input_stream, int startline, int startcolumn) | |
CharStream (ReaderStream *input_stream) | |
virtual void | ReInit (ReaderStream *input_stream, int startline, int startcolumn, int buffersize) |
virtual void | ReInit (ReaderStream *input_stream, int startline, int startcolumn) |
virtual void | ReInit (ReaderStream *input_stream) |
virtual void | ReInit (const JJString &str, int startline, int startcolumn, int buffersize) |
virtual void | ReInit (const JJString &str, int startline, int startcolumn) |
virtual void | adjustBeginLineColumn (int newLine, int newCol) |
Protected Member Functions | |
virtual void | UpdateLineColumn (JJChar c) |
Protected Attributes | |
int * | bufline |
int * | bufcolumn |
JJChar * | buffer |
int | bufpos |
int | bufsize |
int | tokenBegin |
int | column |
int | line |
bool | prevCharIsCR |
bool | prevCharIsLF |
int | available |
int | maxNextCharInd |
int | inBuf |
int | tabSize |
bool | trackLineColumn |
ReaderStream * | inputStream |
bool | deleteStream |
Private Member Functions | |
int | getBufcolumn (int pos) |
int | getBufline (int pos) |
This class describes a character stream that maintains line and column number positions of the characters.
It also has the capability to backup the stream to some extent. An implementation of this class is used in the TokenManager implementation generated by JavaCCParser.
All the methods except backup can be implemented in any fashion. backup needs to be implemented correctly for the correct operation of the lexer. Rest of the methods are all used to get information like line number, column number and the string that constitutes a token and are not used by the lexer. Hence their implementation won't affect the generated lexer's operation.
Definition at line 31 of file CharStream.h.
|
inlinevirtual |
Definition at line 155 of file CharStream.h.
References DeleteBuffers(), deleteStream, and inputStream.
|
inline |
Definition at line 166 of file CharStream.h.
References available, bufcolumn, buffer, bufline, bufpos, bufsize, column, deleteStream, inBuf, inputStream, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, ReInit(), tabSize, tokenBegin, and trackLineColumn.
|
inline |
Definition at line 175 of file CharStream.h.
References available, bufcolumn, buffer, bufline, bufpos, bufsize, column, deleteStream, inBuf, INITIAL_BUFFER_SIZE, inputStream, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, ReInit(), tabSize, tokenBegin, and trackLineColumn.
|
inline |
Definition at line 183 of file CharStream.h.
References available, bufcolumn, buffer, bufline, bufpos, bufsize, column, deleteStream, inBuf, inputStream, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, ReInit(), tabSize, tokenBegin, and trackLineColumn.
|
inline |
Definition at line 192 of file CharStream.h.
References available, bufcolumn, buffer, bufline, bufpos, bufsize, column, deleteStream, inBuf, INITIAL_BUFFER_SIZE, inputStream, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, ReInit(), tabSize, tokenBegin, and trackLineColumn.
|
inline |
Definition at line 200 of file CharStream.h.
References available, bufcolumn, buffer, bufline, bufpos, bufsize, column, deleteStream, inBuf, inputStream, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, ReInit(), tabSize, tokenBegin, and trackLineColumn.
|
inline |
Definition at line 209 of file CharStream.h.
References available, bufcolumn, buffer, bufline, bufpos, bufsize, column, deleteStream, inBuf, INITIAL_BUFFER_SIZE, inputStream, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, ReInit(), tabSize, tokenBegin, and trackLineColumn.
|
inline |
Definition at line 217 of file CharStream.h.
References available, bufcolumn, buffer, bufline, bufpos, bufsize, column, deleteStream, inBuf, INITIAL_BUFFER_SIZE, inputStream, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, ReInit(), tabSize, tokenBegin, and trackLineColumn.
|
virtual |
References newLine().
|
inlinevirtual |
Backs up the input stream by amount steps.
Lexer calls this method if it had already read some characters, but could not use them to match a (longer) token. So, they will be used again as the prefix of the next token and it is the implementation's responsibility to do this right.
Definition at line 69 of file CharStream.h.
|
inlinevirtual |
Returns the next character that marks the beginning of the next token.
All characters must remain in the buffer between two successive calls to this method to implement backup correctly.
Definition at line 82 of file CharStream.h.
References bufpos, readChar(), and tokenBegin.
|
virtual |
The lexer calls this function to indicate that it is done with the stream and hence implementations can free any resources held by this class.
Referenced by ~CharStream().
|
inline |
Definition at line 162 of file CharStream.h.
References bufpos, inBuf, inputStream, and maxNextCharInd.
|
virtual |
|
virtual |
Referenced by readChar().
|
inlinevirtual |
|
inlinevirtual |
|
inlineprivate |
Definition at line 37 of file CharStream.h.
References bufcolumn, and trackLineColumn.
Referenced by getBeginColumn(), getColumn(), and getEndColumn().
|
inlineprivate |
Definition at line 44 of file CharStream.h.
References bufline, and trackLineColumn.
Referenced by getBeginLine(), getEndLine(), and getLine().
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Returns a string made up of characters from the marked token beginning to the current buffer position.
Implementations can return anything that they want to. For example, for efficiency, one might decide to just return NULL, which is a valid implementation.
Definition at line 129 of file CharStream.h.
References buffer, bufpos, bufsize, and tokenBegin.
|
inlinevirtual |
|
inlinevirtual |
Returns an array of characters that make up the suffix of length 'len' for the currently matched token.
This is used to build up the matched string for use in actions in the case of MORE. A simple and inefficient implementation of this is as follows :
Definition at line 142 of file CharStream.h.
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Returns the next character from the selected input.
The method of selecting the input is the responsibility of the class implementing this class.
Definition at line 95 of file CharStream.h.
References buffer, bufpos, bufsize, FillBuff(), inBuf, maxNextCharInd, trackLineColumn, and UpdateLineColumn().
Referenced by BeginToken().
|
inlinevirtual |
Definition at line 238 of file CharStream.h.
References INITIAL_BUFFER_SIZE, and ReInit().
|
virtual |
|
inlinevirtual |
Definition at line 231 of file CharStream.h.
References INITIAL_BUFFER_SIZE, and ReInit().
|
inlinevirtual |
Definition at line 227 of file CharStream.h.
References INITIAL_BUFFER_SIZE, and ReInit().
|
virtual |
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), ReInit(), ReInit(), and ReInit().
|
inline |
|
inlinevirtual |
Definition at line 61 of file CharStream.h.
References trackLineColumn.
|
protectedvirtual |
Referenced by readChar().
|
protected |
Definition at line 258 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and CharStream().
|
protected |
Definition at line 249 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and getBufcolumn().
|
protected |
Definition at line 250 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), GetImage(), GetSuffix(), and readChar().
|
protected |
Definition at line 248 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and getBufline().
|
protected |
Definition at line 251 of file CharStream.h.
Referenced by backup(), BeginToken(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), endOfInput(), getColumn(), getEndColumn(), getEndLine(), GetImage(), getLine(), GetSuffix(), and readChar().
|
protected |
Definition at line 252 of file CharStream.h.
Referenced by backup(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), GetImage(), GetSuffix(), and readChar().
|
protected |
Definition at line 254 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and CharStream().
|
protected |
Definition at line 264 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and ~CharStream().
|
protected |
Definition at line 260 of file CharStream.h.
Referenced by backup(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), endOfInput(), and readChar().
|
protected |
Definition at line 263 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), endOfInput(), and ~CharStream().
|
protected |
Definition at line 255 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and CharStream().
|
protected |
Definition at line 259 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), endOfInput(), and readChar().
|
protected |
Definition at line 256 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and CharStream().
|
protected |
Definition at line 257 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), and CharStream().
|
protected |
Definition at line 261 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), getTabSize(), and setTabSize().
|
protected |
Definition at line 253 of file CharStream.h.
Referenced by BeginToken(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), getBeginColumn(), getBeginLine(), and GetImage().
|
protected |
Definition at line 262 of file CharStream.h.
Referenced by CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), CharStream(), getBufcolumn(), getBufline(), getTrackLineColumn(), readChar(), and setTrackLineColumn().