|
Grammatica 1.5 Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
System.Object
|
+--ReaderBuffer
in ReaderBuffer.csA character buffer that automatically reads from an input source stream when needed. This class keeps track of the current position in the buffer and its line and column number in the original input source. It allows unlimited look-ahead of characters in the input, reading and buffering the required data internally. As the position is advanced, the buffer content prior to the current position is subject to removal to make space for reading new content. A few characters before the current position are always kept to enable boundary condition checks.
| Field Summary | |
const int |
BLOCK_SIZE
The stream reading block size. |
int |
ColumnNumber
The current column number property (read-only). |
int |
Length
The current character buffer length property (read-only). |
int |
LineNumber
The current line number property (read-only). |
int |
Position
The current buffer position property (read-only). |
| Constructor Summary | |
ReaderBuffer( TextReader input )
Creates a new tokenizer character buffer. |
|
| Method Summary | |
void |
Dispose()
Discards all resources used by this buffer. |
int |
Peek( int offset )
Returns a character relative to the current position. |
string |
Read( int offset )
Reads the specified number of characters from the current position. |
string |
Substring( int index, int length )
Returns a substring already in the buffer. |
override string |
ToString()
Returns the current content of the buffer as a string. |
| Field Detail |
public const int BLOCK_SIZE;
public int ColumnNumber;
public int Length;
public int LineNumber;
public int Position;
| Constructor Detail |
public ReaderBuffer( TextReader input );
input - the input source character reader| Method Detail |
public void Dispose();
public int Peek( int offset );
The character offset must be positive, but is allowed to span the entire size of the input source stream. Note that the internal buffer must hold all the intermediate characters, which may be wasteful if the offset is too large.
offset - the character offset, from 0 and upIOException - if an I/O error occurredpublic string Read( int offset );
offset - the character offset, from 0 and upIOException - if an I/O error occurredpublic string Substring( int index, int length );
index - the start index, inclusive
length - the substring lengthIndexOutOfBoundsException - if one of the indices were
negative or not less than (or equal) than length()public override string ToString();
|
Grammatica 1.5 Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||