An array of ranges that will be included in parsing
Get the parser's current language
Get the duration in microseconds that parsing is allowed to take.
This timeout can be set via Parser.setTimeoutMicros.
The parsing timeout in microseconds
Parse UTF8 text into a syntax tree.
The text to parse, either as a string or a custom input function that provides text chunks. If providing a function, it should return text chunks based on byte index and position.
OptionaloldTree: TreeAn optional previous syntax tree from the same document. If provided and the document has changed, you must first edit this tree using Parser.Tree.edit to match the new text.
Optionaloptions: OptionsOptional parsing settings:
A syntax tree representing the parsed text
Set the destination to which the parser should write debugging graphs during parsing.
The graphs are formatted in the DOT language. You may want to pipe these graphs directly to a 'dot' process to generate SVG output.
Optionalenabled: booleanWhether to enable or disable graph output
Optionalfd: numberOptional file descriptor for the output
Instruct the parser to start the next parse from the beginning.
If the parser previously failed, it will resume where it left off on the next parse by default. Call this method if you want to parse a different document instead of resuming.
Set the language that the parser should use for parsing.
The language must be compatible with the version of tree-sitter being used. A version mismatch will prevent the language from being assigned successfully.
Optionallanguage: LanguageThe language to use for parsing
Set the logging callback that the parser should use during parsing.
OptionallogFunc: string | false | LoggerThe logging callback to use, or null/false to disable logging
Get the ranges of text that the parser will include when parsing.