]> gitweb.factorcode.org Git - factor.git/blob - basis/help/syntax/syntax.factor
help.syntax: if you're gonna have HELP: stack effects, they might as well be correct...
[factor.git] / basis / help / syntax / syntax.factor
1 ! Copyright (C) 2005, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays compiler.units definitions effects
4 effects.parser help help.topics kernel namespaces parser
5 sequences vocabs vocabs.parser words ;
6 IN: help.syntax
7
8 <PRIVATE
9
10 : check-effect ( word seq -- word seq' )
11     dup ?first effect? [
12         unclip pick stack-effect effect= [ bad-effect ] unless
13     ] when ;
14
15 PRIVATE>
16
17 SYNTAX: HELP:
18     scan-word bootstrap-word
19     [ >link save-location ]
20     [ \ ; parse-until check-effect >array swap set-word-help ]
21     bi ;
22
23 SYNTAX: ARTICLE:
24     location [
25         \ ; parse-until >array [ first2 ] [ 2 tail ] bi <article>
26         over add-article >link
27     ] dip remember-definition ;
28
29 SYNTAX: ABOUT:
30     current-vocab scan-object >>help changed-definition ;