|
|
|
@ -168,18 +168,20 @@
|
|
|
|
|
[(list all min range? max) (let* ([min (if min (string->number min) 0)]
|
|
|
|
|
[max (cond
|
|
|
|
|
[(and range? max) (string->number max)]
|
|
|
|
|
[(and (not range?) (not max)) min] ; {3} -> {3,3}
|
|
|
|
|
[else #f])])
|
|
|
|
|
(cons min max))]))]
|
|
|
|
|
[else (raise-argument-error 'grammar-parse "unknown repetition operator" $2)]))
|
|
|
|
|
(pattern-repeat (position->pos $1-start-pos)
|
|
|
|
|
[(and (not range?) (not max)) (if (zero? min)
|
|
|
|
|
#f ; {} -> {0,}
|
|
|
|
|
min))] ; {3} -> {3,3}
|
|
|
|
|
[else #f])])
|
|
|
|
|
(cons min max))]))]
|
|
|
|
|
[else (raise-argument-error 'grammar-parse "unknown repetition operator" $2)]))
|
|
|
|
|
(pattern-repeat (position->pos $1-start-pos)
|
|
|
|
|
(position->pos $2-end-pos)
|
|
|
|
|
min-repeat max-repeat $1
|
|
|
|
|
#f))]
|
|
|
|
|
[(atomic-pattern)
|
|
|
|
|
[(atomic-pattern)
|
|
|
|
|
$1]]
|
|
|
|
|
|
|
|
|
|
[atomic-pattern
|
|
|
|
|
[atomic-pattern
|
|
|
|
|
[(LIT)
|
|
|
|
|
(pattern-lit (position->pos $1-start-pos)
|
|
|
|
|
(position->pos $1-end-pos)
|
|
|
|
@ -220,7 +222,7 @@
|
|
|
|
|
'splice))]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(error (lambda (tok-ok? tok-name tok-value start-pos end-pos)
|
|
|
|
|
(error (lambda (tok-ok? tok-name tok-value start-pos end-pos)
|
|
|
|
|
((current-parser-error-handler) tok-ok? tok-name tok-value (position->pos start-pos) (position->pos end-pos))))))
|
|
|
|
|
|
|
|
|
|
;; relocate-pattern: pattern -> pattern
|
|
|
|
|