Treats a string of characters as a stream. This allows it to be read one character at a time. Attempting to read after the end of the stream will generate a Wrench.StringReader.NULL character.
|
| | StringReader (string str) |
| | Creates a new reader for the given string. More...
|
| |
| bool | More () |
| | Checks if there is anything left to read. More...
|
| |
| char | Peek () |
| | Takes a peek at the next character in the stream without reading it. More...
|
| |
| char | Peek (int delta) |
| | Takes a peek at the character that is a number of characters away from the next one without actually reading it. Peek(0) is the next character, Peek(1) is the one after that etc. More...
|
| |
| void | StepBack () |
| | Steps back one place in the stream. More...
|
| |
| void | Advance () |
| | Steps forward one place in the stream. More...
|
| |
| int | Length () |
| | The length of the string. More...
|
| |
| virtual char | Read () |
| | Reads a character from the stream and advances the stream one place. More...
|
| |
| void | ReadUntil (char character) |
| | Keeps reading the given character from the stream until it's no longer next. Used for e.g. stripping an unknown length block of whitespaces in the stream. More...
|
| |
| void | ReadOff (char[] chars) |
| | Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines (
or ) from this stream. More...
|
| |
| void | ReadOff (char[] chars, out int count) |
| | Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines (
or ) from this stream. More...
|
| |
| int | GetLineNumber () |
| | Gets the line number that the pointer is currently at. More...
|
| |
| int | GetLineNumber (out int charOnLine) |
| | Gets the line number and character number that the pointer is currently at. More...
|
| |
| string | ReadLine (int lineNumber) |
| | Reads the numbered line from this stream. More...
|
| |
|
| char[] | Chars |
| | The internal buffer of characters from the original string. More...
|
| |
| int | Position |
| | The current position this reader is at in the string. More...
|
| |
|
| static char | NULL ='\0' |
| | The null character. This is returned when operations are working beyond the end of the stream. More...
|
| |
| Wrench.StringReader.StringReader |
( |
string |
str) | |
|
|
inline |
Creates a new reader for the given string.
- Parameters
-
| str | The string to treat as a stream of characters. |
| void Wrench.StringReader.Advance |
( |
) | |
|
|
inline |
Steps forward one place in the stream.
| int Wrench.StringReader.GetLineNumber |
( |
) | |
|
|
inline |
Gets the line number that the pointer is currently at.
- Returns
- The current line number, starting from 1.
| int Wrench.StringReader.GetLineNumber |
( |
out int |
charOnLine) | |
|
|
inline |
Gets the line number and character number that the pointer is currently at.
- Parameters
-
| charOnLine | The column/ character number the reader is at on this line. |
- Returns
- The current line number, starting from 1.
| int Wrench.StringReader.Length |
( |
) | |
|
|
inline |
The length of the string.
| bool Wrench.StringReader.More |
( |
) | |
|
|
inline |
Checks if there is anything left to read.
- Returns
- True if there is more content to read.
| char Wrench.StringReader.Peek |
( |
) | |
|
|
inline |
Takes a peek at the next character in the stream without reading it.
| char Wrench.StringReader.Peek |
( |
int |
delta) | |
|
|
inline |
Takes a peek at the character that is a number of characters away from the next one without actually reading it. Peek(0) is the next character, Peek(1) is the one after that etc.
| virtual char Wrench.StringReader.Read |
( |
) | |
|
|
inlinevirtual |
Reads a character from the stream and advances the stream one place.
Reimplemented in Wrench.CodeLexer.
| string Wrench.StringReader.ReadLine |
( |
int |
lineNumber) | |
|
|
inline |
Reads the numbered line from this stream.
- Parameters
-
| lineNumber | The number of the line to read. |
- Returns
- The numbered line as a string.
| void Wrench.StringReader.ReadOff |
( |
char[] |
chars) | |
|
|
inline |
Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines (
or ) from this stream.
- Parameters
-
| chars | The set of characters to read off. |
| void Wrench.StringReader.ReadOff |
( |
char[] |
chars, |
|
|
out int |
count |
|
) |
| |
|
inline |
Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines (
or ) from this stream.
- Parameters
-
| chars | The set of characters to read off. |
| count | The number of characters that were read from the stream. |
| void Wrench.StringReader.ReadUntil |
( |
char |
character) | |
|
|
inline |
Keeps reading the given character from the stream until it's no longer next. Used for e.g. stripping an unknown length block of whitespaces in the stream.
- Parameters
-
| character | The character to read off from this stream. |
| void Wrench.StringReader.StepBack |
( |
) | |
|
|
inline |
Steps back one place in the stream.
| char [] Wrench.StringReader.Chars |
The internal buffer of characters from the original string.
| char Wrench.StringReader.NULL ='\0' |
|
static |
The null character. This is returned when operations are working beyond the end of the stream.
| int Wrench.StringReader.Position |
The current position this reader is at in the string.