work on docs for keyword arguments

svn: r6581

original commit: 05607ad6615dfd0bbbb9593d5b620898d373b3b3
This commit is contained in:
Matthew Flatt 2007-06-12 01:44:02 +00:00
parent d82317d871
commit 83cd2916b3
4 changed files with 46 additions and 28 deletions

View File

@ -96,7 +96,7 @@
(make-element 'subscript (decode-content str))) (make-element 'subscript (decode-content str)))
(define/kw (superscript #:body str) (define/kw (superscript #:body str)
(make-element superscript (decode-content str))) (make-element 'superscript (decode-content str)))
;; ---------------------------------------- ;; ----------------------------------------

View File

@ -92,7 +92,7 @@
(provide onscreen menuitem defterm (provide onscreen menuitem defterm
schemefont schemevalfont schemeresultfont schemeidfont schemefont schemevalfont schemeresultfont schemeidfont
schemeparenfont schemekeywordfont schemeparenfont schemekeywordfont schememetafont
file exec file exec
link procedure link procedure
idefterm) idefterm)
@ -116,6 +116,8 @@
(make-element "schemesymbol" (decode-content str))) (make-element "schemesymbol" (decode-content str)))
(define/kw (schemeparenfont #:body str) (define/kw (schemeparenfont #:body str)
(make-element "schemeparen" (decode-content str))) (make-element "schemeparen" (decode-content str)))
(define/kw (schememetafont #:body str)
(make-element "schememeta" (decode-content str)))
(define/kw (schemekeywordfont #:body str) (define/kw (schemekeywordfont #:body str)
(make-element "schemekeyword" (decode-content str))) (make-element "schemekeyword" (decode-content str)))
(define/kw (file #:body str) (define/kw (file #:body str)
@ -161,9 +163,9 @@
(schemeresultfont "#<undefined>")) (schemeresultfont "#<undefined>"))
(define dots0 (define dots0
(make-element "schemeparen" (list "..."))) (make-element "schememeta" (list "...")))
(define dots1 (define dots1
(make-element "schemeparen" (list "..." (superscript "+")))) (make-element "schememeta" (list "...+")))
(define-syntax (arg-contract stx) (define-syntax (arg-contract stx)
(syntax-case stx (... ...+) (syntax-case stx (... ...+)
@ -322,7 +324,7 @@
(if (keyword? (car i)) (if (keyword? (car i))
(cadr i) (cadr i)
(car i)))) (car i))))
(apply append (map cdr prototypes)))]) (apply append (map cdr prototypes)))])
(make-splice (make-splice
(cons (cons
(make-table (make-table
@ -437,21 +439,22 @@
(make-paragraph (make-paragraph
(list (list
(to-element (to-element
`(struct ,(make-target-element* `(,(schemeparenfont "struct")
(to-element name) ,(make-target-element*
(let ([name (if (pair? name) (to-element name)
(car name) (let ([name (if (pair? name)
name)]) (car name)
(list* (list name) name)])
(list name '?) (list* (list name)
(list 'make- name) (list name '?)
(append (list 'make- name)
(map (lambda (f) (append
(list name '- (car f))) (map (lambda (f)
fields) (list name '- (car f)))
(map (lambda (f) fields)
(list 'set- name '- (car f) '!)) (map (lambda (f)
fields))))) (list 'set- name '- (car f) '!))
fields)))))
,(map car fields)))))))) ,(map car fields))))))))
(map (lambda (v) (map (lambda (v)
(cond (cond
@ -506,7 +509,8 @@
[(pair? form) (append (loop (car form)) [(pair? form) (append (loop (car form))
(loop (cdr form)))] (loop (cdr form)))]
[else null]))) [else null])))
forms))]) forms))]
[current-meta-list '(... ...+)])
(make-splice (make-splice
(cons (cons
(make-table (make-table
@ -550,7 +554,8 @@
[(pair? form) (append (loop (car form)) [(pair? form) (append (loop (car form))
(loop (cdr form)))] (loop (cdr form)))]
[else null])) [else null]))
(current-variable-list))]) (current-variable-list))]
[current-meta-list '(... ...+)])
(make-blockquote (make-blockquote
"leftindent" "leftindent"
(cons (cons

View File

@ -15,14 +15,16 @@
syntax-ize-hook syntax-ize-hook
current-keyword-list current-keyword-list
current-variable-list current-variable-list
current-meta-list
(struct shaped-parens (val shape))) (struct shaped-parens (val shape)))
(define no-color "schemeplain") (define no-color "schemeplain")
(define meta-color "schemeplain") (define reader-color "schemeplain")
(define keyword-color "schemekeyword") (define keyword-color "schemekeyword")
(define comment-color "schemecomment") (define comment-color "schemecomment")
(define paren-color "schemeparen") (define paren-color "schemeparen")
(define meta-color "schememeta")
(define value-color "schemevalue") (define value-color "schemevalue")
(define symbol-color "schemesymbol") (define symbol-color "schemesymbol")
(define variable-color "schemevariable") (define variable-color "schemevariable")
@ -39,6 +41,8 @@
set!))) set!)))
(define current-variable-list (define current-variable-list
(make-parameter null)) (make-parameter null))
(define current-meta-list
(make-parameter null))
(define defined-names (make-hash-table)) (define defined-names (make-hash-table))
@ -246,7 +250,7 @@
[(unsyntax) (values "#," 0)])]) [(unsyntax) (values "#," 0)])])
(out str (if (positive? (+ quote-depth quote-delta)) (out str (if (positive? (+ quote-depth quote-delta))
value-color value-color
meta-color)) reader-color))
(let ([i (cadr (syntax->list c))]) (let ([i (cadr (syntax->list c))])
(set! src-col (or (syntax-column i) src-col)) (set! src-col (or (syntax-column i) src-col))
(hash-table-put! next-col-map src-col dest-col) (hash-table-put! next-col-map src-col dest-col)
@ -339,8 +343,6 @@
(char=? (string-ref s 0) #\_)) (char=? (string-ref s 0) #\_))
(values (substring s 1) #t #f) (values (substring s 1) #t #f)
(values s #f #f))))] (values s #f #f))))]
[(is-kw?) (and (identifier? c)
(memq (syntax-e c) (current-keyword-list)))]
[(is-var?) (and (identifier? c) [(is-var?) (and (identifier? c)
(memq (syntax-e c) (current-variable-list)))]) (memq (syntax-e c) (current-variable-list)))])
(if (element? (syntax-e c)) (if (element? (syntax-e c))
@ -375,8 +377,12 @@
value-color] value-color]
[(identifier? c) [(identifier? c)
(cond (cond
[is-kw? [(and (identifier? c)
(memq (syntax-e c) (current-keyword-list)))
keyword-color] keyword-color]
[(and (identifier? c)
(memq (syntax-e c) (current-meta-list)))
meta-color]
[is-var? [is-var?
variable-color] variable-color]
[it? variable-color] [it? variable-color]
@ -526,7 +532,9 @@
(list #f 1 col (+ 1 col) (list #f 1 col (+ 1 col)
(+ 2 (+ 2
vec-sz vec-sz
(sub1 (length l)) (if (zero? (length l))
0
(sub1 (length l)))
(apply + (map syntax-span l)))))))] (apply + (map syntax-span l)))))))]
[(pair? v) [(pair? v)
(let* ([a (syntax-ize (car v) (+ col 1))] (let* ([a (syntax-ize (car v) (+ col 1))]

View File

@ -165,6 +165,11 @@
font-family: Courier; font-size: 80%; font-family: Courier; font-size: 80%;
} }
.schememeta {
color: #262680;
font-family: Courier; font-size: 80%;
}
.schemeopt { .schemeopt {
color: black; color: black;
} }