Simplifying vaid-sre? to just call regexp.

This commit is contained in:
Alex Shinn 2014-05-18 10:36:48 +09:00
parent 52be1ce950
commit 05a4fbdbdc
2 changed files with 3 additions and 24 deletions

View file

@ -599,29 +599,7 @@
(every char-set-sre? (cdr sre))))))) (every char-set-sre? (cdr sre)))))))
(define (valid-sre? x) (define (valid-sre? x)
(or (regexp? x) (guard (exn (else #f)) (regexp x) #t))
(string? x)
(char-set-sre? x)
(and (pair? x)
(memq (car x)
'(|\|| or : seq $ submatch *$ submatch-list ? optional
* zero-or-more + one-or-more ?? non-greedy-optional
*? non-greedy-zero-or-more +? non-greedy-one-or-more
look-ahead neg-look-ahead look-behind neg-look-behind
w/case w/nocase w/unicode w/ascii word word+))
(every valid-sre? (cdr x)))
(and (pair? x)
(memq (car x)
'(>= -> => submatch-named *-> *=> submatch-named-list))
(pair? (cdr x))
(every valid-sre? (cddr x)))
(and (pair? x)
(memq (car x) '(** repeated **? non-greedy-repeated))
(pair? (cdr x))
(pair? (cddr x))
(or (not (cadr x)) (integer? (cadr x)))
(or (not (car (cddr x))) (integer? (car (cddr x))))
(every valid-sre? (cdr (cddr x))))))
(define (sre->char-set sre . o) (define (sre->char-set sre . o)
(let ((flags (if (pair? o) (car o) ~none))) (let ((flags (if (pair? o) (car o) ~none)))

View file

@ -11,7 +11,8 @@
;; Chibi's char-set library is more factored than SRFI-14. ;; Chibi's char-set library is more factored than SRFI-14.
(cond-expand (cond-expand
(chibi (chibi
(import (chibi) (srfi 9) (chibi char-set) (import (rename (chibi) (protect guard))
(srfi 9) (chibi char-set)
(chibi char-set full) (chibi char-set full)
(prefix (chibi char-set ascii) %))) (prefix (chibi char-set ascii) %)))
(else (else