86361
|
1 ;;; rng-dt.el --- datatype library interface for RELAX NG
|
|
2
|
86546
|
3 ;; Copyright (C) 2003, 2007 Free Software Foundation, Inc.
|
86361
|
4
|
|
5 ;; Author: James Clark
|
|
6 ;; Keywords: XML, RelaxNG
|
|
7
|
86546
|
8 ;; This file is part of GNU Emacs.
|
|
9
|
|
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, or (at your option)
|
|
13 ;; any later version.
|
86361
|
14
|
86546
|
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.
|
86361
|
19
|
86546
|
20 ;; You should have received a copy of the GNU General Public License
|
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
23 ;; Boston, MA 02110-1301, USA.
|
86361
|
24
|
|
25 ;;; Commentary:
|
|
26
|
|
27 ;;; Code:
|
|
28
|
|
29 (require 'rng-util)
|
|
30
|
|
31 (defvar rng-dt-error-reporter nil)
|
|
32
|
|
33 (defun rng-dt-error (string &rest objs)
|
|
34 (if rng-dt-error-reporter
|
|
35 (apply rng-dt-error-reporter (cons string objs))
|
|
36 nil))
|
|
37
|
|
38 (defvar rng-dt-namespace-context-getter nil
|
|
39 "A list used by datatype libraries to expand names. The car of the
|
|
40 list is a symbol which is the name of a function. This function is
|
|
41 applied to the cdr of the list. The function must return a list whose
|
|
42 car is the default namespace and whose cdr is an alist of (PREFIX
|
|
43 . NAMESPACE) pairs, where PREFIX is a string and NAMESPACE is a
|
|
44 symbol. This must be dynamically bound before calling a datatype
|
|
45 library.")
|
|
46
|
|
47 (defsubst rng-dt-make-value (dt str)
|
|
48 (apply (car dt) (cons str (cdr dt))))
|
|
49
|
|
50 (defun rng-dt-builtin-compile (name params)
|
|
51 (cond ((eq name 'string)
|
|
52 (if (null params)
|
|
53 '(t identity)
|
|
54 (rng-dt-error "The string datatype does not take any parameters")))
|
|
55 ((eq name 'token)
|
|
56 (if (null params)
|
|
57 '(t rng-collapse-space)
|
|
58 (rng-dt-error "The token datatype does not take any parameters")))
|
|
59 (t
|
|
60 (rng-dt-error "There is no built-in datatype %s" name))))
|
|
61
|
|
62 (put (rng-make-datatypes-uri "") 'rng-dt-compile 'rng-dt-builtin-compile)
|
|
63
|
|
64 (provide 'rng-dt)
|
|
65
|
86379
|
66 ;; arch-tag: 1dca90f1-8dae-4dd4-b61f-fade4452c014
|
86361
|
67 ;;; rng-dt.el ends here
|