mirror of https://github.com/kdl-org/kdl.git
change escape resolution order again
This commit is contained in:
parent
bea0f67685
commit
c9134e3c16
25
SPEC.md
25
SPEC.md
|
|
@ -478,37 +478,26 @@ literal sequence `CRLF CRLF` becomes `LF LF`, not `LF`.
|
||||||
#### Interaction with Whitespace Escapes
|
#### Interaction with Whitespace Escapes
|
||||||
|
|
||||||
Multi-line strings support the same mechanism for escaping whitespace. When
|
Multi-line strings support the same mechanism for escaping whitespace. When
|
||||||
Processing a Multi-line String, implementations MUST resolve all whitespace
|
processing a Multi-line String, implementations MUST resolve all whitespace
|
||||||
escapes _before_ dedenting the string.
|
escapes _after_ dedenting the string. Furthermore, a whitespace escape that
|
||||||
|
attempts to escape the final line's newline and/or whitespace prefix is
|
||||||
|
invalid, since this technically means it's trying to escape "nothing".
|
||||||
|
|
||||||
For example, the following is legal:
|
For example, the following example are both illegal:
|
||||||
|
|
||||||
```kdl
|
```kdl
|
||||||
|
// All multi-line strings must have the right dedent.
|
||||||
"
|
"
|
||||||
foo \
|
foo \
|
||||||
bar
|
bar
|
||||||
baz
|
baz
|
||||||
"
|
"
|
||||||
// becomes:
|
|
||||||
"foo bar\nbaz"
|
|
||||||
```
|
|
||||||
|
|
||||||
But the following is not, because the whitespace escape would consume the
|
// Equivalent to trying to write a string containing `foo\nbar\`.
|
||||||
indentation prior to dedenting:
|
|
||||||
|
|
||||||
```kdl
|
|
||||||
"
|
"
|
||||||
foo
|
foo
|
||||||
bar\
|
bar\
|
||||||
"
|
"
|
||||||
|
|
||||||
// equivalent to writing:
|
|
||||||
|
|
||||||
"
|
|
||||||
foo
|
|
||||||
bar"
|
|
||||||
|
|
||||||
// which is illegal.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue