parseWithOptions method
TreeSitterTree?
parseWithOptions(
- String source,
- TreeSitterParseOptions options, {
- TreeSitterTree? oldTree,
- Iterable<
TreeSitterInputEdit> edits = const [], - bool annotateLocals = true,
Native nullable parse-with-options contract. Returning true from the callback halts this parse and returns null.
Implementation
TreeSitterTree? parseWithOptions(
String source,
TreeSitterParseOptions options, {
TreeSitterTree? oldTree,
Iterable<TreeSitterInputEdit> edits = const [],
bool annotateLocals = true,
}) {
final hooks = TreeSitterParserRuntimeHooks(
cancellationToken: _cancellationToken,
timeout: _timeout,
logger: _logger,
debugGraphSink: _debugGraphSink,
parseOptions: options,
internalTrace: runtimeHooks?.internalTrace,
);
try {
final result = _parseSource(
source,
Uint8List.fromList(utf8.encode(source)),
oldTree: oldTree,
edits: edits,
annotateLocals: annotateLocals,
runtimeHooksOverride: hooks,
);
_hasOutstandingParse = false;
return result;
} on GeneratedTreeSitterParseHalted {
_hasOutstandingParse = true;
return null;
}
}