Mercurial > emacs
comparison lisp/nxml/xsd-regexp.el @ 86558:4eb6d42524d5
Add 2007 to copyright years.
Switch license to standard GPLv3+ text.
(xsdre-gen-categories): Use mapc rather than mapcar.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 28 Nov 2007 04:15:41 +0000 |
parents | 2ac1a9b70580 |
children | b9e8ab94c460 |
comparison
equal
deleted
inserted
replaced
86557:08a9fc116d91 | 86558:4eb6d42524d5 |
---|---|
1 ;;; xsd-regexp.el --- translate W3C XML Schema regexps to Emacs regexps | 1 ;;; xsd-regexp.el --- translate W3C XML Schema regexps to Emacs regexps |
2 | 2 |
3 ;; Copyright (C) 2003 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2003, 2007 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: James Clark | 5 ;; Author: James Clark |
6 ;; Keywords: XML, regexp | 6 ;; Keywords: XML, regexp |
7 | 7 |
8 ;; This program is free software; you can redistribute it and/or | 8 ;; This file is part of GNU Emacs. |
9 ;; modify it under the terms of the GNU General Public License as | 9 |
10 ;; published by the Free Software Foundation; either version 2 of | 10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
11 ;; the License, or (at your option) any later version. | 11 ;; it under the terms of the GNU General Public License as published by |
12 | 12 ;; the Free Software Foundation; either version 3, or (at your option) |
13 ;; This program is distributed in the hope that it will be | 13 ;; any later version. |
14 ;; useful, but WITHOUT ANY WARRANTY; without even the implied | 14 |
15 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | 15 ;; GNU Emacs is distributed in the hope that it will be useful, |
16 ;; PURPOSE. See the GNU General Public License for more details. | 16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 ;; You should have received a copy of the GNU General Public | 18 ;; GNU General Public License for more details. |
19 ;; License along with this program; if not, write to the Free | 19 |
20 ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 20 ;; You should have received a copy of the GNU General Public License |
21 ;; MA 02111-1307 USA | 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. | |
22 | 24 |
23 ;;; Commentary: | 25 ;;; Commentary: |
24 | 26 |
25 ;; This handles the regular expressions in the syntax defined by: | 27 ;; This handles the regular expressions in the syntax defined by: |
26 ;; W3C XML Schema Part 2: Datatypes | 28 ;; W3C XML Schema Part 2: Datatypes |
711 Code is inserted into the current buffer." | 713 Code is inserted into the current buffer." |
712 (interactive "fUnicodeData file: ") | 714 (interactive "fUnicodeData file: ") |
713 (save-excursion | 715 (save-excursion |
714 (set-buffer (find-file-noselect file)) | 716 (set-buffer (find-file-noselect file)) |
715 (goto-char (point-min)) | 717 (goto-char (point-min)) |
716 (mapcar (lambda (x) (put x 'xsdre-ranges nil)) xsdre-gen-categories) | 718 (mapc (lambda (x) (put x 'xsdre-ranges nil)) xsdre-gen-categories) |
717 (while (re-search-forward "^\\([0-9A-Fa-f]*\\);[^;]*;\\([A-Z][a-z]\\);" | 719 (while (re-search-forward "^\\([0-9A-Fa-f]*\\);[^;]*;\\([A-Z][a-z]\\);" |
718 nil | 720 nil |
719 t) | 721 t) |
720 (let* ((sym (intern (match-string-no-properties 2))) | 722 (let* ((sym (intern (match-string-no-properties 2))) |
721 (code (string-to-number (match-string-no-properties 1) | 723 (code (string-to-number (match-string-no-properties 1) |
740 'xsdre-ranges | 742 'xsdre-ranges |
741 (cons (cons (car last-range) code) | 743 (cons (cons (car last-range) code) |
742 (cdr ranges)))) | 744 (cdr ranges)))) |
743 (t | 745 (t |
744 (put sym 'xsdre-ranges (cons code ranges)))))) | 746 (put sym 'xsdre-ranges (cons code ranges)))))) |
745 (mapcar (lambda (x) | 747 (mapc (lambda (x) |
746 (put x | 748 (put x |
747 'xsdre-ranges | 749 'xsdre-ranges |
748 (nreverse (get x 'xsdre-ranges))) | 750 (nreverse (get x 'xsdre-ranges))) |
749 nil) | 751 nil) |
750 xsdre-gen-categories)) | 752 xsdre-gen-categories)) |
751 (mapcar (lambda (x) | 753 (mapc (lambda (x) |
752 (let ((start (point))) | 754 (let ((start (point))) |
753 (pp (list 'xsdre-def-primitive-category | 755 (pp (list 'xsdre-def-primitive-category |
754 (list 'quote x) | 756 (list 'quote x) |
755 (list 'quote (get x 'xsdre-ranges))) | 757 (list 'quote (get x 'xsdre-ranges))) |
756 (current-buffer)) | 758 (current-buffer)) |
757 (save-excursion | 759 (save-excursion |
758 (goto-char start) | 760 (goto-char start) |
759 (down-list 2) | 761 (down-list 2) |
760 (while (condition-case err | 762 (while (condition-case err |
761 (progn | 763 (progn |
762 (forward-sexp) | 764 (forward-sexp) |
763 t) | 765 t) |
764 (error nil)) | 766 (error nil)) |
765 (when (and (< 70 (current-column)) | 767 (when (and (< 70 (current-column)) |
766 (not (looking-at ")"))) | 768 (not (looking-at ")"))) |
767 (insert "\n") | 769 (insert "\n") |
768 (lisp-indent-line)))))) | 770 (lisp-indent-line)))))) |
769 xsdre-gen-categories)) | 771 xsdre-gen-categories)) |
770 | 772 |
771 (defun xsdre-def-primitive-category (sym ranges) | 773 (defun xsdre-def-primitive-category (sym ranges) |
772 (put sym 'xsdre-ranges ranges) | 774 (put sym 'xsdre-ranges ranges) |
773 (put sym 'xsdre-unicode-category t)) | 775 (put sym 'xsdre-unicode-category t)) |
774 | 776 |