interpolate: [I -> I[[

modern-harvey2
Doug Coleman 2017-08-26 18:02:57 -05:00
parent 55df44923f
commit 13d9a78ec6
2 changed files with 7 additions and 3 deletions

View File

@ -40,6 +40,6 @@ IN: interpolate.tests
{ "Oops, I accidentally the whole economy..." } [
let[
"economy" :> noun
"accidentally" [ [I Oops, I ${0} the whole ${noun}...I] ] with-string-writer
"accidentally" [ I[[ Oops, I ${0} the whole ${noun}...]] ] with-string-writer
]
] unit-test

View File

@ -85,6 +85,10 @@ MACRO: interpolate-locals ( str -- quot )
: interpolate-locals>string ( str -- newstr )
[ interpolate-locals ] with-string-writer ; inline
SYNTAX: [I
"I]" parse-multiline-string
: define-interpolate-syntax ( accum string -- accum )
parse-multiline-string
interpolate-locals-quot append! ;
SYNTAX: I[[ "]]" define-interpolate-syntax ;
SYNTAX: I[=[ "]=]" define-interpolate-syntax ;
SYNTAX: I[==[ "]==]" define-interpolate-syntax ;