Skip to content

fix(tools): resume Rust scanning after ordinary strings - #960

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
hiyouwhatsapp:fix/934-rust-string-scanner
Oct 19, 2026
Merged

LunaStev merged 1 commit into
wavefnd:masterfrom
hiyouwhatsapp:fix/934-rust-string-scanner

Conversation

@hiyouwhatsapp

Copy link
Copy Markdown
Contributor

Fixes #934.

The scanner represents active ordinary strings with True and inactive strings with None. Closing an ordinary or byte string previously assigned False, which still satisfied state["string"] is not None. All following source was masked as string content, causing function-spacing detection to miss actual functions.

This switches the closing state to None, matching the existing raw-string close behavior.

Regression coverage

Added Python tests verifying:

  • real code after ordinary and byte strings on the same and following lines, including escaped quotes;
  • function-range recognition after an ordinary string;
  • mixed ordinary, byte, raw and raw-byte strings with braces inside literals;
  • insertion of the missing function separator, without changing literals, and formatting idempotence.

Verification

  • Reproduced 3 failing focused cases against a locally transcribed copy of the relevant production functions and 3 passes after the fix.
  • Reviewed the committed two-file diff and checked trailing whitespace.
  • The full repository python3 -m unittest tools.test_format_rust suite could not be run locally because GitHub file checkout is unavailable in this environment; CI should run it.

Restore the inactive string state when an ordinary or byte string closes.
Add regression coverage for same-line code, later function boundaries,
escaped quotes, mixed raw/byte literals, and spacing idempotence.

Fixes wavefnd#934

Signed-off-by: hiyouwhatsapp <[email protected]>

@LunaStev LunaStev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed the scanner state fix and focused regression coverage for ordinary, byte, raw, and mixed strings. CI passes.

@LunaStev
LunaStev merged commit 2b9420d into wavefnd:master Oct 19, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resume Rust syntax scanning after ordinary string literals

2 participants