[regexp] fail on starred groups

This commit is contained in:
ben 2016-03-12 09:36:39 -05:00
parent 5bd4c6d957
commit 8687fb3481
2 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,10 @@
(loop (+ i 1) (cons i in-paren) num-groups))]
[(#\))
(cond
[(and (< i last-index)
(eq? #\* (string-ref str (+ i 1))))
;; Group is starred, can't predict num. matches statically
#f]
[(null? in-paren)
(group-error str (format "')' at index ~a" i))]
[(eq? #f (car in-paren))

View File

@ -42,4 +42,7 @@
;; --- Can't handle |, yet
(ann (regexp-match: "this(group)|that" "that")
(U #f (List String String)))
;; --- can't handle starred groups
(ann (regexp-match: "(a)*(b)" "b")
(U #f (List String String)))
))