Skip to content

fix(isa-utils): escape control characters in quoted strings#3772

Open
pengqima wants to merge 1 commit into
powdr-labs:mainfrom
pengqima:main
Open

fix(isa-utils): escape control characters in quoted strings#3772
pengqima wants to merge 1 commit into
powdr-labs:mainfrom
pengqima:main

Conversation

@pengqima

Copy link
Copy Markdown

Summary

powdr_isa_utils::quote previously escaped backslashes and double quotes, but left control characters such as newlines, carriage returns, and tabs unchanged. That could produce quoted strings containing raw control characters instead of escaped sequences.

This change extends quote to emit escaped forms for common control characters and unicode-style escapes for other control characters. It also adds a regression test for newline, tab, and carriage return escaping.

Testing

  • cargo fmt --check -p powdr-isa-utils
  • git diff --check
  • rustc --edition=2021 --test isa-utils/src/lib.rs and ran quote_escapes_control_characters
  • Verified with a temporary copy of the old implementation that the regression test fails before this change

Signed-off-by: pengqima <pengqima@outlook.com>
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.

1 participant