Fixes bug in `cross' pattern handling

This commit is contained in:
Casey Klein 2011-04-05 13:48:26 -05:00
parent 6494bf863e
commit e8130a2fd1
2 changed files with 8 additions and 2 deletions

View File

@ -127,7 +127,7 @@
(let loop ([stx orig-stx]
[names null]
[depth 0])
(syntax-case stx (name in-hole side-condition)
(syntax-case stx (name in-hole side-condition cross)
[(name sym pat)
(identifier? (syntax sym))
(loop (syntax pat)
@ -139,6 +139,7 @@
depth)]
[(side-condition pat . rest)
(loop (syntax pat) names depth)]
[(cross _) names]
[(pat ...)
(let i-loop ([pats (syntax->list (syntax (pat ...)))]
[names names])

View File

@ -280,6 +280,12 @@
#:key (compose symbol->string bind-name)))
'())
'(1 4 3 2 5 "s" t s)))
(let ()
(define-language L
(e (e e) number))
;; not a syntax error since first e is not a binder
(test (pair? (redex-match L ((cross e) e ...) (term ((hole 2) 1)))) #t))
;; test caching
(let ()
@ -1489,7 +1495,6 @@
(e ((name x any) (name x any_2) ...)))
#rx"different depths"
2)
(test-syn-err (reduction-relation
grammar