1 ;;; xsd-regexp.el --- translate W3C XML Schema regexps to Emacs regexps
3 ;; Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc.
6 ;; Keywords: XML, regexp
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;; This handles the regular expressions in the syntax defined by:
26 ;; W3C XML Schema Part 2: Datatypes
27 ;; <http://www.w3.org/TR/xmlschema-2/#regexs>
29 ;; The main entry point is `xsdre-translate'.
31 ;; The features of XSD regexps that make this non-trivial are:
33 ;; - \p{PROP} escape for matching characters that have various
34 ;; Unicode-defined properties
35 ;; - character class subtraction:, e.g. [\p{L}-[abc]] matches
36 ;; any character in the L category other than a, b and c.
38 ;; We compute the set of Unicode characters denoted by each XSD
39 ;; char-class as a list of ranges. The regexp generated for a
40 ;; single escape can be large (several thousand characters).
42 ;; XSD has non-traditional rules about when characters must be
43 ;; and can be quoted with \. These are quite different from
46 ;; The semantics of XSD regexps are defined in terms of Unicode.
47 ;; Non-Unicode characters are not allowed in regular expressions and
48 ;; will not match against the generated regular expressions. A
49 ;; Unicode character means a character in one of the Mule charsets
50 ;; ascii, latin-iso8859-1, mule-unicode-0100-24ff,
51 ;; mule-unicode-2500-33ff, mule-unicode-e000-ffff, eight-bit-control
52 ;; or a character translatable to such a character (i.e a character
53 ;; for which `encode-char' will return non-nil).
55 ;; Using unify-8859-on-decoding-mode is probably a good idea here
56 ;; (and generally with XML and other Unicode-oriented formats).
58 ;; Unfortunately, this means that this package is currently useless
59 ;; for CJK characters, since there's no mule-unicode charset for the
60 ;; CJK ranges of Unicode. We should devise a workaround for this
61 ;; until the fabled Unicode version of Emacs makes an appearance.
65 (defun xsdre-translate (regexp)
66 "Translate a W3C XML Schema Datatypes regexp to an Emacs regexp.
67 Returns a string. REGEXP is a string. If REGEXP is not a valid XSD
68 regexp, signal an `xsdre-invalid-regexp' condition."
70 (xsdre-to-symbolic regexp
)))
72 (defvar xsdre-test-history nil
)
74 (defun xsdre-test-regexp ()
77 (let* ((str (read-from-minibuffer "Regexp: "
83 (xsdre-to-symbolic str
)))
84 (with-output-to-temp-buffer "*XSD Regexp Test*"
85 (princ "XSD regexp: ")
92 (princ "Emacs regexp: ")
93 (princ (xsdre-from-symbolic symbolic
)))
98 (defsubst xsdre-make-range
(first last
)
99 "Return a representation of a range of integers.
100 If the range contains a single integer, it is represented by that integer.
101 Otherwise, it is represented by a (FIRST . LAST) pair."
106 (defsubst xsdre-range-first
(r)
107 "Return the first integer in a range."
108 (if (consp r
) (car r
) r
))
110 (defsubst xsdre-range-last
(r)
111 "Return the last integer in a range."
112 (if (consp r
) (cdr r
) r
))
114 (defun xsdre-make-range-list (list)
115 "Make a range-list from a list of ranges.
116 A range-list represents a set of integers by a list of ranges in a
117 canonical form, in which ranges are in increasing order, and adjacent
118 ranges are merged wherever possible."
121 (sort list
'xsdre-range-less-than
))
122 (let* ((next (cdr list
))
125 (first (xsdre-range-first head
))
126 (last (xsdre-range-last head
)))
128 (setq head
(car next
))
129 (when (> (xsdre-range-last head
) last
)
130 (if (<= (xsdre-range-first head
) (1+ last
))
131 (setq last
(xsdre-range-last head
))
132 (setcar tail
(xsdre-make-range first last
))
135 (setq first
(xsdre-range-first head
))
136 (setq last
(xsdre-range-last head
))))
137 (setq next
(cdr next
)))
138 (setcar tail
(xsdre-make-range first last
))
143 (defun xsdre-range-list-union (range-lists)
144 "Return a range-list, the union of a list of range-lists."
145 (xsdre-make-range-list (apply 'append range-lists
)))
147 (defun xsdre-range-list-difference (orig subtract
)
148 "Return a range-list for the difference of two range-lists."
150 (let (new head next first last
)
152 (setq head
(car orig
))
153 (setq first
(xsdre-range-first head
))
154 (setq last
(xsdre-range-last head
))
156 (< (xsdre-range-last (car subtract
)) first
))
157 (setq subtract
(cdr subtract
)))
160 (<= (xsdre-range-first (car subtract
)) last
))
161 (when (< first
(xsdre-range-first (car subtract
)))
163 (cons (xsdre-make-range
165 (1- (xsdre-range-first (car subtract
))))
167 (if (< (xsdre-range-last (car subtract
)) last
)
169 (setq first
(1+ (xsdre-range-last (car subtract
))))
170 (setq subtract
(cdr subtract
)))
171 (setq first
(1+ last
))))
172 (when (<= first last
)
173 (setq new
(cons (xsdre-make-range first last
) new
)))
174 (setq orig
(cdr orig
)))
177 (defun xsdre-range-less-than (r1 r2
)
178 "Return non-nil if range R1 is less than range R2."
179 (or (< (xsdre-range-first r1
) (xsdre-range-first r2
))
180 (and (= (xsdre-range-first r1
) (xsdre-range-first r2
))
181 (< (xsdre-range-last r1
) (xsdre-range-last r2
)))))
183 (defun xsdre-check-range-list (range-list)
184 "Check that RANGE-LIST is a range-list.
185 Signal an error if it is not."
188 (unless (consp range-list
)
189 (error "Range list not a list"))
190 (let ((head (car range-list
)))
191 (unless (or (integerp head
)
193 (integerp (car head
))
194 (integerp (cdr head
))))
195 (error "Bad range %s" head
))
197 (not (< (1+ last
) (xsdre-range-first head
))))
198 (error "Ranges not strictly increasing"))
199 (setq last
(xsdre-range-last head
)))
200 (setq range-list
(cdr range-list
))))
203 ;;; Compiling symbolic regexps to Emacs regexps
205 (defun xsdre-from-symbolic (re)
206 "Return an Emacs regexp for the symbolic regexp RE."
208 (nreverse (xsdre-compile-regexp re nil
))))
210 (defun xsdre-compile-regexp (re accum
)
211 "Return a Emacs regular expression for the symbolic regexp RE.
212 Returns a list of strings whose head is the regexp for RE
213 and whose tail is ACCUM."
214 (cond ((not (consp re
))
215 (xsdre-compile-char-class re accum
))
216 ((eq (car re
) 'choice
)
217 (setq accum
(cons "\\(?:" accum
))
218 (let ((choices (cdr re
)))
221 (xsdre-compile-regexp (car choices
)
223 (setq choices
(cdr choices
))
226 (cons "\\|" accum
)))))
228 ((eq (car re
) 'sequence
)
229 (let ((members (cdr re
)))
231 (setq accum
(xsdre-compile-regexp (car members
)
233 (setq members
(cdr members
))))
235 ((eq (car re
) 'repeat
)
236 (let* ((sub (nth 1 re
))
239 (need-paren (and (consp sub
)
240 (eq (car sub
) 'sequence
))))
242 (setq accum
(cons "\\(?:" accum
)))
244 (xsdre-compile-regexp sub accum
))
246 (setq accum
(cons "\\)" accum
)))
254 (number-to-string lower
)
259 (number-to-string lower
)
262 ((and (eq lower
0) (eq upper
1))
266 (number-to-string lower
)
268 (number-to-string upper
)
271 (t (xsdre-compile-char-class re accum
))))
273 (defun xsdre-compile-char-class (cc accum
)
274 "Return a Emacs regular expression for the symbolic character class CC.
275 Returns a list of strings whose head is the regexp for CC
276 and whose tail is ACCUM."
277 (cons (if (integerp cc
)
278 (xsdre-compile-single-char cc
)
279 (let ((ranges (xsdre-range-list-mule-intersection
280 (xsdre-char-class-to-range-list cc
))))
281 (cond ((null ranges
) "\001-\000")
282 ((and (null (cdr ranges
))
283 (= (xsdre-range-first (car ranges
))
284 (xsdre-range-last (car ranges
))))
285 (xsdre-compile-single-char
286 (xsdre-range-first (car ranges
))))
287 (t (xsdre-range-list-to-char-alternative ranges
)))))
290 (defun xsdre-compile-single-char (ch)
291 (if (memq ch
'(?. ?
* ?
+ ?? ?\
[ ?\
] ?^ ?$ ?
\\))
293 (string (decode-char 'ucs ch
))))
295 (defun xsdre-char-class-to-range-list (cc)
296 "Return a range-list for a symbolic char-class CC."
297 (cond ((integerp cc
) (list cc
))
299 (or (get cc
'xsdre-ranges
)
300 (xsdre-char-class-to-range-list (get cc
'xsdre-char-class
))))
302 (if (= (car cc
) (cdr cc
))
305 ((eq (car cc
) 'union
)
306 (xsdre-range-list-union (mapcar 'xsdre-char-class-to-range-list
308 ((eq (car cc
) 'difference
)
309 (xsdre-range-list-difference
310 (xsdre-char-class-to-range-list (nth 1 cc
))
311 (xsdre-char-class-to-range-list (nth 2 cc
))))
312 ((eq (car cc
) 'range
)
313 (list (xsdre-make-range (nth 1 cc
) (nth 2 cc
))))
314 (t (error "Internal error in XSD regexp compilation: \
315 unknown char-class %s" cc
))))
317 (defconst xsdre-mule-char-set-ranges
324 "List of ranges for the Mule character sets containing Unicode characters.")
326 (defun xsdre-range-list-mule-intersection (range-list)
327 "Return the intersection of RANGE-LIST with the mule-supported ranges.
328 Also split ranges so that no range spans more that one mule charset."
330 (let* ((char-set-ranges (cdr xsdre-mule-char-set-ranges
))
332 (char-set-first (caar xsdre-mule-char-set-ranges
))
333 (char-set-last (cdar xsdre-mule-char-set-ranges
))
334 (range (car range-list
))
335 (first (xsdre-range-first range
))
336 (last (xsdre-range-last range
)))
337 (setq range-list
(cdr range-list
))
339 (cond ((> first last
)
340 (if (null range-list
)
342 (setq range
(car range-list
))
343 (setq first
(xsdre-range-first range
))
344 (setq last
(xsdre-range-last range
))
345 (setq range-list
(cdr range-list
))
347 ((< char-set-last first
)
348 (if (null char-set-ranges
)
350 (setq char-set-first
(caar char-set-ranges
))
351 (setq char-set-last
(cdar char-set-ranges
))
352 (setq char-set-ranges
(cdr char-set-ranges
))
354 ((< first char-set-first
)
355 (setq first char-set-first
))
358 ;; first <= char-set-last
359 ;; first >= char-set-first
360 ((<= last char-set-last
)
362 (cons (xsdre-make-range first last
)
364 (setq first
(1+ last
))
368 (cons (xsdre-make-range first char-set-last
)
370 (setq first
(1+ char-set-last
))
372 (nreverse mule-ranges
))))
374 (defun xsdre-range-list-to-char-alternative (range-list)
375 "Return a char alternative for a range-list.
376 RANGE-LIST must contain more than integer.
377 The char alternative is a string containing an Emacs regexp
378 consisting of a single char alternative delimited with []."
379 (let (range caret close-bracket hyphen chars first last
)
381 (setq range
(car range-list
))
382 (setq first
(xsdre-range-first range
))
383 (setq last
(xsdre-range-last range
))
384 (while (and (cond ((eq first ?^
)
386 (setq first
(1+ first
)))
389 (setq first
(1+ first
)))
391 (setq close-bracket t
)
392 (setq first
(1+ first
))))
394 (when (<= first last
)
399 (if (and (eq last
(1+ first
))
402 (cons last
(cons ?- chars
))))))
403 (setq range-list
(cdr range-list
)))
406 (decode-char 'ucs c
))
409 (setq chars
(cons ?^ chars
)))
411 (setq chars
(cons ?- chars
)))
412 (setq chars
(cons ?\
] chars
))
413 (setq chars
(nreverse chars
))
415 (setq chars
(cons ?\
] chars
)))
416 (when (equal chars
'(?^ ?- ?\
]))
417 (setq chars
'(?- ?^ ?\
])))
418 (setq chars
(cons ?\
[ chars
))
419 (apply 'string chars
)))
423 (defvar xsdre-current-regexp nil
424 "List of characters remaining to be parsed. Dynamically bound.")
426 (defun xsdre-to-symbolic (str)
427 "Convert a W3C XML Schema datatypes regexp to a symbolic form.
429 The symbolic form has the following structure:
432 (sequence REGEXP ...)
433 | (choice REGEXP ...)
434 | (repeat REGEXP MIN MAX)
439 | SYMBOLIC-CHAR-CLASS
441 | (union CHAR-CLASS ...)
442 | (difference CHAR-CLASS CHAR-CLASS)
444 RANGE ::= (range LOWER UPPER)
447 MAX ::= INTEGER | nil
451 SYMBOLIC-CHAR-CLASS ::= SYMBOL
453 where UNICODE is a integer specifying a Unicode code-point and
454 SYMBOLIC-CHAR-CLASS is a symbol which has either a `xsdre-char-class'
455 property whose value is a CHAR-CLASS, or a `xsdre-ranges' property
456 whose value is a range-list."
457 (let ((xsdre-current-regexp (string-to-list str
)))
459 (let ((symbolic (xsdre-parse-regexp)))
460 (if xsdre-current-regexp
461 (xsdre-parse-error "Unexpected %c" (car xsdre-current-regexp
))
464 (signal 'xsdre-invalid-regexp
465 (list (apply 'format
(cdr err
))
467 (length xsdre-current-regexp
))))))))
469 (define-error 'xsdre-invalid-regexp
470 "Invalid W3C XML Schema Datatypes regular expression")
472 (defun xsdre-parse-regexp ()
473 (let ((branches nil
))
475 (setq branches
(cons (xsdre-parse-branch) branches
))
476 (when (eq (car xsdre-current-regexp
) ?|
)
479 (if (null (cdr branches
))
481 (cons 'choice
(nreverse branches
)))))
483 (defun xsdre-parse-branch ()
485 (while (let ((item (xsdre-try-parse-atom)))
487 (let ((quantifier (xsdre-try-parse-quantifier)))
494 (setq items
(cons item items
)))))
495 (cond ((null items
) '(sequence))
496 ((null (cdr items
)) (car items
))
497 (t (cons 'sequence
(nreverse items
))))))
499 (defun xsdre-try-parse-quantifier ()
500 (let ((ch (car xsdre-current-regexp
)))
501 (cond ((eq ch ?
*) (xsdre-advance) '(0 . nil
))
502 ((eq ch ?
+) (xsdre-advance) '(1 . nil
))
503 ((eq ch ??
) (xsdre-advance) '(0 .
1))
506 (let ((lower (xsdre-parse-bound)))
507 (setq ch
(car xsdre-current-regexp
))
513 (cond ((eq (car xsdre-current-regexp
) ?
})
517 (let ((upper (xsdre-parse-bound)))
519 (cons lower upper
)))))
520 (t (xsdre-parse-error "Expected , or }")))))
523 (defun xsdre-parse-bound ()
526 (let* ((ch (car xsdre-current-regexp
))
527 (digit (memq ch
'(?
9 ?
8 ?
7 ?
6 ?
5 ?
4 ?
3 ?
2 ?
1 ?
0))))
529 (xsdre-parse-error "Expected a digit"))
531 (length (cdr digit
)))))
533 (not (memq (car xsdre-current-regexp
) '(?
} ?
,)))))
537 (defun xsdre-try-parse-atom ()
538 (let ((ch (car xsdre-current-regexp
)))
539 (cond ((memq ch
'(nil ?? ?
* ?
+ ?\
) ?\
{ ?\
} ?| ?\
])) nil
)
542 (xsdre-parse-escape))
545 (let ((ret (xsdre-parse-regexp)))
549 (xsdre-parse-char-class))
554 (let ((uc (encode-char ch
'ucs
)))
556 (xsdre-parse-error "%c is not a Unicode character" ch
))
557 (xsdre-advance) uc
)))))
559 (defun xsdre-parse-char-class ()
561 (let (compl members ret
)
562 (when (eq (car xsdre-current-regexp
) ?^
)
565 (while (let ((member (xsdre-parse-char-class-member))
567 (cond ((eq (car xsdre-current-regexp
) ?\-
)
569 (cond ((eq (car xsdre-current-regexp
) ?\
[)
570 (setq members
(cons member members
))
572 ((not (integerp member
))
573 (xsdre-parse-error "Lower bound is not a single character"))
575 (encode-char member
'ucs
)))
576 (xsdre-parse-error "Lower bound %c is not a Unicode character"
579 (let ((upper (xsdre-parse-char-class-member)))
580 (unless (integerp upper
)
581 (xsdre-parse-error "Upper bound is not a single character"))
583 (encode-char upper
'ucs
))
584 (xsdre-parse-error "Upper bound %c is not a Unicode character" upper
))
586 (cons (list 'range uc1 uc2
)
588 (not (eq (car xsdre-current-regexp
) ?\
])))))
589 (t (setq members
(cons member members
))
590 (not (eq (car xsdre-current-regexp
) ?\
]))))))
591 (setq members
(nreverse members
))
592 (if (null (cdr members
))
593 (setq ret
(car members
))
594 (setq ret
(cons 'union members
)))
596 (setq ret
(list 'difference
'any ret
)))
597 (when (eq (car xsdre-current-regexp
) ?\
[)
599 (list 'difference ret
(xsdre-parse-char-class))))
603 (defun xsdre-parse-char-class-member ()
604 (let ((ch (car xsdre-current-regexp
)))
606 (xsdre-parse-error "Expected ]"))
609 (xsdre-parse-escape))
610 ((memq ch
'(?\
[ ?\
] ?-
))
611 (xsdre-parse-error "%c must be quoted in a character class" ch
))
612 (t (xsdre-advance) ch
))))
614 (defconst xsdre-single-escape
621 (defun xsdre-parse-escape ()
622 (let ((ch (car xsdre-current-regexp
)))
624 (cond ((memq ch
'(?
\\ ?| ?. ?- ?^ ?
* ?
+ ?
( ?
) ?
{ ?
} ?
[ ?
])) ch
)
628 ((cdr (assq ch xsdre-single-escape
)))
630 (cdr (assq (downcase ch
) xsdre-single-escape
))))
632 (list 'difference
'any positive
))))
633 ((eq ch ?p
) (xsdre-parse-prop))
634 ((eq ch ?P
) (list 'difference
'any
(xsdre-parse-prop)))
636 (xsdre-parse-error "Missing char after \\")
637 (xsdre-parse-error "Bad escape %c" ch
))))))
639 (defun xsdre-parse-prop ()
642 (while (not (eq (car xsdre-current-regexp
) ?\
}))
643 (unless xsdre-current-regexp
644 (xsdre-parse-error "Expected ?"))
645 (setq name
(cons (car xsdre-current-regexp
)
649 (setq name
(nreverse name
))
650 (cond ((null name
) (xsdre-parse-error "Empty property name"))
652 (let ((category (intern (string (car name
)))))
653 (unless (get category
'xsdre-unicode-category
)
654 (xsdre-parse-error "%s is not a category" category
))
657 (let ((category (intern (string (car name
) (cadr name
)))))
658 (unless (get category
'xsdre-unicode-category
)
659 (xsdre-parse-error "%s is not a category" category
))
661 ((not (and (eq (car name
) ?I
)
662 (eq (cadr name
) ?s
)))
663 (xsdre-parse-error "Block name does not start with Is"))
665 (let ((block (intern (apply 'string
(cddr name
)))))
666 (unless (get block
'xsdre-unicode-block
)
667 (xsdre-parse-error "%s is not a block name" block
))
670 (defun xsdre-expect (ch)
671 (if (eq (car xsdre-current-regexp
) ch
)
673 (xsdre-parse-error "Expected %c" ch
)))
675 (defun xsdre-advance ()
676 (setq xsdre-current-regexp
677 (cdr xsdre-current-regexp
)))
679 (defun xsdre-parse-error (&rest args
)
680 (signal 'xsdre-parse-error args
))
682 ;; This error condition is used only internally.
684 (define-error 'xsdre-parse-error
"Internal error in parsing XSD regexp")
686 ;;; Character class data
688 (put 'dot
'xsdre-char-class
'(difference any
(union #xA
#xD
)))
689 (put 'digit
'xsdre-char-class
'Nd
)
690 (put 'word
'xsdre-char-class
'(difference any
(union P Z C
)))
691 (put 'space
'xsdre-char-class
'(union #x9
#xA
#xD
#x20
))
692 (put 'any
'xsdre-ranges
'((#x0 .
#x10FFFF
)))
694 (defconst xsdre-gen-categories
695 '(Lu Ll Lt Lm Lo Mn Mc Me Nd Nl No Pc Pd
696 Ps Pe Pi Pf Po Zs Zl Zp Sm Sc Sk So Cc Cf Co
))
698 (defun xsdre-gen-categories (file)
699 "Use a UnicodeData file to generate code to initialize Unicode categories.
700 Code is inserted into the current buffer."
701 (interactive "fUnicodeData file: ")
702 (with-current-buffer (find-file-noselect file
)
703 (goto-char (point-min))
704 (mapc (lambda (x) (put x
'xsdre-ranges nil
)) xsdre-gen-categories
)
705 (while (re-search-forward "^\\([0-9A-Fa-f]*\\);[^;]*;\\([A-Z][a-z]\\);"
708 (let* ((sym (intern (match-string-no-properties 2)))
709 (code (string-to-number (match-string-no-properties 1)
711 (ranges (get sym
'xsdre-ranges
))
712 (last-range (car ranges
))
713 (forced-range (string= (buffer-substring-no-properties
714 (- (match-beginning 2) 6)
715 (1- (match-beginning 2)))
717 (cond ((and (integerp last-range
)
719 (eq code
(1+ last-range
))))
722 (cons (cons last-range code
)
724 ((and (consp last-range
)
726 (eq code
(1+ (cdr last-range
)))))
729 (cons (cons (car last-range
) code
)
732 (put sym
'xsdre-ranges
(cons code ranges
))))))
736 (nreverse (get x
'xsdre-ranges
)))
738 xsdre-gen-categories
))
740 (let ((start (point)))
741 (pp (list 'xsdre-def-primitive-category
743 (list 'quote
(get x
'xsdre-ranges
)))
748 (while (condition-case err
753 (when (and (< 70 (current-column))
754 (not (looking-at ")")))
756 (lisp-indent-line))))))
757 xsdre-gen-categories
))
759 (defun xsdre-def-primitive-category (sym ranges
)
760 (put sym
'xsdre-ranges ranges
)
761 (put sym
'xsdre-unicode-category t
))
765 (defun xsdre-def-block (sym ranges
)
766 (put sym
'xsdre-ranges ranges
)
767 (put sym
'xsdre-unicode-block t
))
769 (xsdre-def-block 'BasicLatin
'((#x0000 .
#x007F
)))
770 (xsdre-def-block 'Latin-1Supplement
'((#x0080 .
#x00FF
)))
771 (xsdre-def-block 'LatinExtended-A
'((#x0100 .
#x017F
)))
772 (xsdre-def-block 'LatinExtended-B
'((#x0180 .
#x024F
)))
773 (xsdre-def-block 'IPAExtensions
'((#x0250 .
#x02AF
)))
774 (xsdre-def-block 'SpacingModifierLetters
'((#x02B0 .
#x02FF
)))
775 (xsdre-def-block 'CombiningDiacriticalMarks
'((#x0300 .
#x036F
)))
776 (xsdre-def-block 'Greek
'((#x0370 .
#x03FF
)))
777 (xsdre-def-block 'Cyrillic
'((#x0400 .
#x04FF
)))
778 (xsdre-def-block 'Armenian
'((#x0530 .
#x058F
)))
779 (xsdre-def-block 'Hebrew
'((#x0590 .
#x05FF
)))
780 (xsdre-def-block 'Arabic
'((#x0600 .
#x06FF
)))
781 (xsdre-def-block 'Syriac
'((#x0700 .
#x074F
)))
782 (xsdre-def-block 'Thaana
'((#x0780 .
#x07BF
)))
783 (xsdre-def-block 'Devanagari
'((#x0900 .
#x097F
)))
784 (xsdre-def-block 'Bengali
'((#x0980 .
#x09FF
)))
785 (xsdre-def-block 'Gurmukhi
'((#x0A00 .
#x0A7F
)))
786 (xsdre-def-block 'Gujarati
'((#x0A80 .
#x0AFF
)))
787 (xsdre-def-block 'Oriya
'((#x0B00 .
#x0B7F
)))
788 (xsdre-def-block 'Tamil
'((#x0B80 .
#x0BFF
)))
789 (xsdre-def-block 'Telugu
'((#x0C00 .
#x0C7F
)))
790 (xsdre-def-block 'Kannada
'((#x0C80 .
#x0CFF
)))
791 (xsdre-def-block 'Malayalam
'((#x0D00 .
#x0D7F
)))
792 (xsdre-def-block 'Sinhala
'((#x0D80 .
#x0DFF
)))
793 (xsdre-def-block 'Thai
'((#x0E00 .
#x0E7F
)))
794 (xsdre-def-block 'Lao
'((#x0E80 .
#x0EFF
)))
795 (xsdre-def-block 'Tibetan
'((#x0F00 .
#x0FFF
)))
796 (xsdre-def-block 'Myanmar
'((#x1000 .
#x109F
)))
797 (xsdre-def-block 'Georgian
'((#x10A0 .
#x10FF
)))
798 (xsdre-def-block 'HangulJamo
'((#x1100 .
#x11FF
)))
799 (xsdre-def-block 'Ethiopic
'((#x1200 .
#x137F
)))
800 (xsdre-def-block 'Cherokee
'((#x13A0 .
#x13FF
)))
801 (xsdre-def-block 'UnifiedCanadianAboriginalSyllabics
'((#x1400 .
#x167F
)))
802 (xsdre-def-block 'Ogham
'((#x1680 .
#x169F
)))
803 (xsdre-def-block 'Runic
'((#x16A0 .
#x16FF
)))
804 (xsdre-def-block 'Khmer
'((#x1780 .
#x17FF
)))
805 (xsdre-def-block 'Mongolian
'((#x1800 .
#x18AF
)))
806 (xsdre-def-block 'LatinExtendedAdditional
'((#x1E00 .
#x1EFF
)))
807 (xsdre-def-block 'GreekExtended
'((#x1F00 .
#x1FFF
)))
808 (xsdre-def-block 'GeneralPunctuation
'((#x2000 .
#x206F
)))
809 (xsdre-def-block 'SuperscriptsandSubscripts
'((#x2070 .
#x209F
)))
810 (xsdre-def-block 'CurrencySymbols
'((#x20A0 .
#x20CF
)))
811 (xsdre-def-block 'CombiningMarksforSymbols
'((#x20D0 .
#x20FF
)))
812 (xsdre-def-block 'LetterlikeSymbols
'((#x2100 .
#x214F
)))
813 (xsdre-def-block 'NumberForms
'((#x2150 .
#x218F
)))
814 (xsdre-def-block 'Arrows
'((#x2190 .
#x21FF
)))
815 (xsdre-def-block 'MathematicalOperators
'((#x2200 .
#x22FF
)))
816 (xsdre-def-block 'MiscellaneousTechnical
'((#x2300 .
#x23FF
)))
817 (xsdre-def-block 'ControlPictures
'((#x2400 .
#x243F
)))
818 (xsdre-def-block 'OpticalCharacterRecognition
'((#x2440 .
#x245F
)))
819 (xsdre-def-block 'EnclosedAlphanumerics
'((#x2460 .
#x24FF
)))
820 (xsdre-def-block 'BoxDrawing
'((#x2500 .
#x257F
)))
821 (xsdre-def-block 'BlockElements
'((#x2580 .
#x259F
)))
822 (xsdre-def-block 'GeometricShapes
'((#x25A0 .
#x25FF
)))
823 (xsdre-def-block 'MiscellaneousSymbols
'((#x2600 .
#x26FF
)))
824 (xsdre-def-block 'Dingbats
'((#x2700 .
#x27BF
)))
825 (xsdre-def-block 'BraillePatterns
'((#x2800 .
#x28FF
)))
826 (xsdre-def-block 'CJKRadicalsSupplement
'((#x2E80 .
#x2EFF
)))
827 (xsdre-def-block 'KangxiRadicals
'((#x2F00 .
#x2FDF
)))
828 (xsdre-def-block 'IdeographicDescriptionCharacters
'((#x2FF0 .
#x2FFF
)))
829 (xsdre-def-block 'CJKSymbolsandPunctuation
'((#x3000 .
#x303F
)))
830 (xsdre-def-block 'Hiragana
'((#x3040 .
#x309F
)))
831 (xsdre-def-block 'Katakana
'((#x30A0 .
#x30FF
)))
832 (xsdre-def-block 'Bopomofo
'((#x3100 .
#x312F
)))
833 (xsdre-def-block 'HangulCompatibilityJamo
'((#x3130 .
#x318F
)))
834 (xsdre-def-block 'Kanbun
'((#x3190 .
#x319F
)))
835 (xsdre-def-block 'BopomofoExtended
'((#x31A0 .
#x31BF
)))
836 (xsdre-def-block 'EnclosedCJKLettersandMonths
'((#x3200 .
#x32FF
)))
837 (xsdre-def-block 'CJKCompatibility
'((#x3300 .
#x33FF
)))
838 (xsdre-def-block 'CJKUnifiedIdeographsExtensionA
'((#x3400 .
#x4DB5
)))
839 (xsdre-def-block 'CJKUnifiedIdeographs
'((#x4E00 .
#x9FFF
)))
840 (xsdre-def-block 'YiSyllables
'((#xA000 .
#xA48F
)))
841 (xsdre-def-block 'YiRadicals
'((#xA490 .
#xA4CF
)))
842 (xsdre-def-block 'HangulSyllables
'((#xAC00 .
#xD7A3
)))
843 ;;(xsdre-def-block 'HighSurrogates '((#xD800 . #xDB7F)))
844 ;;(xsdre-def-block 'HighPrivateUseSurrogates '((#xDB80 . #xDBFF)))
845 ;;(xsdre-def-block 'LowSurrogates '((#xDC00 . #xDFFF)))
846 (xsdre-def-block 'CJKCompatibilityIdeographs
'((#xF900 .
#xFAFF
)))
847 (xsdre-def-block 'AlphabeticPresentationForms
'((#xFB00 .
#xFB4F
)))
848 (xsdre-def-block 'ArabicPresentationForms-A
'((#xFB50 .
#xFDFF
)))
849 (xsdre-def-block 'CombiningHalfMarks
'((#xFE20 .
#xFE2F
)))
850 (xsdre-def-block 'CJKCompatibilityForms
'((#xFE30 .
#xFE4F
)))
851 (xsdre-def-block 'SmallFormVariants
'((#xFE50 .
#xFE6F
)))
852 (xsdre-def-block 'ArabicPresentationForms-B
'((#xFE70 .
#xFEFE
)))
853 (xsdre-def-block 'Specials
'((#xFEFF .
#xFEFF
)))
854 (xsdre-def-block 'HalfwidthandFullwidthForms
'((#xFF00 .
#xFFEF
)))
855 (xsdre-def-block 'Specials
'((#xFFF0 .
#xFFFD
)))
856 (xsdre-def-block 'OldItalic
'((#x10300 .
#x1032F
)))
857 (xsdre-def-block 'Gothic
'((#x10330 .
#x1034F
)))
858 (xsdre-def-block 'Deseret
'((#x10400 .
#x1044F
)))
859 (xsdre-def-block 'ByzantineMusicalSymbols
'((#x1D000 .
#x1D0FF
)))
860 (xsdre-def-block 'MusicalSymbols
'((#x1D100 .
#x1D1FF
)))
861 (xsdre-def-block 'MathematicalAlphanumericSymbols
'((#x1D400 .
#x1D7FF
)))
862 (xsdre-def-block 'CJKUnifiedIdeographsExtensionB
'((#x20000 .
#x2A6D6
)))
863 (xsdre-def-block 'CJKCompatibilityIdeographsSupplement
'((#x2F800 .
#x2FA1F
)))
864 (xsdre-def-block 'Tags
'((#xE0000 .
#xE007F
)))
865 (xsdre-def-block 'PrivateUse
'((#xE000 .
#xF8FF
)
867 (#x100000 .
#x10FFFD
)))
871 ;;; Derived categories
873 (defun xsdre-def-derived-category (sym char-class
)
874 (put sym
'xsdre-char-class char-class
)
875 (put sym
'xsdre-unicode-category t
))
877 (xsdre-def-derived-category 'L
'(union Lu Ll Lt Lm Lo
))
878 (xsdre-def-derived-category 'M
'(union Mn Mc Me
))
879 (xsdre-def-derived-category 'N
'(union Nd Nl No
))
880 (xsdre-def-derived-category 'P
'(union Pc Pd Ps Pe Pi Pf Po
))
881 (xsdre-def-derived-category 'Z
'(union Zs Zl Zp
))
882 (xsdre-def-derived-category 'S
'(union Sm Sc Sk So
))
883 (xsdre-def-derived-category 'C
'(union Cc Cf Co Cn
))
884 (xsdre-def-derived-category 'Cn
'(difference any
885 (union L M N P Z S Cc Cf Co
)))
887 (xsdre-def-primitive-category
1096 (xsdre-def-derived-category 'name-continue
'(union name-initial
1097 name-continue-not-initial
))
1099 (xsdre-def-primitive-category
1100 'name-continue-not-initial
1218 ;;; Auto-generated section.
1220 ;; The rest of the file was auto-generated by doing M-x xsdre-gen-categories
1221 ;; on UnicodeData-3.1.0.txt available from
1222 ;; http://www.unicode.org/Public/3.1-Update/UnicodeData-3.1.0.txt
1224 (xsdre-def-primitive-category 'Lu
1228 256 258 260 262 264 266 268 270 272 274 276
1229 278 280 282 284 286 288 290 292 294 296 298
1230 300 302 304 306 308 310 313 315 317 319 321
1231 323 325 327 330 332 334 336 338 340 342 344
1232 346 348 350 352 354 356 358 360 362 364 366
1252 444 452 455 458 461 463 465 467 469 471 473
1253 475 478 480 482 484 486 488 490 492 494 497
1256 506 508 510 512 514 516 518 520 522 524 526
1257 528 530 532 534 536 538 540 542 546 548 550
1258 552 554 556 558 560 562 902
1265 986 988 990 992 994 996 998 1000 1002 1004
1268 1120 1122 1124 1126 1128 1130 1132 1134 1136
1269 1138 1140 1142 1144 1146 1148 1150 1152 1164
1270 1166 1168 1170 1172 1174 1176 1178 1180 1182
1271 1184 1186 1188 1190 1192 1194 1196 1198 1200
1272 1202 1204 1206 1208 1210 1212 1214
1274 1219 1223 1227 1232 1234 1236 1238 1240 1242
1275 1244 1246 1248 1250 1252 1254 1256 1258 1260
1276 1262 1264 1266 1268 1272
1279 7680 7682 7684 7686 7688 7690 7692 7694 7696
1280 7698 7700 7702 7704 7706 7708 7710 7712 7714
1281 7716 7718 7720 7722 7724 7726 7728 7730 7732
1282 7734 7736 7738 7740 7742 7744 7746 7748 7750
1283 7752 7754 7756 7758 7760 7762 7764 7766 7768
1284 7770 7772 7774 7776 7778 7780 7782 7784 7786
1285 7788 7790 7792 7794 7796 7798 7800 7802 7804
1286 7806 7808 7810 7812 7814 7816 7818 7820 7822
1287 7824 7826 7828 7840 7842 7844 7846 7848 7850
1288 7852 7854 7856 7858 7860 7862 7864 7866 7868
1289 7870 7872 7874 7876 7878 7880 7882 7884 7886
1290 7888 7890 7892 7894 7896 7898 7900 7902 7904
1291 7906 7908 7910 7912 7914 7916 7918 7920 7922
1346 (xsdre-def-primitive-category 'Ll
1351 257 259 261 263 265 267 269 271 273 275 277
1352 279 281 283 285 287 289 291 293 295 297 299
1355 314 316 318 320 322 324 326
1357 331 333 335 337 339 341 343 345 347 349 351
1358 353 355 357 359 361 363 365 367 369 371 373
1370 454 457 460 462 464 466 468 470 472 474
1372 479 481 483 485 487 489 491 493
1374 499 501 505 507 509 511 513 515 517 519 521
1375 523 525 527 529 531 533 535 537 539 541 543
1376 547 549 551 553 555 557 559 561 563
1382 987 989 991 993 995 997 999 1001 1003 1005
1387 1121 1123 1125 1127 1129 1131 1133 1135 1137
1388 1139 1141 1143 1145 1147 1149 1151 1153 1165
1389 1167 1169 1171 1173 1175 1177 1179 1181 1183
1390 1185 1187 1189 1191 1193 1195 1197 1199 1201
1391 1203 1205 1207 1209 1211 1213 1215 1218 1220
1392 1224 1228 1233 1235 1237 1239 1241 1243 1245
1393 1247 1249 1251 1253 1255 1257 1259 1261 1263
1396 7681 7683 7685 7687 7689 7691 7693 7695 7697
1397 7699 7701 7703 7705 7707 7709 7711 7713 7715
1398 7717 7719 7721 7723 7725 7727 7729 7731 7733
1399 7735 7737 7739 7741 7743 7745 7747 7749 7751
1400 7753 7755 7757 7759 7761 7763 7765 7767 7769
1401 7771 7773 7775 7777 7779 7781 7783 7785 7787
1402 7789 7791 7793 7795 7797 7799 7801 7803 7805
1403 7807 7809 7811 7813 7815 7817 7819 7821 7823
1406 7841 7843 7845 7847 7849 7851 7853 7855 7857
1407 7859 7861 7863 7865 7867 7869 7871 7873 7875
1408 7877 7879 7881 7883 7885 7887 7889 7891 7893
1409 7895 7897 7899 7901 7903 7905 7907 7909 7911
1410 7913 7915 7917 7919 7921 7923 7925 7927 7929
1468 (xsdre-def-primitive-category 'Lt
1474 (xsdre-def-primitive-category 'Lm
1481 3654 3782 6211 12293
1487 (xsdre-def-primitive-category 'Lo
1673 (xsdre-def-primitive-category 'Mn
1713 2893 2902 2946 3008 3021
1757 (xsdre-def-primitive-category 'Mc
1806 (xsdre-def-primitive-category 'Me
1811 (xsdre-def-primitive-category 'Nd
1833 (xsdre-def-primitive-category 'Nl
1840 (xsdre-def-primitive-category 'No
1859 (xsdre-def-primitive-category 'Pc
1866 (xsdre-def-primitive-category 'Pd
1872 (xsdre-def-primitive-category 'Ps
1873 '(40 91 123 3898 3900 5787 8218 8222 8261 8317
1874 8333 9001 12296 12298 12300 12302 12304
1875 12308 12310 12312 12314 12317 64830 65077
1876 65079 65081 65083 65085 65087 65089 65091
1877 65113 65115 65117 65288 65339 65371 65378))
1878 (xsdre-def-primitive-category 'Pe
1879 '(41 93 125 3899 3901 5788 8262 8318 8334 9002
1880 12297 12299 12301 12303 12305 12309 12311
1883 64831 65078 65080 65082 65084 65086 65088
1884 65090 65092 65114 65116 65118 65289 65341
1886 (xsdre-def-primitive-category 'Pi
1890 (xsdre-def-primitive-category 'Pf
1891 '(187 8217 8221 8250))
1892 (xsdre-def-primitive-category 'Po
1899 92 161 183 191 894 903
1942 (xsdre-def-primitive-category 'Zs
1946 (xsdre-def-primitive-category 'Zl
1948 (xsdre-def-primitive-category 'Zp
1950 (xsdre-def-primitive-category 'Sm
1953 124 126 172 177 215 247 8260
1964 9655 9665 9839 64297 65122
1970 120513 120539 120571 120597 120629 120655
1971 120687 120713 120745 120771))
1972 (xsdre-def-primitive-category 'Sc
1981 (xsdre-def-primitive-category 'Sk
1982 '(94 96 168 175 180 184
1997 (xsdre-def-primitive-category 'So
1999 169 174 176 182 1154 1769
2015 8485 8487 8489 8494 8498 8506
2088 (xsdre-def-primitive-category 'Cc
2091 (xsdre-def-primitive-category 'Cf
2102 (xsdre-def-primitive-category 'Co
2105 (1048576 .
1114109)))
2107 (provide 'xsd-regexp
)
2109 ;;; xsd-regexp.el ends here