]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/interpolate/interpolate.factor
basis: use lint.vocabs tool to trim using lists
[factor.git] / basis / interpolate / interpolate.factor
index 135b2fd81680fcc69c1bbb77b85a5eac815fa664..cd300a585c73791bc08121fa464a880f61418cfe 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors fry generalizations io io.streams.string kernel
-locals macros make math math.order math.parser multiline
-namespaces present sequences splitting strings vocabs.parser ;
+make math math.order math.parser multiline namespaces present
+sequences splitting strings vocabs.parser ;
 IN: interpolate
 
 <PRIVATE
@@ -45,7 +45,7 @@ TUPLE: anon-var ;
         dup stack-var? [ n>> [ or ] keep max ] [ drop ] if
     ] reduce ;
 
-:: interpolate-quot ( str quot -- quot' )
+:: (interpolate-quot) ( str quot -- quot' )
     str parse-interpolate :> args
     args max-stack-var    :> vars
 
@@ -67,15 +67,24 @@ TUPLE: anon-var ;
 
 PRIVATE>
 
+: interpolate-quot ( str -- quot )
+    [ [ get ] ] (interpolate-quot) ;
+
 MACRO: interpolate ( str -- quot )
-    [ [ get ] ] interpolate-quot ;
+    interpolate-quot ;
 
 : interpolate>string ( str -- newstr )
     [ interpolate ] with-string-writer ; inline
 
-: interpolate-locals ( str -- quot )
-    [ dup search [ [ ] ] [ [ get ] ] ?if ] interpolate-quot ;
+: interpolate-locals-quot ( str -- quot )
+    [ dup search [ [ ] ] [ [ get ] ] ?if ] (interpolate-quot) ;
+
+MACRO: interpolate-locals ( str -- quot )
+    interpolate-locals-quot ;
+
+: interpolate-locals>string ( str -- newstr )
+    [ interpolate-locals ] with-string-writer ; inline
 
-SYNTAX: I[
-    "]I" parse-multiline-string
-    interpolate-locals append! ;
+SYNTAX: [I
+    "I]" parse-multiline-string
+    interpolate-locals-quot append! ;