Declarations
Public Only
struct SourceProvider {
var data_ptr : *char
var data_len : size_t
var data_end : *char
var lineNumber : uint
var lineCharacterNumber : uint
}
provides access to the source code provided by the user
func increment(self : &SourceProvider) : void
* increment a single character forward
func readCharacter(self : &SourceProvider) : char
* reads a single character and returns it
* everytime a character is read, it must check if its the line ending character to track lineNumbers
func readCodePoint(provider : *SourceProvider) : u32
* read a utf8 code point
func utf8_decode_peek(provider : *SourceProvider, out_len : &size_t) : u32
* peek a utf8 code point, get the length
func incrementCodepoint(provider : *SourceProvider, cp : u32, len : size_t) : void
* increment a utf8 code point (that you peeked), giving its length
func eof(self : &SourceProvider) : bool
* checks the stream is at the end
* please also use both peek() == -1
func increment_char(self : &SourceProvider, c : char) : bool
* if char c is present at current pos, increments the stream with character
* @param c character to look for
* @return true if incremented by character length = 1, otherwise false
func getLineNumber(self : &SourceProvider) : uint
* get zero-based current line number
func getLineCharNumber(self : &SourceProvider) : uint
* get zero-based character number
func readWhitespaces(self : &SourceProvider) : uint
* reads whitespaces, returns how many whitespaces were read
func hasNewLine(self : &SourceProvider) : bool
* @return whether there's a newline at current position
func readNewLineChars(self : &SourceProvider) : bool
* @return whether new line characters were read
func readWhitespacesAndNewLines(self : &SourceProvider) : void
* reads all whitespaces along with new lines
func current_data(provider : &SourceProvider) : *char
func peek2(provider : &SourceProvider) : char
returns zero if stream ends before that