summaryrefslogtreecommitdiff
path: root/modules/language/python/module/re/compile.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/module/re/compile.scm')
-rw-r--r--modules/language/python/module/re/compile.scm20
1 files changed, 15 insertions, 5 deletions
diff --git a/modules/language/python/module/re/compile.scm b/modules/language/python/module/re/compile.scm
index d23ea71..ac2fad5 100644
--- a/modules/language/python/module/re/compile.scm
+++ b/modules/language/python/module/re/compile.scm
@@ -450,13 +450,23 @@
((#:bracket not ch ...)
(let ((f (apply f-or!
(map (lambda (x)
+ (define (test x y)
+ (let ((a (char->integer
+ (string-ref x 0)))
+ (b (char->integer
+ (string-ref y 0))))
+ (lambda (x)
+ (and (<= a x) (>= b x)))))
+
(match x
- ((#:range ch1 ch2)
- (if (and (<= (char->integer ch1) 10)
- (>= (char->integer ch2) 10))
+ ((#:range ch1 ch2)
+ (if (and (<= (char->integer
+ (string-ref ch1 0)) 10)
+ (>= (char->integer
+ (string-ref ch2 0)) 10))
(f-or! f-nl!
- (f-reg! (format #f "[~a-~a]" ch1 ch2)))
- (f-reg! (format #f "[~a-~a]" ch1 ch2))))
+ (f-test! (test ch1 ch2)))
+ (f-test! (test ch1 ch2))))
((#:ch (#:class ch))
(get-class ch))
((#:ch ch)