Add missing reference-data and special-forms-data helpers

These were lost during an earlier sx_replace_node edit. Both use
case expressions to route slugs to the correct data tables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-31 23:36:21 +00:00
parent c0ded3facb
commit 464c767a19

View File

@@ -51,6 +51,17 @@
(define primitives-data (fn () primitives-by-category))
(define
special-forms-data
(fn
()
(let
((source (read-spec-file "special-forms.sx")))
(if
(starts-with? source ";;")
{:categories (list)}
(categorize-special-forms (parse source))))))
(define
_spec-search-dirs
(fn
@@ -74,6 +85,26 @@
(_spec-search-dirs))
(or result (str ";; spec file not found: " filename)))))
(define
reference-data
(fn
(slug)
(let
((raw-data (case slug "attributes" {:req-attrs request-attrs :beh-attrs behavior-attrs :uniq-attrs sx-unique-attrs} "headers" {:req-headers request-headers :resp-headers response-headers} "events" {:events-list events-list} "js-api" {:js-api-list js-api-list} :else {:req-attrs request-attrs :beh-attrs behavior-attrs :uniq-attrs sx-unique-attrs}))
(detail-keys
(case
slug
"attributes"
(keys attr-details)
"headers"
(keys header-details)
"events"
(keys event-details)
"js-api"
(list)
:else (keys attr-details))))
(build-reference-data slug raw-data detail-keys))))
(define
attr-detail-data
(fn (slug) (build-attr-detail slug (get attr-details slug))))