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 (put 'xsdre-invalid-regexp
471 '(error xsdre-invalid-regexp
))
473 (put 'xsdre-invalid-regexp
475 "Invalid W3C XML Schema Datatypes regular expression")
477 (defun xsdre-parse-regexp ()
478 (let ((branches nil
))
480 (setq branches
(cons (xsdre-parse-branch) branches
))
481 (when (eq (car xsdre-current-regexp
) ?|
)
484 (if (null (cdr branches
))
486 (cons 'choice
(nreverse branches
)))))
488 (defun xsdre-parse-branch ()
490 (while (let ((item (xsdre-try-parse-atom)))
492 (let ((quantifier (xsdre-try-parse-quantifier)))
499 (setq items
(cons item items
)))))
500 (cond ((null items
) '(sequence))
501 ((null (cdr items
)) (car items
))
502 (t (cons 'sequence
(nreverse items
))))))
504 (defun xsdre-try-parse-quantifier ()
505 (let ((ch (car xsdre-current-regexp
)))
506 (cond ((eq ch ?
*) (xsdre-advance) '(0 . nil
))
507 ((eq ch ?
+) (xsdre-advance) '(1 . nil
))
508 ((eq ch ??
) (xsdre-advance) '(0 .
1))
511 (let ((lower (xsdre-parse-bound)))
512 (setq ch
(car xsdre-current-regexp
))
518 (cond ((eq (car xsdre-current-regexp
) ?
})
522 (let ((upper (xsdre-parse-bound)))
524 (cons lower upper
)))))
525 (t (xsdre-parse-error "Expected , or }")))))
528 (defun xsdre-parse-bound ()
531 (let* ((ch (car xsdre-current-regexp
))
532 (digit (memq ch
'(?
9 ?
8 ?
7 ?
6 ?
5 ?
4 ?
3 ?
2 ?
1 ?
0))))
534 (xsdre-parse-error "Expected a digit"))
536 (length (cdr digit
)))))
538 (not (memq (car xsdre-current-regexp
) '(?
} ?
,)))))
542 (defun xsdre-try-parse-atom ()
543 (let ((ch (car xsdre-current-regexp
)))
544 (cond ((memq ch
'(nil ?? ?
* ?
+ ?\
) ?\
{ ?\
} ?| ?\
])) nil
)
547 (xsdre-parse-escape))
550 (let ((ret (xsdre-parse-regexp)))
554 (xsdre-parse-char-class))
559 (let ((uc (encode-char ch
'ucs
)))
561 (xsdre-parse-error "%c is not a Unicode character" ch
))
562 (xsdre-advance) uc
)))))
564 (defun xsdre-parse-char-class ()
566 (let (compl members ret
)
567 (when (eq (car xsdre-current-regexp
) ?^
)
570 (while (let ((member (xsdre-parse-char-class-member))
572 (cond ((eq (car xsdre-current-regexp
) ?\-
)
574 (cond ((eq (car xsdre-current-regexp
) ?\
[)
575 (setq members
(cons member members
))
577 ((not (integerp member
))
578 (xsdre-parse-error "Lower bound is not a single character"))
580 (encode-char member
'ucs
)))
581 (xsdre-parse-error "Lower bound %c is not a Unicode character"
584 (let ((upper (xsdre-parse-char-class-member)))
585 (unless (integerp upper
)
586 (xsdre-parse-error "Upper bound is not a single character"))
588 (encode-char upper
'ucs
))
589 (xsdre-parse-error "Upper bound %c is not a Unicode character" upper
))
591 (cons (list 'range uc1 uc2
)
593 (not (eq (car xsdre-current-regexp
) ?\
])))))
594 (t (setq members
(cons member members
))
595 (not (eq (car xsdre-current-regexp
) ?\
]))))))
596 (setq members
(nreverse members
))
597 (if (null (cdr members
))
598 (setq ret
(car members
))
599 (setq ret
(cons 'union members
)))
601 (setq ret
(list 'difference
'any ret
)))
602 (when (eq (car xsdre-current-regexp
) ?\
[)
604 (list 'difference ret
(xsdre-parse-char-class))))
608 (defun xsdre-parse-char-class-member ()
609 (let ((ch (car xsdre-current-regexp
)))
611 (xsdre-parse-error "Expected ]"))
614 (xsdre-parse-escape))
615 ((memq ch
'(?\
[ ?\
] ?-
))
616 (xsdre-parse-error "%c must be quoted in a character class" ch
))
617 (t (xsdre-advance) ch
))))
619 (defconst xsdre-single-escape
626 (defun xsdre-parse-escape ()
627 (let ((ch (car xsdre-current-regexp
)))
629 (cond ((memq ch
'(?
\\ ?| ?. ?- ?^ ?
* ?
+ ?
( ?
) ?
{ ?
} ?
[ ?
])) ch
)
633 ((cdr (assq ch xsdre-single-escape
)))
635 (cdr (assq (downcase ch
) xsdre-single-escape
))))
637 (list 'difference
'any positive
))))
638 ((eq ch ?p
) (xsdre-parse-prop))
639 ((eq ch ?P
) (list 'difference
'any
(xsdre-parse-prop)))
641 (xsdre-parse-error "Missing char after \\")
642 (xsdre-parse-error "Bad escape %c" ch
))))))
644 (defun xsdre-parse-prop ()
647 (while (not (eq (car xsdre-current-regexp
) ?\
}))
648 (unless xsdre-current-regexp
649 (xsdre-parse-error "Expected ?"))
650 (setq name
(cons (car xsdre-current-regexp
)
654 (setq name
(nreverse name
))
655 (cond ((null name
) (xsdre-parse-error "Empty property name"))
657 (let ((category (intern (string (car name
)))))
658 (unless (get category
'xsdre-unicode-category
)
659 (xsdre-parse-error "%s is not a category" category
))
662 (let ((category (intern (string (car name
) (cadr name
)))))
663 (unless (get category
'xsdre-unicode-category
)
664 (xsdre-parse-error "%s is not a category" category
))
666 ((not (and (eq (car name
) ?I
)
667 (eq (cadr name
) ?s
)))
668 (xsdre-parse-error "Block name does not start with Is"))
670 (let ((block (intern (apply 'string
(cddr name
)))))
671 (unless (get block
'xsdre-unicode-block
)
672 (xsdre-parse-error "%s is not a block name" block
))
675 (defun xsdre-expect (ch)
676 (if (eq (car xsdre-current-regexp
) ch
)
678 (xsdre-parse-error "Expected %c" ch
)))
680 (defun xsdre-advance ()
681 (setq xsdre-current-regexp
682 (cdr xsdre-current-regexp
)))
684 (defun xsdre-parse-error (&rest args
)
685 (signal 'xsdre-parse-error args
))
687 ;; This error condition is used only internally.
689 (put 'xsdre-parse-error
691 '(error xsdre-parse-error
))
693 (put 'xsdre-parse-error
695 "Internal error in parsing XSD regexp")
697 ;;; Character class data
699 (put 'dot
'xsdre-char-class
'(difference any
(union #xA
#xD
)))
700 (put 'digit
'xsdre-char-class
'Nd
)
701 (put 'word
'xsdre-char-class
'(difference any
(union P Z C
)))
702 (put 'space
'xsdre-char-class
'(union #x9
#xA
#xD
#x20
))
703 (put 'any
'xsdre-ranges
'((#x0 .
#x10FFFF
)))
705 (defconst xsdre-gen-categories
706 '(Lu Ll Lt Lm Lo Mn Mc Me Nd Nl No Pc Pd
707 Ps Pe Pi Pf Po Zs Zl Zp Sm Sc Sk So Cc Cf Co
))
709 (defun xsdre-gen-categories (file)
710 "Use a UnicodeData file to generate code to initialize Unicode categories.
711 Code is inserted into the current buffer."
712 (interactive "fUnicodeData file: ")
713 (with-current-buffer (find-file-noselect file
)
714 (goto-char (point-min))
715 (mapc (lambda (x) (put x
'xsdre-ranges nil
)) xsdre-gen-categories
)
716 (while (re-search-forward "^\\([0-9A-Fa-f]*\\);[^;]*;\\([A-Z][a-z]\\);"
719 (let* ((sym (intern (match-string-no-properties 2)))
720 (code (string-to-number (match-string-no-properties 1)
722 (ranges (get sym
'xsdre-ranges
))
723 (last-range (car ranges
))
724 (forced-range (string= (buffer-substring-no-properties
725 (- (match-beginning 2) 6)
726 (1- (match-beginning 2)))
728 (cond ((and (integerp last-range
)
730 (eq code
(1+ last-range
))))
733 (cons (cons last-range code
)
735 ((and (consp last-range
)
737 (eq code
(1+ (cdr last-range
)))))
740 (cons (cons (car last-range
) code
)
743 (put sym
'xsdre-ranges
(cons code ranges
))))))
747 (nreverse (get x
'xsdre-ranges
)))
749 xsdre-gen-categories
))
751 (let ((start (point)))
752 (pp (list 'xsdre-def-primitive-category
754 (list 'quote
(get x
'xsdre-ranges
)))
759 (while (condition-case err
764 (when (and (< 70 (current-column))
765 (not (looking-at ")")))
767 (lisp-indent-line))))))
768 xsdre-gen-categories
))
770 (defun xsdre-def-primitive-category (sym ranges
)
771 (put sym
'xsdre-ranges ranges
)
772 (put sym
'xsdre-unicode-category t
))
776 (defun xsdre-def-block (sym ranges
)
777 (put sym
'xsdre-ranges ranges
)
778 (put sym
'xsdre-unicode-block t
))
780 (xsdre-def-block 'BasicLatin
'((#x0000 .
#x007F
)))
781 (xsdre-def-block 'Latin-1Supplement
'((#x0080 .
#x00FF
)))
782 (xsdre-def-block 'LatinExtended-A
'((#x0100 .
#x017F
)))
783 (xsdre-def-block 'LatinExtended-B
'((#x0180 .
#x024F
)))
784 (xsdre-def-block 'IPAExtensions
'((#x0250 .
#x02AF
)))
785 (xsdre-def-block 'SpacingModifierLetters
'((#x02B0 .
#x02FF
)))
786 (xsdre-def-block 'CombiningDiacriticalMarks
'((#x0300 .
#x036F
)))
787 (xsdre-def-block 'Greek
'((#x0370 .
#x03FF
)))
788 (xsdre-def-block 'Cyrillic
'((#x0400 .
#x04FF
)))
789 (xsdre-def-block 'Armenian
'((#x0530 .
#x058F
)))
790 (xsdre-def-block 'Hebrew
'((#x0590 .
#x05FF
)))
791 (xsdre-def-block 'Arabic
'((#x0600 .
#x06FF
)))
792 (xsdre-def-block 'Syriac
'((#x0700 .
#x074F
)))
793 (xsdre-def-block 'Thaana
'((#x0780 .
#x07BF
)))
794 (xsdre-def-block 'Devanagari
'((#x0900 .
#x097F
)))
795 (xsdre-def-block 'Bengali
'((#x0980 .
#x09FF
)))
796 (xsdre-def-block 'Gurmukhi
'((#x0A00 .
#x0A7F
)))
797 (xsdre-def-block 'Gujarati
'((#x0A80 .
#x0AFF
)))
798 (xsdre-def-block 'Oriya
'((#x0B00 .
#x0B7F
)))
799 (xsdre-def-block 'Tamil
'((#x0B80 .
#x0BFF
)))
800 (xsdre-def-block 'Telugu
'((#x0C00 .
#x0C7F
)))
801 (xsdre-def-block 'Kannada
'((#x0C80 .
#x0CFF
)))
802 (xsdre-def-block 'Malayalam
'((#x0D00 .
#x0D7F
)))
803 (xsdre-def-block 'Sinhala
'((#x0D80 .
#x0DFF
)))
804 (xsdre-def-block 'Thai
'((#x0E00 .
#x0E7F
)))
805 (xsdre-def-block 'Lao
'((#x0E80 .
#x0EFF
)))
806 (xsdre-def-block 'Tibetan
'((#x0F00 .
#x0FFF
)))
807 (xsdre-def-block 'Myanmar
'((#x1000 .
#x109F
)))
808 (xsdre-def-block 'Georgian
'((#x10A0 .
#x10FF
)))
809 (xsdre-def-block 'HangulJamo
'((#x1100 .
#x11FF
)))
810 (xsdre-def-block 'Ethiopic
'((#x1200 .
#x137F
)))
811 (xsdre-def-block 'Cherokee
'((#x13A0 .
#x13FF
)))
812 (xsdre-def-block 'UnifiedCanadianAboriginalSyllabics
'((#x1400 .
#x167F
)))
813 (xsdre-def-block 'Ogham
'((#x1680 .
#x169F
)))
814 (xsdre-def-block 'Runic
'((#x16A0 .
#x16FF
)))
815 (xsdre-def-block 'Khmer
'((#x1780 .
#x17FF
)))
816 (xsdre-def-block 'Mongolian
'((#x1800 .
#x18AF
)))
817 (xsdre-def-block 'LatinExtendedAdditional
'((#x1E00 .
#x1EFF
)))
818 (xsdre-def-block 'GreekExtended
'((#x1F00 .
#x1FFF
)))
819 (xsdre-def-block 'GeneralPunctuation
'((#x2000 .
#x206F
)))
820 (xsdre-def-block 'SuperscriptsandSubscripts
'((#x2070 .
#x209F
)))
821 (xsdre-def-block 'CurrencySymbols
'((#x20A0 .
#x20CF
)))
822 (xsdre-def-block 'CombiningMarksforSymbols
'((#x20D0 .
#x20FF
)))
823 (xsdre-def-block 'LetterlikeSymbols
'((#x2100 .
#x214F
)))
824 (xsdre-def-block 'NumberForms
'((#x2150 .
#x218F
)))
825 (xsdre-def-block 'Arrows
'((#x2190 .
#x21FF
)))
826 (xsdre-def-block 'MathematicalOperators
'((#x2200 .
#x22FF
)))
827 (xsdre-def-block 'MiscellaneousTechnical
'((#x2300 .
#x23FF
)))
828 (xsdre-def-block 'ControlPictures
'((#x2400 .
#x243F
)))
829 (xsdre-def-block 'OpticalCharacterRecognition
'((#x2440 .
#x245F
)))
830 (xsdre-def-block 'EnclosedAlphanumerics
'((#x2460 .
#x24FF
)))
831 (xsdre-def-block 'BoxDrawing
'((#x2500 .
#x257F
)))
832 (xsdre-def-block 'BlockElements
'((#x2580 .
#x259F
)))
833 (xsdre-def-block 'GeometricShapes
'((#x25A0 .
#x25FF
)))
834 (xsdre-def-block 'MiscellaneousSymbols
'((#x2600 .
#x26FF
)))
835 (xsdre-def-block 'Dingbats
'((#x2700 .
#x27BF
)))
836 (xsdre-def-block 'BraillePatterns
'((#x2800 .
#x28FF
)))
837 (xsdre-def-block 'CJKRadicalsSupplement
'((#x2E80 .
#x2EFF
)))
838 (xsdre-def-block 'KangxiRadicals
'((#x2F00 .
#x2FDF
)))
839 (xsdre-def-block 'IdeographicDescriptionCharacters
'((#x2FF0 .
#x2FFF
)))
840 (xsdre-def-block 'CJKSymbolsandPunctuation
'((#x3000 .
#x303F
)))
841 (xsdre-def-block 'Hiragana
'((#x3040 .
#x309F
)))
842 (xsdre-def-block 'Katakana
'((#x30A0 .
#x30FF
)))
843 (xsdre-def-block 'Bopomofo
'((#x3100 .
#x312F
)))
844 (xsdre-def-block 'HangulCompatibilityJamo
'((#x3130 .
#x318F
)))
845 (xsdre-def-block 'Kanbun
'((#x3190 .
#x319F
)))
846 (xsdre-def-block 'BopomofoExtended
'((#x31A0 .
#x31BF
)))
847 (xsdre-def-block 'EnclosedCJKLettersandMonths
'((#x3200 .
#x32FF
)))
848 (xsdre-def-block 'CJKCompatibility
'((#x3300 .
#x33FF
)))
849 (xsdre-def-block 'CJKUnifiedIdeographsExtensionA
'((#x3400 .
#x4DB5
)))
850 (xsdre-def-block 'CJKUnifiedIdeographs
'((#x4E00 .
#x9FFF
)))
851 (xsdre-def-block 'YiSyllables
'((#xA000 .
#xA48F
)))
852 (xsdre-def-block 'YiRadicals
'((#xA490 .
#xA4CF
)))
853 (xsdre-def-block 'HangulSyllables
'((#xAC00 .
#xD7A3
)))
854 ;;(xsdre-def-block 'HighSurrogates '((#xD800 . #xDB7F)))
855 ;;(xsdre-def-block 'HighPrivateUseSurrogates '((#xDB80 . #xDBFF)))
856 ;;(xsdre-def-block 'LowSurrogates '((#xDC00 . #xDFFF)))
857 (xsdre-def-block 'CJKCompatibilityIdeographs
'((#xF900 .
#xFAFF
)))
858 (xsdre-def-block 'AlphabeticPresentationForms
'((#xFB00 .
#xFB4F
)))
859 (xsdre-def-block 'ArabicPresentationForms-A
'((#xFB50 .
#xFDFF
)))
860 (xsdre-def-block 'CombiningHalfMarks
'((#xFE20 .
#xFE2F
)))
861 (xsdre-def-block 'CJKCompatibilityForms
'((#xFE30 .
#xFE4F
)))
862 (xsdre-def-block 'SmallFormVariants
'((#xFE50 .
#xFE6F
)))
863 (xsdre-def-block 'ArabicPresentationForms-B
'((#xFE70 .
#xFEFE
)))
864 (xsdre-def-block 'Specials
'((#xFEFF .
#xFEFF
)))
865 (xsdre-def-block 'HalfwidthandFullwidthForms
'((#xFF00 .
#xFFEF
)))
866 (xsdre-def-block 'Specials
'((#xFFF0 .
#xFFFD
)))
867 (xsdre-def-block 'OldItalic
'((#x10300 .
#x1032F
)))
868 (xsdre-def-block 'Gothic
'((#x10330 .
#x1034F
)))
869 (xsdre-def-block 'Deseret
'((#x10400 .
#x1044F
)))
870 (xsdre-def-block 'ByzantineMusicalSymbols
'((#x1D000 .
#x1D0FF
)))
871 (xsdre-def-block 'MusicalSymbols
'((#x1D100 .
#x1D1FF
)))
872 (xsdre-def-block 'MathematicalAlphanumericSymbols
'((#x1D400 .
#x1D7FF
)))
873 (xsdre-def-block 'CJKUnifiedIdeographsExtensionB
'((#x20000 .
#x2A6D6
)))
874 (xsdre-def-block 'CJKCompatibilityIdeographsSupplement
'((#x2F800 .
#x2FA1F
)))
875 (xsdre-def-block 'Tags
'((#xE0000 .
#xE007F
)))
876 (xsdre-def-block 'PrivateUse
'((#xE000 .
#xF8FF
)
878 (#x100000 .
#x10FFFD
)))
882 ;;; Derived categories
884 (defun xsdre-def-derived-category (sym char-class
)
885 (put sym
'xsdre-char-class char-class
)
886 (put sym
'xsdre-unicode-category t
))
888 (xsdre-def-derived-category 'L
'(union Lu Ll Lt Lm Lo
))
889 (xsdre-def-derived-category 'M
'(union Mn Mc Me
))
890 (xsdre-def-derived-category 'N
'(union Nd Nl No
))
891 (xsdre-def-derived-category 'P
'(union Pc Pd Ps Pe Pi Pf Po
))
892 (xsdre-def-derived-category 'Z
'(union Zs Zl Zp
))
893 (xsdre-def-derived-category 'S
'(union Sm Sc Sk So
))
894 (xsdre-def-derived-category 'C
'(union Cc Cf Co Cn
))
895 (xsdre-def-derived-category 'Cn
'(difference any
896 (union L M N P Z S Cc Cf Co
)))
898 (xsdre-def-primitive-category
1107 (xsdre-def-derived-category 'name-continue
'(union name-initial
1108 name-continue-not-initial
))
1110 (xsdre-def-primitive-category
1111 'name-continue-not-initial
1229 ;;; Auto-generated section.
1231 ;; The rest of the file was auto-generated by doing M-x xsdre-gen-categories
1232 ;; on UnicodeData-3.1.0.txt available from
1233 ;; http://www.unicode.org/Public/3.1-Update/UnicodeData-3.1.0.txt
1235 (xsdre-def-primitive-category 'Lu
1239 256 258 260 262 264 266 268 270 272 274 276
1240 278 280 282 284 286 288 290 292 294 296 298
1241 300 302 304 306 308 310 313 315 317 319 321
1242 323 325 327 330 332 334 336 338 340 342 344
1243 346 348 350 352 354 356 358 360 362 364 366
1263 444 452 455 458 461 463 465 467 469 471 473
1264 475 478 480 482 484 486 488 490 492 494 497
1267 506 508 510 512 514 516 518 520 522 524 526
1268 528 530 532 534 536 538 540 542 546 548 550
1269 552 554 556 558 560 562 902
1276 986 988 990 992 994 996 998 1000 1002 1004
1279 1120 1122 1124 1126 1128 1130 1132 1134 1136
1280 1138 1140 1142 1144 1146 1148 1150 1152 1164
1281 1166 1168 1170 1172 1174 1176 1178 1180 1182
1282 1184 1186 1188 1190 1192 1194 1196 1198 1200
1283 1202 1204 1206 1208 1210 1212 1214
1285 1219 1223 1227 1232 1234 1236 1238 1240 1242
1286 1244 1246 1248 1250 1252 1254 1256 1258 1260
1287 1262 1264 1266 1268 1272
1290 7680 7682 7684 7686 7688 7690 7692 7694 7696
1291 7698 7700 7702 7704 7706 7708 7710 7712 7714
1292 7716 7718 7720 7722 7724 7726 7728 7730 7732
1293 7734 7736 7738 7740 7742 7744 7746 7748 7750
1294 7752 7754 7756 7758 7760 7762 7764 7766 7768
1295 7770 7772 7774 7776 7778 7780 7782 7784 7786
1296 7788 7790 7792 7794 7796 7798 7800 7802 7804
1297 7806 7808 7810 7812 7814 7816 7818 7820 7822
1298 7824 7826 7828 7840 7842 7844 7846 7848 7850
1299 7852 7854 7856 7858 7860 7862 7864 7866 7868
1300 7870 7872 7874 7876 7878 7880 7882 7884 7886
1301 7888 7890 7892 7894 7896 7898 7900 7902 7904
1302 7906 7908 7910 7912 7914 7916 7918 7920 7922
1357 (xsdre-def-primitive-category 'Ll
1362 257 259 261 263 265 267 269 271 273 275 277
1363 279 281 283 285 287 289 291 293 295 297 299
1366 314 316 318 320 322 324 326
1368 331 333 335 337 339 341 343 345 347 349 351
1369 353 355 357 359 361 363 365 367 369 371 373
1381 454 457 460 462 464 466 468 470 472 474
1383 479 481 483 485 487 489 491 493
1385 499 501 505 507 509 511 513 515 517 519 521
1386 523 525 527 529 531 533 535 537 539 541 543
1387 547 549 551 553 555 557 559 561 563
1393 987 989 991 993 995 997 999 1001 1003 1005
1398 1121 1123 1125 1127 1129 1131 1133 1135 1137
1399 1139 1141 1143 1145 1147 1149 1151 1153 1165
1400 1167 1169 1171 1173 1175 1177 1179 1181 1183
1401 1185 1187 1189 1191 1193 1195 1197 1199 1201
1402 1203 1205 1207 1209 1211 1213 1215 1218 1220
1403 1224 1228 1233 1235 1237 1239 1241 1243 1245
1404 1247 1249 1251 1253 1255 1257 1259 1261 1263
1407 7681 7683 7685 7687 7689 7691 7693 7695 7697
1408 7699 7701 7703 7705 7707 7709 7711 7713 7715
1409 7717 7719 7721 7723 7725 7727 7729 7731 7733
1410 7735 7737 7739 7741 7743 7745 7747 7749 7751
1411 7753 7755 7757 7759 7761 7763 7765 7767 7769
1412 7771 7773 7775 7777 7779 7781 7783 7785 7787
1413 7789 7791 7793 7795 7797 7799 7801 7803 7805
1414 7807 7809 7811 7813 7815 7817 7819 7821 7823
1417 7841 7843 7845 7847 7849 7851 7853 7855 7857
1418 7859 7861 7863 7865 7867 7869 7871 7873 7875
1419 7877 7879 7881 7883 7885 7887 7889 7891 7893
1420 7895 7897 7899 7901 7903 7905 7907 7909 7911
1421 7913 7915 7917 7919 7921 7923 7925 7927 7929
1479 (xsdre-def-primitive-category 'Lt
1485 (xsdre-def-primitive-category 'Lm
1492 3654 3782 6211 12293
1498 (xsdre-def-primitive-category 'Lo
1684 (xsdre-def-primitive-category 'Mn
1724 2893 2902 2946 3008 3021
1768 (xsdre-def-primitive-category 'Mc
1817 (xsdre-def-primitive-category 'Me
1822 (xsdre-def-primitive-category 'Nd
1844 (xsdre-def-primitive-category 'Nl
1851 (xsdre-def-primitive-category 'No
1870 (xsdre-def-primitive-category 'Pc
1877 (xsdre-def-primitive-category 'Pd
1883 (xsdre-def-primitive-category 'Ps
1884 '(40 91 123 3898 3900 5787 8218 8222 8261 8317
1885 8333 9001 12296 12298 12300 12302 12304
1886 12308 12310 12312 12314 12317 64830 65077
1887 65079 65081 65083 65085 65087 65089 65091
1888 65113 65115 65117 65288 65339 65371 65378))
1889 (xsdre-def-primitive-category 'Pe
1890 '(41 93 125 3899 3901 5788 8262 8318 8334 9002
1891 12297 12299 12301 12303 12305 12309 12311
1894 64831 65078 65080 65082 65084 65086 65088
1895 65090 65092 65114 65116 65118 65289 65341
1897 (xsdre-def-primitive-category 'Pi
1901 (xsdre-def-primitive-category 'Pf
1902 '(187 8217 8221 8250))
1903 (xsdre-def-primitive-category 'Po
1910 92 161 183 191 894 903
1953 (xsdre-def-primitive-category 'Zs
1957 (xsdre-def-primitive-category 'Zl
1959 (xsdre-def-primitive-category 'Zp
1961 (xsdre-def-primitive-category 'Sm
1964 124 126 172 177 215 247 8260
1975 9655 9665 9839 64297 65122
1981 120513 120539 120571 120597 120629 120655
1982 120687 120713 120745 120771))
1983 (xsdre-def-primitive-category 'Sc
1992 (xsdre-def-primitive-category 'Sk
1993 '(94 96 168 175 180 184
2008 (xsdre-def-primitive-category 'So
2010 169 174 176 182 1154 1769
2026 8485 8487 8489 8494 8498 8506
2099 (xsdre-def-primitive-category 'Cc
2102 (xsdre-def-primitive-category 'Cf
2113 (xsdre-def-primitive-category 'Co
2116 (1048576 .
1114109)))
2118 (provide 'xsd-regexp
)
2120 ;;; xsd-regexp.el ends here