]> gitweb.factorcode.org Git - factor.git/commitdiff
help.syntax: $examples with all strings should be turned to code.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 16 Dec 2020 18:42:13 +0000 (10:42 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 16 Dec 2020 18:42:13 +0000 (10:42 -0800)
basis/help/syntax/syntax.factor

index 3c5f9d0ac992d24af8ec4009766abe4345feb8a9..c654eb2a54a9974d3a2ea1cdcd424f2f70cba8fd 100644 (file)
@@ -81,17 +81,15 @@ IN: help.syntax
 : code-lines ( str -- seq )
     string-lines [ [ blank? ] trim ] map harvest ;
 
-: make-example ( seq -- seq )
-    dup string? [
-        code-lines
-        dup { [ array? ] [ length 1 > ] } 1&& [
-            dup length 1 - over [ unescape-string ] change-nth
-            \ $example prefix
-        ] when
+: make-example ( str -- seq )
+    code-lines dup { [ array? ] [ length 1 > ] } 1&& [
+        dup length 1 - over [ unescape-string ] change-nth
+        \ $example prefix
     ] when ;
 
 : parse-help-examples ( -- seq )
-    \ } parse-until [ make-example ] { } map-as ;
+    \ } parse-until dup [ string? ] all?
+    [ [ make-example ] { } map-as ] [ >array ] if ;
 
 : parse-help-code ( -- seq )
     \ } parse-until dup { [ length 1 = ] [ first string? ] } 1&&