|
|
@ -109,15 +109,17 @@
|
|
|
|
[(inferred-id NAME repeat) SUB-PAT ...]
|
|
|
|
[(inferred-id NAME repeat) SUB-PAT ...]
|
|
|
|
MIN-REPEAT-SUB-PATS)
|
|
|
|
MIN-REPEAT-SUB-PATS)
|
|
|
|
inferred-rules)))]
|
|
|
|
inferred-rules)))]
|
|
|
|
|
|
|
|
|
|
|
|
[(repeat MIN MAX SUB-PAT)
|
|
|
|
[(repeat MIN MAX SUB-PAT)
|
|
|
|
;; finite repeat
|
|
|
|
;; finite repeat
|
|
|
|
(let ([min (syntax-e #'MIN)]
|
|
|
|
(begin
|
|
|
|
[max (syntax-e #'MAX)])
|
|
|
|
(define min (syntax-e #'MIN))
|
|
|
|
(recur
|
|
|
|
(define max (syntax-e #'MAX))
|
|
|
|
(with-syntax ([(MIN-SUBPAT ...) (make-list min #'SUB-PAT)]
|
|
|
|
(define new-rule-stx (with-syntax ([(MIN-SUBPAT ...) (make-list min #'SUB-PAT)]
|
|
|
|
[(EXTRA-SUBPAT ...) (make-list (- max min) #'SUB-PAT)])
|
|
|
|
[(EXTRA-SUBPAT ...) (make-list (- max min) #'SUB-PAT)])
|
|
|
|
#'(rule NAME (seq MIN-SUBPAT ... (maybe EXTRA-SUBPAT) ...)))
|
|
|
|
;; has to keep the same name to work correctly
|
|
|
|
#f))]
|
|
|
|
#'(rule NAME (seq MIN-SUBPAT ... (maybe EXTRA-SUBPAT) ...))))
|
|
|
|
|
|
|
|
(recur new-rule-stx #f))]
|
|
|
|
|
|
|
|
|
|
|
|
[(maybe SUB-PAT)
|
|
|
|
[(maybe SUB-PAT)
|
|
|
|
(begin
|
|
|
|
(begin
|
|
|
|