diff --git a/extra/easy-help/easy-help.factor b/extra/easy-help/easy-help.factor index b99f2e248c..824a638fd4 100644 --- a/extra/easy-help/easy-help.factor +++ b/extra/easy-help/easy-help.factor @@ -1,5 +1,8 @@ -USING: kernel multiline parser sequences splitting grouping help.markup ; +USING: arrays assocs compiler.units + grouping help help.markup help.topics kernel lexer multiline + namespaces parser sequences splitting words + easy-help.expand-markup ; IN: easy-help @@ -52,10 +55,57 @@ IN: easy-help : Values: ".." parse-multiline-string - " \n" split - [ "" = not ] filter - 2 group + string-lines + 1 tail + [ dup " " head? [ 4 tail ] [ ] if ] map + [ " " split1 [ " " first = ] trim-left 2array ] map \ $values prefix parsed - ; parsing \ No newline at end of file + ; parsing + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: Word: + + scan current-vocab create dup old-definitions get + [ delete-at ] with each dup set-word + + bootstrap-word dup set-word + dup >link save-location + \ ; parse-until >array swap set-word-help ; parsing + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: Contract: + + ".." parse-multiline-string + string-lines + 1 tail + [ dup " " head? [ 4 tail ] [ ] if ] map + [ expand-markup ] map + concat + [ dup "" = [ drop { $nl } ] [ ] if ] map + \ $contract prefix + parsed + + ; parsing + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: Notes: + + ".." parse-multiline-string + string-lines + 1 tail + [ dup " " head? [ 4 tail ] [ ] if ] map + [ expand-markup ] map + concat + [ dup "" = [ drop { $nl } ] [ ] if ] map + \ $notes prefix + parsed + + ; parsing + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + diff --git a/extra/easy-help/expand-markup/expand-markup.factor b/extra/easy-help/expand-markup/expand-markup.factor new file mode 100644 index 0000000000..7550158c7e --- /dev/null +++ b/extra/easy-help/expand-markup/expand-markup.factor @@ -0,0 +1,47 @@ + +USING: accessors arrays kernel lexer locals math namespaces parser + sequences splitting ; + +IN: easy-help.expand-markup + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: scan-one-array ( string -- array rest ) + string-lines + lexer-factory get call + [ + [ + \ } parse-until >array + lexer get line-text>> + lexer get column>> tail + ] + with-lexer + ] + with-scope ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: contains-markup? ( string -- ? ) "{ $" swap subseq? ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +:: expand-markup ( LINE -- lines ) + + LINE contains-markup? + [ + + [let | N [ "{ $" LINE start ] | + + LINE N head + + LINE N 2 + tail scan-one-array dup " " head? [ 1 tail ] [ ] if + + [ 2array ] dip + + expand-markup + + append ] + + ] + [ LINE 1array ] + if ; diff --git a/extra/size-of/size-of.factor b/extra/size-of/size-of.factor index 4f4743c6b6..c5fae3c647 100644 --- a/extra/size-of/size-of.factor +++ b/extra/size-of/size-of.factor @@ -8,11 +8,13 @@ IN: size-of ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -DEFER: size-of +Word: size-of -HELP: size-of +Values: -Values: HEADERS sequence TYPE string n integer .. + HEADERS sequence : List of header files + TYPE string : A C type + n integer : Size in number of bytes .. Description: @@ -57,4 +59,3 @@ Example: ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - \ No newline at end of file