v0.20.6
Patch release for parser recovery correctness, grammargen parity, and the
forest/performance workstream merged after v0.20.5.
Added
- Strict parse variants return
ErrParseStoppedEarlyfor timeout,
cancellation, token-source EOF, and parser safety-limit partial trees while
preserving the returned tree for diagnostics. NodeAtByteandNamedNodeAtBytehelpers onTreeandNodefor editor
offset lookup without hand-written tree walks.- One-pass code-understanding helpers for common definition spans, call
references, heritage edges, and enclosing-definition lookup. - Benchmarks comparing the one-pass code-understanding helpers against the
tags-query path for both parse-plus-inspect and already-parsed trees. grammars.LoadLanguage(name, blob)attaches registered external scanners and
external lex-state tables when loading raw grammar blobs.Language.Size()reports approximate decoded table and lookup-cache bytes for
diagnostics and cache policy decisions.
Fixed
- JavaScript, TypeScript, and TSX automatic-semicolon scanning now preserves
standalone block statements before simple assignments such as{a}b=c,
matching the C parser on minified bundle shapes (#111). - Large Go files with wide table-driven literals now have an opt-in Cobra
regression gate so release validation catches parser stack overflows like the
ParserPool.Parsecrash reported againstcommand_test.goand
completions_test.go(#110). - Recovered result trees now strip self-references and ancestor back-edges
before parent-link wiring, while keepingchildren,fieldIDs, and
fieldSourcesaligned when a cyclic edge is removed (#121). - Go and Go module recovered parses keep the grammar
source_fileroot when
child nodes contain parse errors, matching the root-shape behavior already
used for SQL and Swift (#112). grammargennow treats explicit precedence wrappers around finite string
choices, such asprec.right(choice("=", "+=", "-=")), as reducible
nonterminals instead of overlapping named lexer tokens. This restores wrapper
nodes and lets LR precedence resolve the intended conflict (#122).- Swift functions that iterate a
for…inloop over a range (0..<n,0...n)
or a call expression (stride(from:to:by:)) no longer silently collapse to
_modifierless_function_declaration_no_bodywith the loop body spilled out as
file-level siblings. As with theif/whilecase, the loop body brace was
being consumed as a trailing closure of the iterable; recovery now re-parses
the affectedfor…inheaders with synthetic parentheses around the iterable
and maps the result back to byte-faithful original coordinates. Because this
misparse produced noERRORnode, the recovery pass now runs whenever the
detection walk finds a collapsed header rather than only on errored trees
(#123).
Testing
- Added
TestGoCobraLargeFileParseRegression, gated by
GTS_COBRA_REGRESSION_ROOT, for exact large-file release validation without
making normal test runs network- or corpus-dependent.