From 6171b1939f72480ced7ef4b9175c6977228a91e3 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 23 Dec 2008 21:57:34 -0600 Subject: [PATCH 1/6] easy-help: 'Values:' accepts multi-line input --- extra/easy-help/easy-help.factor | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/extra/easy-help/easy-help.factor b/extra/easy-help/easy-help.factor index b99f2e248c..1849c7330b 100644 --- a/extra/easy-help/easy-help.factor +++ b/extra/easy-help/easy-help.factor @@ -1,5 +1,6 @@ -USING: kernel multiline parser sequences splitting grouping help.markup ; +USING: kernel multiline parser arrays + sequences splitting grouping help.markup ; IN: easy-help @@ -52,10 +53,14 @@ 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 + + + From ca463f020ba754236503ed41d639d289d65e006b Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 23 Dec 2008 21:58:08 -0600 Subject: [PATCH 2/6] size-of: Edit 'Values:' --- extra/size-of/size-of.factor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extra/size-of/size-of.factor b/extra/size-of/size-of.factor index 4f4743c6b6..127e0f5e81 100644 --- a/extra/size-of/size-of.factor +++ b/extra/size-of/size-of.factor @@ -12,7 +12,11 @@ DEFER: size-of HELP: size-of -Values: HEADERS sequence TYPE string n integer .. +Values: + + HEADERS sequence : List of header files + TYPE string : C type + n integer : Size in number of bytes .. Description: From d842a7563997127267a504a2d0fec1581f25fa93 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 23 Dec 2008 22:46:03 -0600 Subject: [PATCH 3/6] easy-help: Add 'Word:' --- extra/easy-help/easy-help.factor | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extra/easy-help/easy-help.factor b/extra/easy-help/easy-help.factor index 1849c7330b..c59fbab6ee 100644 --- a/extra/easy-help/easy-help.factor +++ b/extra/easy-help/easy-help.factor @@ -62,5 +62,13 @@ IN: easy-help ; 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 From 4fd6242ae3b29a0c1e7194bb9d210ecc2a35c4ce Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 23 Dec 2008 22:46:18 -0600 Subject: [PATCH 4/6] size-of: Use 'Word:' from easy-help --- extra/size-of/size-of.factor | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/extra/size-of/size-of.factor b/extra/size-of/size-of.factor index 127e0f5e81..c5fae3c647 100644 --- a/extra/size-of/size-of.factor +++ b/extra/size-of/size-of.factor @@ -8,14 +8,12 @@ IN: size-of ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -DEFER: size-of - -HELP: size-of +Word: size-of Values: HEADERS sequence : List of header files - TYPE string : C type + TYPE string : A C type n integer : Size in number of bytes .. Description: @@ -61,4 +59,3 @@ Example: ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - \ No newline at end of file From 15202a9cf21d8f09d821364f0fe1cc934d94077d Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Wed, 24 Dec 2008 03:13:28 -0600 Subject: [PATCH 5/6] Add 'easy-help.expand-markup' --- .../expand-markup/expand-markup.factor | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 extra/easy-help/expand-markup/expand-markup.factor 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 ; From 028d27a2cb81ccf19f37f42f3007075bf88a265e Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Wed, 24 Dec 2008 03:13:44 -0600 Subject: [PATCH 6/6] easy-help: Add support for embedded markup to some words --- extra/easy-help/easy-help.factor | 41 ++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/extra/easy-help/easy-help.factor b/extra/easy-help/easy-help.factor index c59fbab6ee..824a638fd4 100644 --- a/extra/easy-help/easy-help.factor +++ b/extra/easy-help/easy-help.factor @@ -1,6 +1,8 @@ -USING: kernel multiline parser arrays - 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 @@ -72,3 +74,38 @@ IN: easy-help 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 + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +