clarify multi-line strings and escapes interaction

This commit is contained in:
Kat Marchán 2024-04-01 14:37:52 -07:00 committed by GitHub
parent 281de7e977
commit d064bc9026
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 1 deletions

27
SPEC.md
View File

@ -304,7 +304,7 @@ A handful of patterns are disallowed, to avoid confusion with other values:
* idents that appear to start with a [Number](#number) (like `1.0v2` or
`-1em`) or the "almost a number" pattern of a decimal point without a
leading digit (like `.1`)/
leading digit (like `.1`).
* idents that are the language keywords (`inf`, `-inf`, `nan`, `true`,
`false`, and `null`) without their leading `#`.
@ -397,6 +397,31 @@ such) are retained. For example, these strings are all semantically identical:
"
```
Escapes MUST be processed _after_ [Multi-line String](#multi-line-strings)
processing. That is, the following strings are illegal:
```kdl
// Indentation checks are processed before whitespace escapes.
"
foo\
bar
"
// Essentially trying to escape `foo\nbar\`, which is an error due to missing
// escape character.
"
foo
bar\
"
```
But the following is legal, since it doesn't use Multi-line String rules:
```kdl
"foo\
bar"
```
##### Invalid escapes
Except as described in the escapes table, above, `\` *MUST NOT* precede any