Inherits: IScanner
Description
The StringScanner class is used to scan characters in a string that allows tokenizers to look ahead through a stream to perform lexical analysis.
Constructors
Creates an instance of this class.
publicStringScanner(string content)
- content: string - text content to be read.
Fields
Instance methods
Column
Gets the column in the current line.
publicint Column()
- returns: int - column in the current line in the stream.
Line
Gets the current line number.
publicint Line()
- returns: int - current line number in the stream.
Peek
Returns the character from the top of the stream without moving the stream pointer.
publicchar Peek()
- returns: char - character from the top of the stream or -1 if the stream is empty.
PeekColumn
Gets the next character column number.
publicint PeekColumn()
- returns: int - next character column number in the stream.
PeekLine
Gets the next character line number.
publicint PeekLine()
- returns: int - next character line number in the stream.
Read
Reads a character from the top of the stream.
publicchar Read()
- returns: char - read character or -1 if the stream is processed to the end.
Reset
Resets the scanner to the initial position.
publicvoid Reset()
Unread
Puts one character back into the stream.
publicvoid Unread()
UnreadMany
Pushes the specified number of characters to the top of the stream.
publicvoid UnreadMany(int count)
- count: int - number of characcted to be pushed back.