summaryrefslogtreecommitdiff
path: root/src/geiser
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-10-14 04:33:59 +0100
committerjao <jao@gnu.org>2022-10-14 04:33:59 +0100
commit1e91a62f72d5403dc2651ab3f2156c446cbeed41 (patch)
tree27006ec81d96cb78d5a037a52e8584897ddba52c /src/geiser
parentb91775c9a778ffbb91a9539ed2b1236ae06c68a6 (diff)
downloadgeiser-chez-1e91a62f72d5403dc2651ab3f2156c446cbeed41.tar.gz
geiser-chez-1e91a62f72d5403dc2651ab3f2156c446cbeed41.tar.bz2
fix: multiple arities in chez-docs signatures
Diffstat (limited to 'src/geiser')
-rw-r--r--src/geiser/geiser-data.ss13
-rw-r--r--src/geiser/geiser.ss10
2 files changed, 11 insertions, 12 deletions
diff --git a/src/geiser/geiser-data.ss b/src/geiser/geiser-data.ss
index f9fc81e..0176e59 100644
--- a/src/geiser/geiser-data.ss
+++ b/src/geiser/geiser-data.ss
@@ -17,20 +17,23 @@
(library (geiser-data)
- (export symbol-signature symbol-labels)
+ (export symbol-signatures symbol-labels)
(import (chezscheme))
(define (make-hash d)
(let ((h (make-hashtable symbol-hash eq?)))
(for-each (lambda (x)
(let ((id (car x))
- (sg (let ((a (with-input-from-string (cadr x) read)))
- (if (list? a) (cdr a) a))))
- (symbol-hashtable-set! h id (cons id (cons sg (cddr x))))))
+ (sgs (let* ((s (format "(~a)" (cadr x)))
+ (as (with-input-from-string s read)))
+ (and (list? as)
+ (list? (car as))
+ (map cdr (remove '~ as))))))
+ (symbol-hashtable-set! h id (cons id (cons sgs (cddr x))))))
d)
h))
- (define (symbol-signature s)
+ (define (symbol-signatures s)
(let ((x (or (symbol-hashtable-ref csug-data s #f)
(symbol-hashtable-ref tspl-data s #f))))
(and x (list? (cadr x)) (cadr x))))
diff --git a/src/geiser/geiser.ss b/src/geiser/geiser.ss
index 806f593..9ec73e8 100644
--- a/src/geiser/geiser.ss
+++ b/src/geiser/geiser.ss
@@ -187,15 +187,11 @@
(l (string-length s)))
(if (<= l max-len) s (string-append (substring s 0 sub-len) sub-str))))
- (define (docs->parameter-list id)
- (let ((s (symbol-signature id)))
- (and s (list s))))
-
(define (operator-arglist operator)
(define (procedure-parameter-list id p)
(and (procedure? p)
(or (source->parameter-list p)
- (docs->parameter-list id)
+ (symbol-signatures id)
(arity->parameter-list p))))
(define (autodoc-arglist* args req)
(cond ((null? args) (list (list* "required" (reverse req))))
@@ -210,8 +206,8 @@
(arglists
`(,operator ("args" ,@(map autodoc-arglist arglists))))
(else `(,operator ("value" . ,(value->string binding))))))
- (let ((s (symbol-signature operator)))
- (if s `(,operator ("args" (("required" ,@s)))) '())))))
+ (let ((s (symbol-signatures operator)))
+ (if s `(,operator ("args" ,@(map autodoc-arglist s))) '())))))
(define (geiser:autodoc ids)
(cond ((null? ids) '())