|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
(module stx mzscheme
|
|
|
|
|
#lang racket
|
|
|
|
|
|
|
|
|
|
(require "util.rkt"
|
|
|
|
|
syntax/id-table)
|
|
|
|
|
|
|
|
|
@ -24,9 +25,9 @@
|
|
|
|
|
#f
|
|
|
|
|
"not a char or single-char string"
|
|
|
|
|
containing-stx stx)))))
|
|
|
|
|
(test-block ()
|
|
|
|
|
((char-range-arg #'#\1 #'here) (char->integer #\1))
|
|
|
|
|
((char-range-arg #'"1" #'here) (char->integer #\1)))
|
|
|
|
|
(module+ test
|
|
|
|
|
(check-equal? (char-range-arg #'#\1 #'here) (char->integer #\1))
|
|
|
|
|
(check-equal? (char-range-arg #'"1" #'here) (char->integer #\1)))
|
|
|
|
|
|
|
|
|
|
(define orig-insp (variable-reference->module-declaration-inspector
|
|
|
|
|
(#%variable-reference)))
|
|
|
|
@ -170,41 +171,50 @@
|
|
|
|
|
(and (= 2 (length s-re)) (char-set? (cadr s-re))))
|
|
|
|
|
(else #f))))
|
|
|
|
|
(else #f)))
|
|
|
|
|
(test-block ()
|
|
|
|
|
((char-set? #\a) #t)
|
|
|
|
|
((char-set? "12") #f)
|
|
|
|
|
((char-set? "1") #t)
|
|
|
|
|
((char-set? '(repetition 1 2 #\1)) #f)
|
|
|
|
|
((char-set? '(repetition 1 1 "12")) #f)
|
|
|
|
|
((char-set? '(repetition 1 1 "1")) #t)
|
|
|
|
|
((char-set? '(union "1" "2" "3")) #t)
|
|
|
|
|
((char-set? '(union "1" "" "3")) #f)
|
|
|
|
|
((char-set? '(intersection "1" "2" (union "3" "4"))) #t)
|
|
|
|
|
((char-set? '(intersection "1" "")) #f)
|
|
|
|
|
((char-set? '(complement "1")) #f)
|
|
|
|
|
((char-set? '(concatenation "1" "2")) #f)
|
|
|
|
|
((char-set? '(concatenation "" "2")) #f)
|
|
|
|
|
((char-set? '(concatenation "1")) #t)
|
|
|
|
|
((char-set? '(concatenation "12")) #f)
|
|
|
|
|
((char-set? '(char-range #\1 #\2)) #t)
|
|
|
|
|
((char-set? '(char-complement #\1)) #t))
|
|
|
|
|
|
|
|
|
|
(test-block ()
|
|
|
|
|
((parse #'#\a) #\a)
|
|
|
|
|
((parse #'"1") "1")
|
|
|
|
|
((parse #'(repetition 1 1 #\1)) '(repetition 1 1 #\1))
|
|
|
|
|
((parse #'(repetition 0 +inf.0 #\1)) '(repetition 0 +inf.0 #\1))
|
|
|
|
|
((parse #'(union #\1 (union "2") (union)))
|
|
|
|
|
(module+ test
|
|
|
|
|
(require rackunit))
|
|
|
|
|
(module+ test
|
|
|
|
|
(check-equal? (char-set? #\a) #t)
|
|
|
|
|
(check-equal? (char-set? "12") #f)
|
|
|
|
|
(check-equal? (char-set? "1") #t)
|
|
|
|
|
(check-equal? (char-set? '(repetition 1 2 #\1)) #f)
|
|
|
|
|
(check-equal? (char-set? '(repetition 1 1 "12")) #f)
|
|
|
|
|
(check-equal? (char-set? '(repetition 1 1 "1")) #t)
|
|
|
|
|
(check-equal? (char-set? '(union "1" "2" "3")) #t)
|
|
|
|
|
(check-equal? (char-set? '(union "1" "" "3")) #f)
|
|
|
|
|
(check-equal? (char-set? '(intersection "1" "2" (union "3" "4"))) #t)
|
|
|
|
|
(check-equal? (char-set? '(intersection "1" "")) #f)
|
|
|
|
|
(check-equal? (char-set? '(complement "1")) #f)
|
|
|
|
|
(check-equal? (char-set? '(concatenation "1" "2")) #f)
|
|
|
|
|
(check-equal? (char-set? '(concatenation "" "2")) #f)
|
|
|
|
|
(check-equal? (char-set? '(concatenation "1")) #t)
|
|
|
|
|
(check-equal? (char-set? '(concatenation "12")) #f)
|
|
|
|
|
(check-equal? (char-set? '(char-range #\1 #\2)) #t)
|
|
|
|
|
(check-equal? (char-set? '(char-complement #\1)) #t))
|
|
|
|
|
|
|
|
|
|
;; yikes... these test cases all have the wrong arity, now.
|
|
|
|
|
;; and by "now", I mean it's been broken since before we
|
|
|
|
|
;; moved to git.
|
|
|
|
|
(module+ test
|
|
|
|
|
(check-equal? (parse #'#\a null) #\a)
|
|
|
|
|
(check-equal? (parse #'"1" null) "1")
|
|
|
|
|
(check-equal? (parse #'(repetition 1 1 #\1) null)
|
|
|
|
|
'(repetition 1 1 #\1))
|
|
|
|
|
(check-equal? (parse #'(repetition 0 +inf.0 #\1) null) '(repetition 0 +inf.0 #\1))
|
|
|
|
|
(check-equal? (parse #'(union #\1 (union "2") (union)) null)
|
|
|
|
|
'(union #\1 (union "2") (union)))
|
|
|
|
|
((parse #'(intersection #\1 (intersection "2") (intersection)))
|
|
|
|
|
(check-equal? (parse #'(intersection #\1 (intersection "2") (intersection))
|
|
|
|
|
null)
|
|
|
|
|
'(intersection #\1 (intersection "2") (intersection)))
|
|
|
|
|
((parse #'(complement (union #\1 #\2)))
|
|
|
|
|
(check-equal? (parse #'(complement (union #\1 #\2))
|
|
|
|
|
null)
|
|
|
|
|
'(complement (union #\1 #\2)))
|
|
|
|
|
((parse #'(concatenation "1" "2" (concatenation)))
|
|
|
|
|
(check-equal? (parse #'(concatenation "1" "2" (concatenation)) null)
|
|
|
|
|
'(concatenation "1" "2" (concatenation)))
|
|
|
|
|
((parse #'(char-range "1" #\1)) '(char-range #\1 #\1))
|
|
|
|
|
((parse #'(char-range #\1 "1")) '(char-range #\1 #\1))
|
|
|
|
|
((parse #'(char-range "1" "3")) '(char-range #\1 #\3))
|
|
|
|
|
((parse #'(char-complement (union "1" "2")))
|
|
|
|
|
(check-equal? (parse #'(char-range "1" #\1) null) '(char-range #\1 #\1))
|
|
|
|
|
(check-equal? (parse #'(char-range #\1 "1") null) '(char-range #\1 #\1))
|
|
|
|
|
(check-equal? (parse #'(char-range "1" "3") null) '(char-range #\1 #\3))
|
|
|
|
|
(check-equal? (parse #'(char-complement (union "1" "2")) null)
|
|
|
|
|
'(char-complement (union "1" "2"))))
|
|
|
|
|
)
|
|
|
|
|
; )
|
|
|
|
|