summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hintz <t@thintz.com>2014-10-18 09:55:48 -0700
committerThomas Hintz <t@thintz.com>2014-10-18 09:55:48 -0700
commitecafa799d37688e4bf74d350a27ca04711d5ef96 (patch)
tree15e8a229ae85567e2e8fcc482d97e46b0ecc636e
parent3692bbba775f93df6449a812e6a514d429717bc4 (diff)
downloadwebsockets-ecafa799d37688e4bf74d350a27ca04711d5ef96.tar.gz
Improving performance of first case in UTF8 validation grammar.
-rw-r--r--utf8-grammar.scm8
1 files changed, 3 insertions, 5 deletions
diff --git a/utf8-grammar.scm b/utf8-grammar.scm
index ec266ae..7d8b277 100644
--- a/utf8-grammar.scm
+++ b/utf8-grammar.scm
@@ -1,7 +1,3 @@
-(import chicken scheme)
-(use srfi-4 srfi-13 srfi-14 comparse)
-
-
(define (ucs-range->char-set/inclusive lower upper)
(ucs-range->char-set lower (add1 upper)))
@@ -9,7 +5,9 @@
(in (ucs-range->char-set/inclusive #x80 #xBF)))
(define utf8-1
- (in (ucs-range->char-set/inclusive #x00 #x7F)))
+ (satisfies (lambda (c) (or (< (char->integer c) 128)
+ (and (> (char->integer c) 128)
+ (< (char->integer c) 191))))))
(define utf8-2
(sequence