Function: xsdre-to-symbolic

xsdre-to-symbolic is a byte-compiled function defined in xsd-regexp.el.gz.

Signature

(xsdre-to-symbolic STR)

Documentation

Convert a W3C XML Schema datatypes regexp to a symbolic form.

The symbolic form has the following structure:

REGEXP ::=
  (sequence REGEXP ...)
  | (choice REGEXP ...)
  | (repeat REGEXP MIN MAX)
  | CHAR-CLASS

CHAR-CLASS ::=
  CHAR
  | SYMBOLIC-CHAR-CLASS
  | RANGE
  | (union CHAR-CLASS ...)
  | (difference CHAR-CLASS CHAR-CLASS)

RANGE ::= (range LOWER UPPER)

MIN ::= INTEGER MAX ::= INTEGER | nil CHAR ::= UNICODE LOWER ::= UNICODE UPPER ::= UNICODE SYMBOLIC-CHAR-CLASS ::= SYMBOL

where UNICODE is an integer specifying a Unicode code-point and SYMBOLIC-CHAR-CLASS is a symbol which has either a xsdre-char-class property whose value is a CHAR-CLASS, or a xsdre-ranges property whose value is a range-list.

Source Code

;; Defined in /usr/src/emacs/lisp/nxml/xsd-regexp.el.gz
(defun xsdre-to-symbolic (str)
  "Convert a W3C XML Schema datatypes regexp to a symbolic form.

The symbolic form has the following structure:

REGEXP ::=
  (sequence REGEXP ...)
  | (choice REGEXP ...)
  | (repeat REGEXP MIN MAX)
  | CHAR-CLASS

CHAR-CLASS ::=
  CHAR
  | SYMBOLIC-CHAR-CLASS
  | RANGE
  | (union CHAR-CLASS ...)
  | (difference CHAR-CLASS CHAR-CLASS)

RANGE ::= (range LOWER UPPER)

MIN ::= INTEGER
MAX ::= INTEGER | nil
CHAR ::= UNICODE
LOWER ::= UNICODE
UPPER ::= UNICODE
SYMBOLIC-CHAR-CLASS ::= SYMBOL

where UNICODE is an integer specifying a Unicode code-point and
SYMBOLIC-CHAR-CLASS is a symbol which has either a `xsdre-char-class'
property whose value is a CHAR-CLASS, or a `xsdre-ranges' property
whose value is a range-list."
  (let ((xsdre-current-regexp (string-to-list str)))
    (condition-case err
	(let ((symbolic (xsdre-parse-regexp)))
	  (if xsdre-current-regexp
	      (xsdre-parse-error "Unexpected %c" (car xsdre-current-regexp))
	    symbolic))
      (xsdre-parse-error
       (signal 'xsdre-invalid-regexp
	       (list (apply 'format (cdr err))
		     (- (length str)
			(length xsdre-current-regexp))))))))