fix bug in recent _!_ semantics change
This commit is contained in:
parent
69c96c628d
commit
f26a5b60d7
|
@ -682,6 +682,14 @@ See match-a-pattern.rkt for more details
|
||||||
(define table (make-hash))
|
(define table (make-hash))
|
||||||
(hash-set! mismatch-ht name table)
|
(hash-set! mismatch-ht name table)
|
||||||
(set! priors table))
|
(set! priors table))
|
||||||
|
(cond
|
||||||
|
[(equal? nesting-depth 'unknown-mismatch-depth)
|
||||||
|
(unless (null? exp)
|
||||||
|
(error 'matcher.rkt
|
||||||
|
(string-append "invariant broken; unknown-mismatch-depth should"
|
||||||
|
" appear only when the expression is an empty list: ~s")
|
||||||
|
exp))]
|
||||||
|
[else
|
||||||
(let loop ([depth nesting-depth]
|
(let loop ([depth nesting-depth]
|
||||||
[exp exp])
|
[exp exp])
|
||||||
(cond
|
(cond
|
||||||
|
@ -691,7 +699,7 @@ See match-a-pattern.rkt for more details
|
||||||
(hash-set! priors exp #t)]
|
(hash-set! priors exp #t)]
|
||||||
[else
|
[else
|
||||||
(for ([exp-ele (in-list exp)])
|
(for ([exp-ele (in-list exp)])
|
||||||
(loop (- depth 1) exp-ele))]))]))
|
(loop (- depth 1) exp-ele))]))])]))
|
||||||
(make-mtch
|
(make-mtch
|
||||||
(make-bindings (hash-map match-ht make-bind))
|
(make-bindings (hash-map match-ht make-bind))
|
||||||
(mtch-context match)
|
(mtch-context match)
|
||||||
|
|
|
@ -143,6 +143,9 @@
|
||||||
(repeat (mismatch-name number_!_1 number) #f #f))
|
(repeat (mismatch-name number_!_1 number) #f #f))
|
||||||
'((1 2) (3 4) 5 6)
|
'((1 2) (3 4) 5 6)
|
||||||
(list (make-test-mtch (make-bindings (list)) '((1 2) (3 4) 5 6) none)))
|
(list (make-test-mtch (make-bindings (list)) '((1 2) (3 4) 5 6) none)))
|
||||||
|
(test-empty '(list (repeat (mismatch-name number_!_1 number) #f #f))
|
||||||
|
'()
|
||||||
|
(list (make-test-mtch (make-bindings (list)) '() none)))
|
||||||
|
|
||||||
(test-empty '(list (repeat (name x_1 1) ..._1 ..._!_1)
|
(test-empty '(list (repeat (name x_1 1) ..._1 ..._!_1)
|
||||||
(repeat (name x_1 1) ..._1 #f)
|
(repeat (name x_1 1) ..._1 #f)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user