The string to read.
The string to read.
The current cursor.
This should always be between the range 0 and data.length
Returns the length of data.
Returns the character at the current position without advancing the cursor.
Note:
This method has no bounds checking; if position is greater than or equal to
str.length then NaN will be returned.
Returns the number of characters remaining to be read.
If peek equals the given character code, returns true and advances the index by one.
Throws a StringParseError where the location uses printStringPosition to show a friendly message indicating the current position.
The offset to add to the current position.
Returns true if the current position is less than the source data's length.
Reads and returns the character code at the current position. To read the next character without advancing the cursor, use peek
Note:
This method has no bounds checking; if position is greater than or equal to
str.length then NaN will be returned and position will still be incremented.
Reads the expected string from the current position. If the read string doesn't match the given string, a StringParseError is thrown.
The string required to match at the current position.
If true, the comparison will be case-insensitive.
Reads the expected char code from the current position. If the read character doesn't match the given character, a StringParseError is thrown.
The character code required to match at the current position.
If the given string matches the substring at the current position, returns true and advances the index by the string's length.
Reads the substring from the current index with the given length.
The same as until except returns the read substring as a result.
The same as untilChar except returns the read substring as a result.
The same as while except returns the read substring as a result.
Reads characters until the predicate returns true or the string length has been reached.
number Returns the start index.
Reads characters until the given character has been found or the string length has been reached.
number Returns the start index.
Reads characters until the given string has been found or the string length has been reached.
The string to match
number Returns the start index.
Reads characters until the predicate returns false or the data length has been reached.
Given the char code at the cursor index, returns true if the character should be included in the substring result.
number The start position.
Reads through all whitespace characters, returning the starting index.
A cursor on a string that allows for fast, naive parsing.