syntax/parse: fix handling of ~seq with action patterns
This commit is contained in:
parent
2a1404f9a3
commit
685d067361
|
@ -1043,3 +1043,14 @@
|
|||
(syntax-parse #'#f
|
||||
[_:indirect-bad #t]
|
||||
[_ #f])))))
|
||||
|
||||
;; from turnstile, action pattern in ~seq (6/2019)
|
||||
(let ()
|
||||
;; The regression required the following circumstances:
|
||||
;; - the action pattern must be able to fail, so subsequent pattern gets an ORD frame
|
||||
;; - the ~seq cannot be inlined away, like (a (~seq b c) d) => (a b c d), so use ~or
|
||||
(convert-syntax-error
|
||||
(syntax-parse #'(m 1 2 3)
|
||||
[(_ (~or (~seq a b c (~parse (d e f) #'(a b c)))
|
||||
(~seq x:id ...)))
|
||||
(void)])))
|
||||
|
|
|
@ -1392,6 +1392,10 @@
|
|||
[(pat:action ap sp) (pat:action ap (loop sp))]
|
||||
[(pat:head hp tp) (pat:head hp (loop tp))]
|
||||
[(pat:dots hs tp) (pat:dots hs (loop tp))]
|
||||
[(pat:ord sp group index)
|
||||
;; This is awkward, but it is needed to pop the ORD progress frame on success.
|
||||
(define sp* (list-pattern-replace-end sp (pat:seq-end)))
|
||||
(pat:head (hpat:ord (hpat:seq sp*) group index) endp)]
|
||||
[(pat:pair hp tp) (pat:pair hp (loop tp))])))
|
||||
|
||||
;; ----------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user