SPICE-0028: Add support for multi-line string line continuations (#1507)

SPICE: https://github.com/apple/pkl-evolution/pull/31
This commit is contained in:
Jen Basch
2026-04-21 10:29:52 -07:00
committed by GitHub
parent d85f06be27
commit e07abb7311
24 changed files with 185 additions and 10 deletions

View File

@@ -255,8 +255,7 @@ String literals are enclosed in double quotes:
"Hello, World!"
----
TIP: Except for a few minor differences footnote:[Pkl's string literals have fewer character escape sequences,
have stricter rules for line indentation in multiline strings, and do not have a line continuation character.],
TIP: Except for a few minor differences footnote:[Pkl's string literals have fewer character escape sequences and stricter rules for line indentation in multiline strings.],
String literals have the same syntax and semantics as in Swift 5. Learn one of them, know both of them!
Inside a string literal, the following character escape sequences have special meaning:
@@ -362,6 +361,23 @@ str = """
"""
----
To prevent line breaks from becoming part of the string's value, use a backslash (`\`) to end those lines.
[source%tested,{pkl}]
----
str = """
Although the Dodo is extinct, \
the species will be remembered.
"""
----
This multiline string is equivalent to the following single-line string:
[source%parsed,{pkl-expr}]
----
"Although the Dodo is extinct, the species will be remembered."
----
[[custom-string-delimiters]]
=== Custom String Delimiters