~dieggsy/chalk

a40db079d0dbdb607dbb9a34a89fa0fc061d4115 — dieggsy 3 years ago 5c8e2b7
Add basic syntax support
1 files changed, 10 insertions(+), 3 deletions(-)

M chalk-bin.scm
M chalk-bin.scm => chalk-bin.scm +10 -3
@@ 86,7 86,7 @@
(define (find-docstr doc)
  (find string? doc))

(define (document-procedure exp)
(define (document-procedure exp #!optional (type 'procedure))
  (let* ((doc (fourth exp))
         (internal (find-tag '@internal doc)))
    (unless internal


@@ 103,8 103,8 @@
                                                  (symbol->string (car e))))))
                      doc)))
        (if @to
            (printf "<procedure>~s → ~a</procedure>\n" sig (cadr @to))
            (printf "<procedure>~s</procedure>\n" sig))
            (printf "<~a>~s → ~a</~a>\n" type sig (cadr @to) type)
            (printf "<~a>~s</~a>\n" type sig type))
        (when docstr
          (printf "~a\n\n" docstr))
        (when (not (null? params))


@@ 125,6 125,9 @@
(define procedure-tags
  '(fn proc procedure function))

(define syntax-tags
  '(macro syntax))

(define file-relpath)
(define (document-expr exp)
  (define documentable-expr?


@@ 135,6 138,10 @@
  (when (and (pair? exp)
             (not (null? (cdr exp))))
    (cond ((and documentable-expr?
                (or (member (car (fourth exp)) syntax-tags)
                    (eqv? 'define-syntax (first exp))))
           (document-procedure exp 'syntax))
          ((and documentable-expr?
                (or (member (car (fourth exp)) procedure-tags)
                    (and (eqv? 'define (first exp))
                         (pair? (second exp)))))