BGC Tools
|
Represents a text scanner that reads one character at a time. More...
Public Member Functions | |
TextScanner (TextReader reader) | |
Initializes a new instance of TextScanner. More... | |
char | Peek () |
Reads the next character in the stream without changing the current position. More... | |
char | Read () |
Reads the next character in the stream, advancing the text position. More... | |
void | SkipWhitespace () |
Advances the scanner to next non-whitespace character. More... | |
void | Assert (char next) |
Verifies that the given character matches the next character in the stream. If the characters do not match, an exception will be thrown. More... | |
void | Assert (string next) |
Verifies that the given string matches the next characters in the stream. If the strings do not match, an exception will be thrown. More... | |
Data Fields | |
TextPosition | Position => position |
The position of the scanner within the text. More... | |
bool | CanRead => reader.Peek() != -1 |
Indicates whether there are still characters to be read. More... | |
Private Attributes | |
TextReader | reader |
TextPosition | position |
Represents a text scanner that reads one character at a time.
Definition at line 12 of file TextScanner.cs.
|
inline |
Initializes a new instance of TextScanner.
reader | The TextReader to read the text. |
Definition at line 27 of file TextScanner.cs.
|
inline |
Verifies that the given character matches the next character in the stream. If the characters do not match, an exception will be thrown.
next | The expected character. |
Definition at line 105 of file TextScanner.cs.
|
inline |
Verifies that the given string matches the next characters in the stream. If the strings do not match, an exception will be thrown.
next | The expected string. |
Definition at line 125 of file TextScanner.cs.
References LightJson.Serialization.JsonParseException.Type.
|
inline |
Reads the next character in the stream without changing the current position.
Definition at line 40 of file TextScanner.cs.
|
inline |
Reads the next character in the stream, advancing the text position.
Definition at line 57 of file TextScanner.cs.
References LightJson.Serialization.TextPosition.column, and LightJson.Serialization.TextPosition.line.
|
inline |
Advances the scanner to next non-whitespace character.
Definition at line 92 of file TextScanner.cs.
bool LightJson.Serialization.TextScanner.CanRead => reader.Peek() != -1 |
Indicates whether there are still characters to be read.
Definition at line 21 of file TextScanner.cs.
|
private |
Definition at line 15 of file TextScanner.cs.
TextPosition LightJson.Serialization.TextScanner.Position => position |
The position of the scanner within the text.
Definition at line 18 of file TextScanner.cs.
|
private |
Definition at line 14 of file TextScanner.cs.