mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
fixing or patterns with different ids in branches
This commit is contained in:
parent
11852c6390
commit
dda71763a5
2 changed files with 3 additions and 1 deletions
|
@ -31,6 +31,7 @@
|
||||||
(test "or empty" 'ok (match '(o k) ((or) 'fail) (else 'ok)))
|
(test "or empty" 'ok (match '(o k) ((or) 'fail) (else 'ok)))
|
||||||
(test "or single" 'ok (match 'ok ((or x) 'ok)))
|
(test "or single" 'ok (match 'ok ((or x) 'ok)))
|
||||||
(test "or double" 'ok (match 'ok ((or (? symbol? y) y) y)))
|
(test "or double" 'ok (match 'ok ((or (? symbol? y) y) y)))
|
||||||
|
(test "or unbalanced" 1 (match 1 ((or (and 1 x) (and 2 y)) x)))
|
||||||
(test "not" 'ok (match 28 ((not (a . b)) 'ok)))
|
(test "not" 'ok (match 28 ((not (a . b)) 'ok)))
|
||||||
(test "pred" 'ok (match 28 ((? number?) 'ok)))
|
(test "pred" 'ok (match 28 ((? number?) 'ok)))
|
||||||
(test "named pred" 29 (match 28 ((? number? x) (+ x 1))))
|
(test "named pred" 29 (match 28 ((? number? x) (+ x 1))))
|
||||||
|
|
|
@ -531,7 +531,8 @@
|
||||||
(define-syntax match-gen-or
|
(define-syntax match-gen-or
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((_ v p g+s (sk ...) fk (i ...) ((id id-ls) ...))
|
((_ v p g+s (sk ...) fk (i ...) ((id id-ls) ...))
|
||||||
(let ((sk2 (lambda (id ...) (sk ... (i ... id ...)))))
|
(let ((sk2 (lambda (id ...) (sk ... (i ... id ...))))
|
||||||
|
(id (if #f #f)) ...)
|
||||||
(match-gen-or-step v p g+s (match-drop-ids (sk2 id ...)) fk (i ...))))))
|
(match-gen-or-step v p g+s (match-drop-ids (sk2 id ...)) fk (i ...))))))
|
||||||
|
|
||||||
(define-syntax match-gen-or-step
|
(define-syntax match-gen-or-step
|
||||||
|
|
Loading…
Add table
Reference in a new issue