]> gitweb.factorcode.org Git - factor.git/commitdiff
interpolate: adding interpolated string syntax I"hello, ${0}"
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 30 Aug 2023 23:18:40 +0000 (16:18 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 30 Aug 2023 23:18:40 +0000 (16:18 -0700)
basis/interpolate/interpolate-tests.factor
basis/interpolate/interpolate.factor

index 0d4a8d16d677e1410e2f9da6c2ed2614a5bb8fc7..771bd76cdb87134b3663083ed2f99c2fddffad8f 100644 (file)
@@ -42,3 +42,5 @@ USING: interpolate io.streams.string namespaces tools.test locals ;
         "accidentally" [ [I Oops, I ${0} the whole ${noun}...I] ] with-string-writer
     ]
 ] unit-test
+
+{ "hello, world" } [ "world" I"hello, ${0}" ] unit-test
index 59024ff90d35cf4b54956c1bae0860e1631212d3..9d7115ef866997f58a777ba3f4a3f001e2b3113a 100644 (file)
@@ -2,7 +2,7 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors fry generalizations io io.streams.string kernel
 make math math.order math.parser multiline namespaces present
-sequences splitting strings vocabs.parser ;
+sequences splitting strings strings.parser vocabs.parser ;
 IN: interpolate
 
 <PRIVATE
@@ -89,3 +89,5 @@ MACRO: interpolate-locals ( str -- quot )
 SYNTAX: [I
     "I]" parse-multiline-string
     interpolate-locals-quot append! ;
+
+SYNTAX: I" parse-string '[ _ interpolate>string ] append! ;