From 793a9d4ce7f64c6acdf54680f93b836b69d58ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Thu, 8 Feb 2024 11:24:40 -0800 Subject: [PATCH] normalize literal newlines in multiline strings Fixes: https://github.com/kdl-org/kdl/issues/360 --- CHANGELOG.md | 2 ++ SPEC.md | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d51357b..9f203cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,8 @@ identifiers. * `.1`, `+.1` etc are no longer valid identifiers, to prevent confusion and conflicts with numbers. +* Multi-line strings' literal Newline sequences are now normalized to single + `LF`s. ### KQL diff --git a/SPEC.md b/SPEC.md index 4940da1..a850913 100644 --- a/SPEC.md +++ b/SPEC.md @@ -463,6 +463,18 @@ removed from all other lines. It is a syntax error for any body lines of the multi-line string to not match the whitespace prefix of the last line with the final quote. +#### Newline Normalization + +Literal Newline sequences in Multi-line Strings must be normalized to a single +`U+000A` (`LF`) during deserialization. This means, for example, that `CR LF` +becomes a single `LF` during parsing. + +This normalization does not apply to non-literal Newlines entered using escape +sequences. + +For clarity: this normalization is for individual sequences. That is, the +literal sequence `CRLF CRLF` becomes `LF LF`, not `LF`. + #### Example ```kdl