5 Commits
Author SHA1 Message Date
lucio 3f300fa9e9 Merge testbench-syntax serial round (directive-in-statements + take_gap)
Co-Authored-By: Claude Fable 5 <[email protected]>

# Conflicts:
#	docs/features/formatter-bug-fixes/README.md
2026-08-29 13:38:32 -07:00
lucioandClaude Fable 5 7881cc869c Directives may open inside a statement, and comments keep their owners
Bucket 7: the mirror image of directive-split — an `ifdef opening
INSIDE an assign RHS, expression or instantiation head, where all
three existing directive features trigger on a closing directive and
could not fire. The construct is captured verbatim by two mirror
recoveries sharing one capture step (statement-level first, item-level
behind it), construct_end classifying the head (Semi /
endfunction+label / Unknown -> refuse rather than guess), and
terminated_in_arm honoring both real terminator placements. Both
flagship tb.sv files needed only take_list_directives to stop
harvesting an outer region's `else as a list element. OpenTitan sweep
107 -> 100, exactly the 7 targets (chip_if.sv x2, chip_earlgrey
asic/cw340, jtag_dtm_reg_block, both top_* tb.sv), zero regressions,
corpus per-file byte-identical to baseline.

Also delivers Lane B's Handshake: take_before_open's queue drain was
necessary-but-not-sufficient — CallComments::dangling drained the
same way — both now behind Parser::take_gap (comments kept only when
span.start >= last_end()), verified by composing with Lane B's tree:
keymgr_scoreboard.sv formats, closing the last bucket-2 file.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-29 13:38:02 -07:00
lucioandClaude Fable 5 d3deacf0f6 Three formatter comment bugs fixed where they lived, safety net unwidened
Bucket 2 of syntax_coverage.md: 12 opentitan files parsed but failed
the formatter's own verification. Three shapes: (A) a line comment
trailing 'end' swallowed a cuddled 'else' into the comment — cuddling
now requires no trailing line comment (block comments still cuddle);
(B) a comment inside if/while/repeat/wait/case header parens printed
after the ')' — Fmt::header_parens finds the real ')' and prints the
split comments through the shared paren layout; (C) 'default;' grew an
invented ':' — the optional colon is read from the source byte. 11 of
12 files now format and round-trip (12 -> 1 verification failures on
the sweep); the 12th is a parser bug filed as a specified Handshake
and delivered by the directive round, not edited cross-lane. verify.rs
untouched; four masked-corruption rejection pairs added per the
standing template; QA's ~30-attack sweep found zero corruption and
pinned two informational boundaries. Formatter output changed:
release must bump the workspace version (format-cache rule).

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-29 12:55:51 -07:00
lucio eeaffafd56 Rename the tool to lucisv (Language Utility for Coding In SystemVerilog) 2026-08-25 23:36:00 -07:00
lucioandClaude Fable 5 9f1a6cf1d2 Fix six formatter bugs; case table grows to 200 with zero skips
All five briefed bugs fixed, plus a sixth found during the work:

1. Block-comment continuation drift: token::Comment gained line/col;
   continuation lines are dedented by the comment's original column
   before re-indenting, making reformatting a true fixed point while
   preserving the author's relative indentation inside the comment.
2. Comments inside expression groups (concat, parens, call args,
   assignment patterns, binary operands) now force the group to break
   instead of being lifted out.
3. Closing block labels preserved for end/join*/endfunction/endtask/
   endpackage, matching endmodule.
4. Multi-instance declarations fit on one line when they fit and
   indent their continuations when they break.
5. @( /* c */ * ) keeps its comments (SensList::Star before/after).
6. Multi-line `define/attribute bodies no longer drift (RawText.col).

verify.rs comparison logic untouched (diagnostic positions only) —
QA audited the diff to confirm the safety net was not weakened.
All four #SKIP cases un-skipped verbatim as spec; 17 cases added
(183 -> 200, 0 skipped). QA triple-formatted 204 inputs with zero
regressions. Clippy is now fully silent workspace-wide.

Remaining comment-placement refusals (4) and a pre-existing @(* )
lexer limitation are documented as open items, not hacked around.

Dev: Opus agent; QA: Sonnet agent; review in
docs/features/formatter-bug-fixes/README.md.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-19 00:15:50 -07:00