Skip to content

Add Rust-style string continuation escapes - #617

Merged
juntyr merged 1 commit into
ron-rs:masterfrom
thurn:codex/rust-style-backslash-escapes
Aug 14, 2026
Merged

Add Rust-style string continuation escapes#617
juntyr merged 1 commit into
ron-rs:masterfrom
thurn:codex/rust-style-backslash-escapes

Conversation

@thurn

@thurn thurn commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • parse Rust-style string continuation escapes in standard strings and byte strings
  • accept LF and CRLF line endings and strip the same following whitespace as Rust
  • document the grammar change and add it to the changelog

Motivation

RON currently treats a backslash immediately before a newline as an unknown escape. Supporting Rust-style continuations lets multiline string literals follow the surrounding indentation without including that newline and indentation in the deserialized value.

This implements the parser and grammar update requested in #585 (comment).

Impact

Standard string and byte-string literals can now use line continuations. Raw strings, character literals, and serialization output are unchanged.

Validation

  • cargo test --test escape
  • cargo test --all-features --all-targets
  • cargo check --no-default-features
  • cargo fmt --all -- --check
  • I've included my change in CHANGELOG.md

@thurn
thurn force-pushed the codex/rust-style-backslash-escapes branch from 9bc3389 to 0636bf0 Compare August 13, 2026 03:51
@thurn
thurn marked this pull request as ready for review August 13, 2026 03:54
Comment thread docs/grammar.md Outdated
Comment thread CHANGELOG.md Outdated

@juntyr juntyr 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.

Thanks @thurn for your PR! I will merge once you have addressed my two tiny nits.

@thurn
thurn force-pushed the codex/rust-style-backslash-escapes branch from 0636bf0 to 53507cf Compare August 13, 2026 14:10
@juntyr
juntyr merged commit ed3d324 into ron-rs:master Aug 14, 2026
10 checks passed
@thurn
thurn deleted the codex/rust-style-backslash-escapes branch August 15, 2026 16:48
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.

2 participants