HS parser: fix number+comparison keyword collision, eval-hs uses hs-compile

Parser: skip unit suffix when next ident is a comparison keyword
(starts, ends, contains, matches, is, does, in, precedes, follows).
Fixes "123 starts with '12'" returning "123starts" instead of true.

eval-hs: use hs-compile directly instead of hs-to-sx-from-source with
"return " prefix, which was causing the parser to consume the comparison
as a string suffix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-15 11:29:01 +00:00
parent a93e5924df
commit 4f02f82f4e
377 changed files with 9517 additions and 8694 deletions

View File

@@ -0,0 +1,30 @@
(defcomp ()
(~docs/page :title "Modules"
(p (~tw :tokens "text-stone-500 text-sm italic mb-8")
"Declaring what a file needs — for documentation, static analysis, and tooling.")
(~docs/section :title "The use form" :id "use-form"
(p "A " (code "(use module-name)") " declaration at the top of an " (code ".sx") " file says: this file depends on definitions from that module.")
(~docs/code :src (str "(use signals) ;; needs signal, deref, reset!, swap!, computed\n(use web-signals) ;; needs resource, emit-event, on-event\n\n(defisland ~demo ()\n (let ((data (resource (fn () (promise-delayed 1000 42)))))\n (div (deref data))))"))
(p (code "use") " is purely declarative — it doesn't load anything. The glob loader still loads all " (code ".sx") " files. The declaration documents intent and enables static checking."))
(~docs/section :title "What use enables" :id "what-it-enables"
(h4 (~tw :tokens "font-semibold text-stone-700 mt-6 mb-2") "Dependency visibility")
(p "The " (code "sx_deps") " tool reports both referenced symbols and declared modules. If a file references " (code "resource") " but doesn't " (code "(use web-signals)") ", the tool flags the gap.")
(h4 (~tw :tokens "font-semibold text-stone-700 mt-6 mb-2") "Build pipeline validation")
(p "The " (code "sx_build_manifest") " tool shows which modules are in the current build. Cross-referencing with " (code "use") " declarations catches missing build modules — exactly the bug that caused the " (code "resource") " island hydration failure.")
(h4 (~tw :tokens "font-semibold text-stone-700 mt-6 mb-2") "Documentation")
(p "For humans and LLMs reading a file: " (code "use") " declarations immediately show what the file depends on, without grep."))
(~docs/section :title "Semantics" :id "semantics"
(p (code "(use name)") " is a no-op at evaluation time. It does not:")
(ul (~tw :tokens "space-y-1 text-stone-600 ml-4")
(li "Load any files")
(li "Modify the environment")
(li "Affect evaluation order")
(li "Create any runtime cost"))
(p "It " (em "does") ":")
(ul (~tw :tokens "space-y-1 text-stone-600 ml-4")
(li "Appear in the parsed tree for static analysis")
(li "Get reported by " (code "sx_deps"))
(li "Enable future tooling (unused-import warnings, auto-import suggestions)")))))