diff options
| author | Stefan Monnier | 2012-08-10 17:03:10 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-08-10 17:03:10 -0400 |
| commit | daa9f1a6076ee5e54c8b56b321bc1d2d991a15c6 (patch) | |
| tree | dc8d57ac20b4135b872e62e068840298c76a6b3d | |
| parent | 9d2ed8a27e459dd09cf3f770bae5127f21debc34 (diff) | |
| download | emacs-daa9f1a6076ee5e54c8b56b321bc1d2d991a15c6.tar.gz emacs-daa9f1a6076ee5e54c8b56b321bc1d2d991a15c6.zip | |
* lisp/emacs-lisp/rx.el (rx-constituents): Don't define as constant.
(rx-form): Simplify.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/rx.el | 47 |
2 files changed, 30 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c715059c135..c2e45204026 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-08-10 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/rx.el (rx-constituents): Don't define as constant. | ||
| 4 | (rx-form): Simplify. | ||
| 5 | |||
| 1 | 2012-08-09 Dmitry Gutov <dgutov@yandex.ru> | 6 | 2012-08-09 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 7 | ||
| 3 | Merge stuff from upsteam ruby-mode, part 1 (bug#12169). | 8 | Merge stuff from upsteam ruby-mode, part 1 (bug#12169). |
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index a0fb15ae39f..774c6cd2c38 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el | |||
| @@ -107,7 +107,9 @@ | |||
| 107 | 107 | ||
| 108 | ;;; Code: | 108 | ;;; Code: |
| 109 | 109 | ||
| 110 | (defconst rx-constituents | 110 | ;; FIXME: support macros. |
| 111 | |||
| 112 | (defvar rx-constituents ;Not `const' because some modes extend it. | ||
| 111 | '((and . (rx-and 1 nil)) | 113 | '((and . (rx-and 1 nil)) |
| 112 | (seq . and) ; SRE | 114 | (seq . and) ; SRE |
| 113 | (: . and) ; SRE | 115 | (: . and) ; SRE |
| @@ -831,27 +833,28 @@ If FORM is '(minimal-match FORM1)', non-greedy versions of `*', | |||
| 831 | FORM is a regular expression in sexp form. | 833 | FORM is a regular expression in sexp form. |
| 832 | RX-PARENT shows which type of expression calls and controls putting of | 834 | RX-PARENT shows which type of expression calls and controls putting of |
| 833 | shy groups around the result and some more in other functions." | 835 | shy groups around the result and some more in other functions." |
| 834 | (if (stringp form) | 836 | (cond |
| 835 | (rx-group-if (regexp-quote form) | 837 | ((stringp form) |
| 836 | (if (and (eq rx-parent '*) (< 1 (length form))) | 838 | (rx-group-if (regexp-quote form) |
| 837 | rx-parent)) | 839 | (if (and (eq rx-parent '*) (< 1 (length form))) |
| 838 | (cond ((integerp form) | 840 | rx-parent))) |
| 839 | (regexp-quote (char-to-string form))) | 841 | ((integerp form) |
| 840 | ((symbolp form) | 842 | (regexp-quote (char-to-string form))) |
| 841 | (let ((info (rx-info form nil))) | 843 | ((symbolp form) |
| 842 | (cond ((stringp info) | 844 | (let ((info (rx-info form nil))) |
| 843 | info) | 845 | (cond ((stringp info) |
| 844 | ((null info) | 846 | info) |
| 845 | (error "Unknown rx form `%s'" form)) | 847 | ((null info) |
| 846 | (t | 848 | (error "Unknown rx form `%s'" form)) |
| 847 | (funcall (nth 0 info) form))))) | 849 | (t |
| 848 | ((consp form) | 850 | (funcall (nth 0 info) form))))) |
| 849 | (let ((info (rx-info (car form) 'head))) | 851 | ((consp form) |
| 850 | (unless (consp info) | 852 | (let ((info (rx-info (car form) 'head))) |
| 851 | (error "Unknown rx form `%s'" (car form))) | 853 | (unless (consp info) |
| 852 | (funcall (nth 0 info) form))) | 854 | (error "Unknown rx form `%s'" (car form))) |
| 853 | (t | 855 | (funcall (nth 0 info) form))) |
| 854 | (error "rx syntax error at `%s'" form))))) | 856 | (t |
| 857 | (error "rx syntax error at `%s'" form)))) | ||
| 855 | 858 | ||
| 856 | 859 | ||
| 857 | ;;;###autoload | 860 | ;;;###autoload |