Constructor for the Caret class.
The contents of the file.
Stores whether the end of the file has been reached or not.
The column in the string the caret is currently at.
The string that is currently being read.
The line on the string the caret is currently at.
The position on the string the caret is currently at.
Gets the character at the caret.
The current character.
Reads the next number from the caret position, until a non-numeric char appears. Supports numbers in the scientific notation format (e.g. 1E+10). Caret automatically [[skips to next content|skipToContent
]] afterwards.
The read number, or NaN
if the caret isn't immmediately before a number.
Advances the caret until a certain character is reached. Places the caret at the left of such char.
The searched-for character.
The read substring.
Reads the next word from the caret position until a whitespace, newline or hash appears. Caret automatically [[skips to next content|skipToContent
]] afterwards.
The read word.
Increments the caret until a certain character is reached. Caret ends up before the character.
var C = new Caret("The quick brown fox jumps over the lazy dog.");
C.skipToChar('q');
//The |quick brown fox jumps over the lazy dog.
//4
console.log(C.pos);
A character to search for.
Increments the caret but skips whitespaces, new lines, and comments. Leaves the caret at the beginning of the next "content".
Increments the caret until a certain string is read. The caret ends up after the string.
var C = new Caret("The quick brown fox jumps over the lazy dog.");
C.skipToString("fox");
//The quick brown fox| jumps over the lazy dog.
//19
console.log(C.pos);
A string to search for.
Increments the caret until one in a list of strings is read. The caret ends up after the string.
var C = new Caret("The quick brown fox jumps over the lazy dog.");
C.skipToStringList(["quick", "lazy"]);
//The quick| brown fox jumps over the lazy dog.
//9
console.log(C.pos);
The list of strings to search for.
The index of the first found string.
Throws an error corresponding to the error code. Automatically inserts the line and column numbers into the error message.
The error code.
Whether the error is the user's or the developer's fault.
Generated using TypeDoc, the 1/31/2021 at 6:18:55 AM
Represents a caret, which reads sequentially through a string.