parseUtf8Input method
GeneratedTreeSitterTree
parseUtf8Input(
- TreeSitterNativeInput input, {
- GeneratedTreeSitterTree? oldTree,
- Iterable<
TreeSitterInputEdit> edits = const [], - List<
TreeSitterTableRange> includedRanges = const [], - TreeSitterParserRuntimeHooks? runtimeHooks,
Parses native callback-backed UTF-8 input without collecting it first.
The active generated lexer requests another chunk only when its current lookahead reaches the end of the cached bytes. A progress halt preserves the parser session and the consumed prefix; a subsequent call installs the new native input callback and resumes that same session.
Implementation
GeneratedTreeSitterTree parseUtf8Input(
TreeSitterNativeInput input, {
GeneratedTreeSitterTree? oldTree,
Iterable<TreeSitterInputEdit> edits = const [],
List<TreeSitterTableRange> includedRanges = const [],
TreeSitterParserRuntimeHooks? runtimeHooks,
}) {
final resuming = _activeParseSession != null;
_runtimeHooks = runtimeHooks;
_parseClock = runtimeHooks != null && runtimeHooks.timeout > Duration.zero
? (Stopwatch()..start())
: null;
_progressOperationCount = 0;
_activeIncludedRanges = includedRanges;
if (!resuming) {
_initializeNewParse(oldTree, edits, includedRanges);
_activeBytes = <int>[];
}
_activeStreamingInput = input;
_activeStreamingInputEnded = false;
var halted = false;
try {
return _parseWithRecovery('', null, streaming: true);
} on GeneratedTreeSitterParseHalted {
halted = true;
rethrow;
} finally {
if (!halted) reset();
_runtimeHooks = null;
_parseClock = null;
}
}