summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/re-builder.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-12-26 18:17:09 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2010-12-26 18:17:09 -0500
commit723ee192a5b3c6ebf589d325d5d004e57ce42652 (patch)
tree64cf94c5c7fdda8f84f87767c8a612e58e27a8e6 /lisp/emacs-lisp/re-builder.el
parente77714da30b53ec866d2bbfd88527b215a715bb0 (diff)
downloademacs-723ee192a5b3c6ebf589d325d5d004e57ce42652.tar.gz
* 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.
Diffstat (limited to 'lisp/emacs-lisp/re-builder.el')
-rw-r--r--lisp/emacs-lisp/re-builder.el19
1 files changed, 7 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 1845effd5bb..eacabf72c95 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -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 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
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 @@ optional fourth argument FORCE is non-nil."
(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)))