Improving performance of first case in UTF8 validation grammar.

This commit is contained in:
Thomas Hintz 2014-10-18 09:55:48 -07:00
parent 3692bbba77
commit ecafa799d3
1 changed files with 3 additions and 5 deletions

View File

@ -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