reword interaction multiline + whitespace escape

This commit is contained in:
Bram Gotink 2024-12-16 19:41:59 +01:00
parent 813a44b6f8
commit 18ce0e6726
No known key found for this signature in database
1 changed files with 9 additions and 5 deletions

14
SPEC.md
View File

@ -423,7 +423,6 @@ such) are retained. For example, these strings are all semantically identical:
Except as described in the escapes table, above, `\` *MUST NOT* precede any Except as described in the escapes table, above, `\` *MUST NOT* precede any
other characters in a string. other characters in a string.
### Multi-line String ### Multi-line String
Multi-Line Strings support multiple lines with literal, non-escaped Multi-Line Strings support multiple lines with literal, non-escaped
@ -582,18 +581,23 @@ Strings.
When processing a Multi-line String, implementations MUST dedent the string When processing a Multi-line String, implementations MUST dedent the string
_after_ resolving all whitespace escapes, but _before_ resolving other backslash _after_ resolving all whitespace escapes, but _before_ resolving other backslash
escapes. Furthermore, a whitespace escape that attempts to escape the final escapes. This means a whitespace escape that attempts to escape the final line's
line's newline and/or whitespace prefix is invalid since the multi-line string newline and/or whitespace prefix can be invalid: if removing escaped whitespace
has to still be valid with the escaped whitespace removed. places the closing `"""` on a line with non-whitespace characters, this escape
is invalid.
For example, the following example is illegal: For example, the following example is illegal:
```kdl ```kdl
// Equivalent to trying to write a string containing `foo\nbar\`.
""" """
foo foo
bar\ bar\
""" """
// equivalent to
"""
foo
bar"""
``` ```
while the following example is allowed while the following example is allowed