syntax/parse: fix struct match patterns with wrong number of subpatterns
This commit is contained in:
parent
31519f827a
commit
15186ff41c
|
@ -75,6 +75,8 @@
|
|||
[accessors (reverse (list-ref si 3))])
|
||||
(unless (andmap identifier? accessors)
|
||||
(raise-syntax-error #f "struct has incomplete information" #'S))
|
||||
(unless (= (length accessors) (length (syntax->list #'(p ...))))
|
||||
(raise-syntax-error #f "struct pattern has incorrect number of subpatterns" #'S))
|
||||
(with-syntax ([predicate predicate]
|
||||
[(accessor ...) accessors])
|
||||
#'(if (predicate x)
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
(equal? tail (pat:datum '())))]
|
||||
[(pat:and patterns)
|
||||
(andmap pattern-factorable? patterns)]
|
||||
[(pat:or patterns) #f]
|
||||
[(pat:or _ patterns _) #f]
|
||||
[(pat:not pattern) #f] ;; FIXME: ?
|
||||
[(pat:pair head tail)
|
||||
(and (pattern-factorable? head)
|
||||
|
@ -217,7 +217,7 @@
|
|||
(pattern-factorable? inner)]
|
||||
[(hpat:commit inner) #t]
|
||||
;; ----
|
||||
[(ehpat head repc)
|
||||
[(ehpat _ head repc _)
|
||||
(and (equal? repc #f)
|
||||
(pattern-factorable? head))]
|
||||
;; ----
|
||||
|
|
|
@ -352,7 +352,7 @@ A RepConstraint is one of
|
|||
[(pat:ord sp _ _) (pattern-has-cut? sp)]
|
||||
[(pat:post sp) (pattern-has-cut? sp)]
|
||||
[(pat:integrated name _ _ _) #f]
|
||||
[(pat:fixup _ _ _ _ _ _) #t]
|
||||
[(pat:fixup _ _ _ _ _ _ _) #t]
|
||||
[(pat:and/fixup _ ps) (ormap pattern-has-cut? ps)]
|
||||
|
||||
;; -- A patterns
|
||||
|
|
Loading…
Reference in New Issue
Block a user