TODO section 22, coverage_gaps H4 corrected. Class-body and module-item
include fragments already parsed - the file-scope item loop is the
class-item loop. The three shapes that did not - a bare statement list,
an enum-member list (riscv-dv's CUSTOM_1, file, included between enum
members), a covergroup-item list - become SourceFile::fragment, detected
by a whole-file rule that cannot misfire on a valid file: the first
structural item failed (directives, macros and null items do not count;
a tolerant Ok that recorded a diagnostic counts as failed - an existing
parity test caught if/else reading as a generate-if to one parser and a
statement to the other), the file does not open with a design-unit
keyword, and a shape consumes the file to EOF, tried narrowest-first.
Each shape re-lexes a fresh token stream - Rewind does not restore the
tokens' comment buckets and the first draft lost comments on
non-fragment files. A fragment formats at indent zero through the
existing printers; its declarations bind; its enum variants are not
exported (pkg::CUSTOM_1 must not resolve to a name that does not
exist). FACTS stays 12.
The other .svh was never a fragment problem: a define whose formal
argument list spans two lines with no backslash. The lexer continues
such a directive until the list closes - incrementally, after QA found
the first cut quadratic on an unclosed list (20000 lines: 2.5 s ->
0.56 ms), pinned by a byte-visit counter.
Opentitan 12 -> 10 failing files, exactly the two predicted; corpus
813 -> 814 of 820; every remaining comment-gap failure proven to fail
identically outside a fragment.
docs/features/fragment-mode/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
One line scanner feeds three consumers that can never disagree:
documentLink underlines every include path, definition lands on the
resolved file, and hover's define lookup narrows to definitions
reachable through the hovered file's include graph (narrow, never
widen; local defines always win). Resolution is own-directory then the
filelist's +incdir+s in order - M1 recorded them, M10 finally spends
them; angled includes skip the own-directory rung. Resolved paths are
re-spelled the way the index spells them so a case-insensitive
filesystem cannot make hover silently drop a reachable define (QA HIGH,
fixed with a pure lookup that latches to ambiguity on collisions).
Graph build: ~7ms over the 860-file corpus.
Co-Authored-By: Claude Fable 5 <[email protected]>