Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reword interaction multiline + whitespace escape #439

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
other characters in a string.


### Multi-line String

Multi-Line Strings support multiple lines with literal, non-escaped
Expand Down Expand Up @@ -582,18 +581,23 @@ Strings.

When processing a Multi-line String, implementations MUST dedent the string
_after_ resolving all whitespace escapes, but _before_ resolving other backslash
escapes. Furthermore, a whitespace escape that attempts to escape the final
line's newline and/or whitespace prefix is invalid since the multi-line string
has to still be valid with the escaped whitespace removed.
escapes. This means a whitespace escape that attempts to escape the final line's
newline and/or whitespace prefix can be invalid: if removing escaped whitespace
places the closing `"""` on a line with non-whitespace characters, this escape
is invalid.

For example, the following example is illegal:

```kdl
// Equivalent to trying to write a string containing `foo\nbar\`.
"""
foo
bar\
"""

// equivalent to
"""
foo
bar"""
```

while the following example is allowed
Expand Down