2016-01-15 15:29:20 +00:00
|
|
|
;;; rng-dt.el --- datatype library interface for RELAX NG -*- lexical-binding:t -*-
|
2007-11-23 06:58:00 +00:00
|
|
|
|
2016-01-01 09:16:19 +00:00
|
|
|
;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
|
|
|
;; Author: James Clark
|
2014-03-21 06:56:55 +00:00
|
|
|
;; Keywords: wp, hypermedia, languages, XML, RelaxNG
|
2007-11-23 06:58:00 +00:00
|
|
|
|
2007-11-28 04:14:05 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
2008-05-06 04:29:13 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2007-11-28 04:14:05 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 04:29:13 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
2007-11-28 04:14:05 +00:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 04:29:13 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2007-11-23 06:58:00 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'rng-util)
|
|
|
|
|
|
|
|
(defvar rng-dt-error-reporter nil)
|
|
|
|
|
|
|
|
(defun rng-dt-error (string &rest objs)
|
|
|
|
(if rng-dt-error-reporter
|
|
|
|
(apply rng-dt-error-reporter (cons string objs))
|
|
|
|
nil))
|
|
|
|
|
|
|
|
(defvar rng-dt-namespace-context-getter nil
|
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
2008-07-03 12:25:23 +00:00
|
|
|
"A list used by datatype libraries to expand names.
|
|
|
|
The car of the list is a symbol which is the name of a function.
|
|
|
|
This function is applied to the cdr of the list. The function must
|
|
|
|
return a list whose car is the default namespace and whose cdr is an
|
|
|
|
alist of (PREFIX . NAMESPACE) pairs, where PREFIX is a string and
|
|
|
|
NAMESPACE is a symbol. This must be dynamically bound before calling
|
|
|
|
a datatype library.")
|
2007-11-23 06:58:00 +00:00
|
|
|
|
|
|
|
(defsubst rng-dt-make-value (dt str)
|
|
|
|
(apply (car dt) (cons str (cdr dt))))
|
|
|
|
|
|
|
|
(defun rng-dt-builtin-compile (name params)
|
|
|
|
(cond ((eq name 'string)
|
|
|
|
(if (null params)
|
|
|
|
'(t identity)
|
|
|
|
(rng-dt-error "The string datatype does not take any parameters")))
|
|
|
|
((eq name 'token)
|
|
|
|
(if (null params)
|
|
|
|
'(t rng-collapse-space)
|
|
|
|
(rng-dt-error "The token datatype does not take any parameters")))
|
|
|
|
(t
|
|
|
|
(rng-dt-error "There is no built-in datatype %s" name))))
|
|
|
|
|
2016-01-15 15:29:20 +00:00
|
|
|
(put (rng-make-datatypes-uri "") 'rng-dt-compile #'rng-dt-builtin-compile)
|
2007-11-23 06:58:00 +00:00
|
|
|
|
|
|
|
(provide 'rng-dt)
|
|
|
|
|
|
|
|
;;; rng-dt.el ends here
|