Add one-line comments to all defines in 5 spec files
parser.sx (3), render.sx (15), harness.sx (21), signals.sx (23), canonical.sx (12) — 74 comments total. Each define now has a ;; comment explaining its purpose. Combined with the evaluator.sx commit, all 215 defines across 6 spec files are now documented. primitives.sx and special-forms.sx already had :doc fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
;; Registry of all valid HTML tag names
|
||||
(define
|
||||
HTML_TAGS
|
||||
(list
|
||||
@@ -141,6 +142,7 @@
|
||||
"dialog"
|
||||
"menu"))
|
||||
|
||||
;; Self-closing tags (br, img, hr, etc.)
|
||||
(define
|
||||
VOID_ELEMENTS
|
||||
(list
|
||||
@@ -159,6 +161,7 @@
|
||||
"track"
|
||||
"wbr"))
|
||||
|
||||
;; Attrs that are true/false (checked, disabled, etc.)
|
||||
(define
|
||||
BOOLEAN_ATTRS
|
||||
(list
|
||||
@@ -186,8 +189,10 @@
|
||||
"reversed"
|
||||
"selected"))
|
||||
|
||||
;; Extensible list of forms treated as definitions
|
||||
(define *definition-form-extensions* (list))
|
||||
|
||||
;; Check if a symbol names a definition form
|
||||
(define
|
||||
definition-form?
|
||||
:effects ()
|
||||
@@ -203,6 +208,7 @@
|
||||
(= name "defeffect")
|
||||
(contains? *definition-form-extensions* name))))
|
||||
|
||||
;; Parse keyword attrs and children from element arg list
|
||||
(define
|
||||
parse-element-args
|
||||
:effects (render)
|
||||
@@ -233,6 +239,7 @@
|
||||
args)
|
||||
(list attrs children))))
|
||||
|
||||
;; Render attr dict to HTML attribute string
|
||||
(define
|
||||
render-attrs
|
||||
:effects ()
|
||||
@@ -255,6 +262,7 @@
|
||||
:else (str " " key "=\"" (escape-attr (str val)) "\""))))
|
||||
(keys attrs)))))
|
||||
|
||||
;; Evaluate cond expression (dispatches to scheme/clojure style)
|
||||
(define
|
||||
eval-cond
|
||||
:effects ()
|
||||
@@ -265,6 +273,7 @@
|
||||
(eval-cond-scheme clauses env)
|
||||
(eval-cond-clojure clauses env))))
|
||||
|
||||
;; Scheme-style cond: ((test body) ...)
|
||||
(define
|
||||
eval-cond-scheme
|
||||
:effects ()
|
||||
@@ -285,6 +294,7 @@
|
||||
body
|
||||
(eval-cond-scheme (rest clauses) env)))))))
|
||||
|
||||
;; Clojure-style cond: (test body test body ...)
|
||||
(define
|
||||
eval-cond-clojure
|
||||
:effects ()
|
||||
@@ -303,6 +313,7 @@
|
||||
body
|
||||
(eval-cond-clojure (slice clauses 2) env)))))))
|
||||
|
||||
;; Evaluate let binding pairs, extend env
|
||||
(define
|
||||
process-bindings
|
||||
:effects (mutation)
|
||||
@@ -324,6 +335,7 @@
|
||||
bindings)
|
||||
local)))
|
||||
|
||||
;; Check if an expression should be rendered vs evaluated
|
||||
(define
|
||||
is-render-expr?
|
||||
:effects ()
|
||||
@@ -350,6 +362,7 @@
|
||||
(> (len expr) 1)
|
||||
(= (type-of (nth expr 1)) "keyword")))))))))
|
||||
|
||||
;; Merge spread child attrs into parent element attrs
|
||||
(define
|
||||
merge-spread-attrs
|
||||
:effects (mutation)
|
||||
@@ -385,6 +398,7 @@
|
||||
(dict-set! target key val)))))
|
||||
(keys spread-dict))))
|
||||
|
||||
;; Escape special chars for HTML text content
|
||||
(define
|
||||
escape-html
|
||||
(fn
|
||||
@@ -397,4 +411,5 @@
|
||||
(set! r (replace r "\"" """))
|
||||
r)))
|
||||
|
||||
;; Escape special chars for HTML attribute values
|
||||
(define escape-attr (fn (s) (escape-html s)))
|
||||
|
||||
Reference in New Issue
Block a user