]> gitweb.factorcode.org Git - factor.git/commitdiff
escape-strings: Add a tag-payload word to make a string payload and tag.
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 21 Jul 2018 20:18:29 +0000 (15:18 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 21 Jul 2018 20:19:42 +0000 (15:19 -0500)
basis/escape-strings/escape-strings.factor

index 423b4051fe02db5a9bd9b591278ad6330fa031d1..9502fb1da0a0221ded2113c1029b920c0975aa30 100644 (file)
@@ -28,6 +28,9 @@ IN: escape-strings
 : escape-strings ( strs -- str )
     [ escape-string ] map concat escape-string ;
 
+: tag-payload ( str tag -- str' )
+    [ escape-string ] dip prepend ;
+
 : escape-simplest ( str -- str' )
     dup { CHAR: ' CHAR: " CHAR: \r CHAR: \n CHAR: \s } counts {
         { [ dup { CHAR: ' CHAR: \r CHAR: \n CHAR: \s } values-of sum 0 = ] [ drop "'" prepend ] }