Skip to content

yacc dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7407

Merged
squid-shepherd[bot] merged 3 commits into
mainfrom
churn/7207-20261101T0741Z
Nov 1, 2026
Merged

squid-shepherd[bot] merged 3 commits into
mainfrom
churn/7207-20261101T0741Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #7207 (slice 2: yacc).

What

yacc.py dead_code now uses commented_keyword_statement (same pattern as #7402): a // or /* comment led by if|for|while|return|%token counts only when the rest of the line has a statement's shape. %token declarations have no ;{}/(...), so an extra branch accepts the directive followed by ALL-CAPS token names (optional <type> tag, optional number). // return value is ignored, // if the parse fails and // %token is declared here no longer count.

Test: tests/extraction/languages/test_yacc_dead_code_shape_7207.py (12 positives, 9 prose negatives, a long-line ReDoS check).

Golden drift

Re-blessed with golden-lock.sh crucible_check.py --update --yes on top of main including #7402. One file moves in both fixtures: cobol/gnucobol_internals/parser.y Commented Logic Exposure 4.81% -> 0.0% (its matches were prose); no other language moved.

Class / Sibling gaps

Class: dead_code rules that match a comment marker plus a bare keyword, so English comments match (#7207). This PR covers yacc, whose %token shape needed the extra branch. Sibling gaps: the languages still on a bare-keyword dead_code rule are tracked in #7207's table; this PR does not change them. Other yacc-family rules (bison) share this definition. No new gaps found while here.

Gates

pr_gates --fast 9/9, --ratchets 9 pass / 0 fail / 0 skipped; test_yacc*.py pass.

Remaining slices

Whatever languages remain in the #7207 table after #7402 and this PR; each is one rule file plus a test.

🤖 Generated with Claude Code

@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 1, 2026 09:09
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 1, 2026 09:10
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot merged commit 8a8c3d3 into main Nov 1, 2026
119 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/7207-20261101T0741Z branch November 1, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant