]> gitweb.factorcode.org Git - factor.git/commitdiff
help.syntax: if you're gonna have HELP: stack effects, they might as well be correct...
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 19 Oct 2011 03:12:42 +0000 (20:12 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 19 Oct 2011 03:12:42 +0000 (20:12 -0700)
basis/help/syntax/syntax.factor

index 7f7bee1fe2edc0619dc87ba75b63e5c6a445511c..3bf17fdfc396fdbcace5ca5c9252459e01120ba5 100644 (file)
@@ -1,19 +1,24 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays compiler.units definitions effects help
-help.topics kernel namespaces parser sequences vocabs
-vocabs.parser words ;
+USING: accessors arrays compiler.units definitions effects
+effects.parser help help.topics kernel namespaces parser
+sequences vocabs vocabs.parser words ;
 IN: help.syntax
 
+<PRIVATE
+
+: check-effect ( word seq -- word seq' )
+    dup ?first effect? [
+        unclip pick stack-effect effect= [ bad-effect ] unless
+    ] when ;
+
+PRIVATE>
+
 SYNTAX: HELP:
     scan-word bootstrap-word
     [ >link save-location ]
-    [
-        [
-            \ ; parse-until
-            dup ?first effect? [ rest ] when >array
-        ] dip set-word-help
-    ] bi ;
+    [ \ ; parse-until check-effect >array swap set-word-help ]
+    bi ;
 
 SYNTAX: ARTICLE:
     location [