Fragment mode and define continuation: the three .svh shapes that did not parse, and the define that was blamed on its class body
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]>
This commit is contained in:
1 parent
cbb80e884f
commit
4e62a14af6
23 files changed
+2786
-42
No files matched your search
@@ -162,6 +162,20 @@ corpus's presence.
|
||||
declared in an included file are found because the *file* is in the
|
||||
index, not because it was included; a header outside the filelist stays
|
||||
invisible.
|
||||
**Amendment, 2026-09-02 (`docs/features/fragment-mode/README.md`, TODO
|
||||
§22):** the files this bites hardest now at least *parse*. A `.svh` or
|
||||
`.sv` that is a bare statement list, enum-member list or covergroup-item
|
||||
list — riscv-dv's `riscv_custom_instr_enum.sv` is the canonical one —
|
||||
is read as a **fragment**, so it formats, binds, lints and hovers on its
|
||||
own terms instead of being one error node. What is still missing is
|
||||
exactly what this item names: the **reverse** map, who `` `include``s
|
||||
this fragment. Without it a fragment exports nothing to the workspace
|
||||
index (`is_unit` is unchanged, `FACTS_FORMAT` stays 12), so
|
||||
`CUSTOM_1` is an `EnumVariant` inside its own file and unreachable from
|
||||
`riscv_instr_pkg`, which is where it actually lands. That is the right
|
||||
answer until the reverse map exists — inventing
|
||||
`riscv_custom_instr_enum::CUSTOM_1` would be a name that does not
|
||||
exist — and it is the first thing the reverse map would unlock.
|
||||
- [ ] **Not done, deliberately:** no completion of include paths, and no
|
||||
diagnostic for an include that resolves to nothing. Both are their own
|
||||
features, and the second one needs lucisv to be sure it knows every
|
||||
|
||||
Reference in new issue
Block a user