Mercurial > emacs
diff lisp/emacs-lisp/re-builder.el @ 112017:db006527425b
* lisp/emacs-lisp/rx.el: Make it a superset of sregex.
(rx-constituents): Add `any => "."', mark `repeat' as taking any number
of args, add `regex' alias.
(rx-info): Add arg to distinguish head and standalone forms.
(rx-check, rx-form): Pass the corresponding arg.
(rx-**): Simplify.
(rx-repeat): Make it work for any number of args.
(rx-syntax): Make it accept syntax chars as is.
* lisp/obsolete/sregex.el: Move from emacs-lisp/.
* lisp/emacs-lisp/re-builder.el: Remove sregex support.
* lisp/emacs-lisp/edebug.el (sregexq, rx): Remove redundant defs.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 26 Dec 2010 18:17:09 -0500 |
parents | 9a8064e866bb |
children | 417b1e4d63cd |
line wrap: on
line diff
--- a/lisp/emacs-lisp/re-builder.el Sat Dec 25 12:57:02 2010 +0200 +++ b/lisp/emacs-lisp/re-builder.el Sun Dec 26 18:17:09 2010 -0500 @@ -60,8 +60,8 @@ ;; even the auto updates go all the way. Forcing an update overrides ;; this limit allowing an easy way to see all matches. -;; Currently `re-builder' understands five different forms of input, -;; namely `read', `string', `rx', and `sregex' syntax. Read +;; Currently `re-builder' understands three different forms of input, +;; namely `read', `string', and `rx' syntax. Read ;; syntax and string syntax are both delimited by `"'s and behave ;; according to their name. With the `string' syntax there's no need ;; to escape the backslashes and double quotes simplifying the editing @@ -75,7 +75,7 @@ ;; When editing a symbolic regular expression, only the first ;; expression in the RE Builder buffer is considered, which helps ;; limiting the extent of the expression like the `"'s do for the text -;; modes. For the `sregex' syntax the function `sregex' is applied to +;; modes. For the `rx' syntax the function `rx-to-string' is applied to ;; the evaluated expression read. So you can use quoted arguments ;; with something like '("findme") or you can construct arguments to ;; your hearts delight with a valid ELisp expression. (The compiled @@ -126,11 +126,10 @@ (defcustom reb-re-syntax 'read "Syntax for the REs in the RE Builder. -Can either be `read', `string', `sregex', or `rx'." +Can either be `read', `string', or `rx'." :group 're-builder :type '(choice (const :tag "Read syntax" read) (const :tag "String syntax" string) - (const :tag "`sregex' syntax" sregex) (const :tag "`rx' syntax" rx))) (defcustom reb-auto-match-limit 200 @@ -279,10 +278,8 @@ emacs-lisp-mode "RE Builder Lisp" "Major mode for interactively building symbolic Regular Expressions." ;; Pull in packages as needed - (cond ((eq reb-re-syntax 'sregex) ; sregex is not autoloaded - (require 'sregex)) ; right now.. - ((eq reb-re-syntax 'rx) ; rx-to-string is autoloaded - (require 'rx))) ; require rx anyway + (cond ((memq reb-re-syntax '(sregex rx)) ; rx-to-string is autoloaded + (require 'rx))) ; require rx anyway (reb-mode-common)) ;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from @@ -612,9 +609,7 @@ (defun reb-cook-regexp (re) "Return RE after processing it according to `reb-re-syntax'." - (cond ((eq reb-re-syntax 'sregex) - (apply 'sregex (eval (car (read-from-string re))))) - ((eq reb-re-syntax 'rx) + (cond ((memq reb-re-syntax '(sregex rx)) (rx-to-string (eval (car (read-from-string re))))) (t re)))