Merge commit 'origin/master' into emacs

db4
Jose A. Ortega Ruiz 2008-12-25 20:04:58 +01:00
commit 15b5977b79
4 changed files with 136 additions and 38 deletions

View File

@ -327,7 +327,7 @@ HELP: $table
HELP: $values
{ $values { "element" "an array of pairs of markup elements" } }
{ $description "Prints the description of arguments and values found on every word help page. The first element of a pair is the argument name and is output with " { $link $snippet } ". The remainder is either a single class word, or an element. If it is a class word " { $snippet "class" } ", it is intereted as if it were shorthand for " { $snippet "{ $instance class }" } "." }
{ $description "Prints the description of arguments and values found on every word help page. The first element of a pair is the argument name and is output with " { $link $snippet } ". The remainder is either a single class word, or an element. If it is a class word " { $snippet "class" } ", it is inserted as if it were shorthand for " { $snippet "{ $instance class }" } "." }
{ $see-also $maybe $instance $quotation } ;
HELP: $instance

View File

@ -1,61 +1,111 @@
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
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: Description:
: parse-text-block ( -- array )
".." parse-multiline-string
string-lines
1 tail
[ dup " " head? [ 4 tail ] [ ] if ] map
[ dup "" = [ drop { $nl } ] [ ] if ] map
\ $description prefix
[ dup " " head? [ 4 tail ] [ ] if ] map
[ expand-markup ] map
concat
[ dup "" = [ drop { $nl } ] [ ] if ] map ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: Text: parse-text-block parsed ; parsing
: Block: scan-word 1array parse-text-block append parsed ; parsing
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: Notes: { $notes } parse-text-block append parsed ; parsing
: Description: { $description } parse-text-block append parsed ; parsing
: Contract: { $contract } parse-text-block append parsed ; parsing
: Checked-Example: { $example } parse-text-block append parsed ; parsing
: Class-Description:
{ $class-description } parse-text-block append parsed ; parsing
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: Code:
{ $code }
parse-text-block [ dup array? [ drop "" ] [ ] if ] map
append
parsed
; parsing
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: Example:
{ $heading "Example" }
{ $code }
parse-text-block
[ dup array? [ drop "" ] [ ] if ] map ! Each item in $code must be a string
append
2array parsed ; parsing
{ $heading "Example" } parsed
: Introduction:
".." parse-multiline-string
string-lines
[ dup " " head? [ 4 tail ] [ ] if ] map
[ "" = not ] filter
! \ $example prefix
\ $code prefix
parsed
; parsing
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{ $heading "Introduction" }
parse-text-block
2array parsed ; parsing
: Summary:
".." parse-multiline-string
string-lines
1 tail
[ dup " " head? [ 4 tail ] [ ] if ] map
[ dup "" = [ drop { $nl } ] [ ] if ] map
{ $heading "Summary" } prefix
parsed
; parsing
{ $heading "Summary" }
parse-text-block
2array parsed ; parsing
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: 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
; 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
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: Heading: { $heading } ".." parse-multiline-string suffix parsed ; parsing
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: List:
{ $list }
".." parse-multiline-string
string-lines
1 tail
[ dup " " head? [ 4 tail ] [ ] if ] map
[ expand-markup ] map
append parsed
; parsing

View File

@ -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 ;

View File

@ -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:
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!