mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 06:08:41 +01:00
Simple string interpolation.
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.
This commit is contained in:
@ -61,19 +61,19 @@ class SyntaxExample {
|
||||
print(a, b) { System.print(a + b) }
|
||||
|
||||
// Operators
|
||||
+(other) { "infix + " + other }
|
||||
-(other) { "infix - " + other }
|
||||
*(other) { "infix * " + other }
|
||||
/(other) { "infix / " + other }
|
||||
%(other) { "infix % " + other }
|
||||
<(other) { "infix < " + other }
|
||||
>(other) { "infix > " + other }
|
||||
<=(other) { "infix <= " + other }
|
||||
>=(other) { "infix >= " + other }
|
||||
==(other) { "infix == " + other }
|
||||
!=(other) { "infix != " + other }
|
||||
&(other) { "infix & " + other }
|
||||
|(other) { "infix | " + other }
|
||||
+(other) { "infix + %(other)" }
|
||||
-(other) { "infix - %(other)" }
|
||||
*(other) { "infix * %(other)" }
|
||||
/(other) { "infix / %(other)" }
|
||||
%(other) { "infix \% %(other)" }
|
||||
<(other) { "infix < %(other)" }
|
||||
>(other) { "infix > %(other)" }
|
||||
<=(other) { "infix <= %(other)" }
|
||||
>=(other) { "infix >= %(other)" }
|
||||
==(other) { "infix == %(other)" }
|
||||
!=(other) { "infix != %(other)" }
|
||||
&(other) { "infix & %(other)" }
|
||||
|(other) { "infix | %(other)" }
|
||||
|
||||
! { "prefix !" }
|
||||
~ { "prefix ~" }
|
||||
|
||||
Reference in New Issue
Block a user