File: xsd-regexp.el.html
This handles the regular expressions in the syntax defined by:
W3C XML Schema Part 2: Datatypes
<https://www.w3.org/TR/xmlschema-2/#regexs>
The main entry point is xsdre-translate.
The features of XSD regexps that make this non-trivial are:
- \p{PROP} escape for matching characters that have various
Unicode-defined properties
- character class subtraction:, e.g. [\p{L}-[abc]] matches
any character in the L category other than a, b and c.
We compute the set of Unicode characters denoted by each XSD char-class as a list of ranges. The regexp generated for a single escape can be large (several thousand characters).
XSD has non-traditional rules about when characters must be and can be quoted with \. These are quite different from the Emacs rules.
The semantics of XSD regexps are defined in terms of Unicode.
Non-Unicode characters are not allowed in regular expressions and
will not match against the generated regular expressions. A
Unicode character means a character in one of the Mule charsets
ascii, latin-iso8859-1, mule-unicode-0100-24ff,
mule-unicode-2500-33ff, mule-unicode-e000-ffff, eight-bit-control
or a character translatable to such a character (i.e a character
for which encode-char will return non-nil).
Unfortunately, this means that this package is currently useless for CJK characters, since there's no mule-unicode charset for the CJK ranges of Unicode. We should devise a workaround for this until the fabled Unicode version of Emacs makes an appearance.
Defined variables (2)
xsdre-current-regexp | List of characters remaining to be parsed. Dynamically bound. |
xsdre-mule-char-set-ranges | List of ranges for the Mule character sets containing Unicode characters. |
Defined functions (23)
xsdre-char-class-to-range-list | (CC) |
xsdre-check-range-list | (RANGE-LIST) |
xsdre-compile-char-class | (CC ACCUM) |
xsdre-compile-regexp | (RE ACCUM) |
xsdre-compile-single-char | (CH) |
xsdre-def-block | (SYM RANGES) |
xsdre-def-derived-category | (SYM CHAR-CLASS) |
xsdre-def-primitive-category | (SYM RANGES) |
xsdre-expect | (CH) |
xsdre-from-symbolic | (RE) |
xsdre-gen-categories | (FILE) |
xsdre-make-range | (FIRST LAST) |
xsdre-make-range-list | (LIST) |
xsdre-parse-error | (&rest ARGS) |
xsdre-range-first | (R) |
xsdre-range-last | (R) |
xsdre-range-less-than | (R1 R2) |
xsdre-range-list-difference | (ORIG SUBTRACT) |
xsdre-range-list-mule-intersection | (RANGE-LIST) |
xsdre-range-list-to-char-alternative | (RANGE-LIST) |
xsdre-range-list-union | (RANGE-LISTS) |
xsdre-to-symbolic | (STR) |
xsdre-translate | (REGEXP) |