Skip to content

Commit

Permalink
reword interaction multiline + whitespace escape (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgotink authored Dec 16, 2024
1 parent 813a44b commit b9ddb52
Showing 1 changed file with 9 additions and 5 deletions.
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

0 comments on commit b9ddb52

Please sign in to comment.