Parser: catch/finally in on handlers, cmd terminators — 279/831 (34%)
- parse-cmd: catch/finally/end/else/otherwise are now terminators that stop parse-cmd-list (return nil from parse-cmd) - parse-on-feat: optional catch var handler / finally handler clauses after the command body, before 'end' - emit-on: scan-on passes catch-info/finally-info through recursion, wraps compiled body in (guard (var (true catch-body)) body) when catch clause is present - Runtime: hs-put! handles "start" (afterbegin) and "end" (beforeend) - Removed duplicate conformance-dev.sx (all 110 tests already in behavioral) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
(define
|
||||
scan-on
|
||||
(fn
|
||||
(items source filter every?)
|
||||
(items source filter every? catch-info finally-info)
|
||||
(cond
|
||||
((<= (len items) 1)
|
||||
(let
|
||||
@@ -69,7 +69,18 @@
|
||||
(let
|
||||
((target (if source (hs-to-sx source) (quote me))))
|
||||
(let
|
||||
((handler (list (quote fn) (list (quote event)) (hs-to-sx body))))
|
||||
((compiled-body (hs-to-sx body))
|
||||
(wrapped-body
|
||||
(if catch-info
|
||||
(let ((var (make-symbol (first catch-info)))
|
||||
(catch-body (hs-to-sx (nth catch-info 1))))
|
||||
(if finally-info
|
||||
(list (quote do) (list (quote guard) (list var (list true catch-body)) compiled-body) (hs-to-sx finally-info))
|
||||
(list (quote guard) (list var (list true catch-body)) compiled-body)))
|
||||
(if finally-info
|
||||
(list (quote do) compiled-body (hs-to-sx finally-info))
|
||||
compiled-body)))
|
||||
(handler (list (quote fn) (list (quote event)) wrapped-body)))
|
||||
(if
|
||||
every?
|
||||
(list
|
||||
@@ -83,17 +94,25 @@
|
||||
(rest (rest items))
|
||||
(nth items 1)
|
||||
filter
|
||||
every?))
|
||||
every?
|
||||
catch-info
|
||||
finally-info))
|
||||
((= (first items) :filter)
|
||||
(scan-on
|
||||
(rest (rest items))
|
||||
source
|
||||
(nth items 1)
|
||||
every?))
|
||||
every?
|
||||
catch-info
|
||||
finally-info))
|
||||
((= (first items) :every)
|
||||
(scan-on (rest (rest items)) source filter true))
|
||||
(true (scan-on (rest items) source filter every?)))))
|
||||
(scan-on (rest parts) nil nil false)))))
|
||||
(scan-on (rest (rest items)) source filter true catch-info finally-info))
|
||||
((= (first items) :catch)
|
||||
(scan-on (rest (rest items)) source filter every? (nth items 1) finally-info))
|
||||
((= (first items) :finally)
|
||||
(scan-on (rest (rest items)) source filter every? catch-info (nth items 1)))
|
||||
(true (scan-on (rest items) source filter every? catch-info finally-info)))))
|
||||
(scan-on (rest parts) nil nil false nil nil)))))
|
||||
(define
|
||||
emit-send
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user