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>
22 lines
717 B
Plaintext
22 lines
717 B
Plaintext
(define spec-explore-define
|
|
:effects (io)
|
|
(fn
|
|
(filename def-name)
|
|
(let
|
|
((source (helper "read-spec-file" filename)))
|
|
(if
|
|
(starts-with? source ";; spec file not found")
|
|
nil
|
|
(let
|
|
((forms (sx-parse source)) (found nil))
|
|
(for-each
|
|
(fn
|
|
(form)
|
|
(when
|
|
(and (not found) (list? form) (> (len form) 1))
|
|
(let
|
|
((name (spec-form-name form)))
|
|
(when (= name def-name) (set! found {:kind (spec-form-kind form) :effects (spec-form-effects form) :params (spec-form-params form) :source (serialize form) :name name})))))
|
|
forms)
|
|
found)))))
|