mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 06:38:45 +01:00
This allows "%(...)" inside a string literal to interpolate the stringified result of an expression. It doesn't support custom interpolators or format strings, but we can consider extending that later.
16 lines
315 B
Plaintext
16 lines
315 B
Plaintext
// Full string.
|
|
System.print("%(1 + 2)") // expect: 3
|
|
|
|
// Multiple in one string.
|
|
System.print("str%(1 + 2)(%(3 + 4)\%%(5 + 6)") // expect: str3(7%11
|
|
|
|
// Nested.
|
|
System.print("[%("{%("in" + "ner")}")]") // expect: [{inner}]
|
|
|
|
// Ignore newlines in template.
|
|
System.print("[%(
|
|
|
|
"template"
|
|
|
|
)]") // expect: [template]
|