summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-05-20 17:38:03 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2019-05-20 17:38:03 +0200
commitc2cda3ff4025e8c27bdfc2a5279f3b635c8df260 (patch)
tree20d58564a6aa5dcbd6fc1c9fd94e95738dceeeb7 /lisp/emacs-lisp
parentd3a0ddedba53b9e2c99274c8ec125d53f991da5d (diff)
downloademacs-c2cda3ff4025e8c27bdfc2a5279f3b635c8df260.tar.gz
emacs-c2cda3ff4025e8c27bdfc2a5279f3b635c8df260.tar.bz2
emacs-c2cda3ff4025e8c27bdfc2a5279f3b635c8df260.zip
Revert "Allow zero-argument rx `or' and `seq' forms"
This reverts commit b552fc05c231ca6800330a318d3a74ddd0f5a13c. It caused a bootstrapping failure which I have yet to resolve - sorry.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/rx.el13
1 files changed, 5 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 9478bd3bbdb..9d9028d87d5 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -110,11 +110,11 @@
;; FIXME: support macros.
(defvar rx-constituents ;Not `const' because some modes extend it.
- '((and . (rx-and 0 nil))
+ '((and . (rx-and 1 nil))
(seq . and) ; SRE
(: . and) ; SRE
(sequence . and) ; sregex
- (or . (rx-or 0 nil))
+ (or . (rx-or 1 nil))
(| . or) ; SRE
(not-newline . ".")
(nonl . not-newline) ; SRE
@@ -390,11 +390,9 @@ FORM is of the form `(and FORM1 ...)'."
"Parse and produce code from FORM, which is `(or FORM1 ...)'."
(rx-check form)
(rx-group-if
- (cond
- ((null (cdr form)) regexp-unmatchable)
- ((cl-every #'stringp (cdr form))
+ (if (memq nil (mapcar 'stringp (cdr form)))
+ (mapconcat (lambda (x) (rx-form x '|)) (cdr form) "\\|")
(regexp-opt (cdr form) nil t))
- (t (mapconcat (lambda (x) (rx-form x '|)) (cdr form) "\\|")))
(and (memq rx-parent '(: * t)) rx-parent)))
@@ -1123,7 +1121,6 @@ CHAR
`(seq SEXP1 SEXP2 ...)'
`(sequence SEXP1 SEXP2 ...)'
matches what SEXP1 matches, followed by what SEXP2 matches, etc.
- Without arguments, matches the empty string.
`(submatch SEXP1 SEXP2 ...)'
`(group SEXP1 SEXP2 ...)'
@@ -1139,7 +1136,7 @@ CHAR
`(| SEXP1 SEXP2 ...)'
matches anything that matches SEXP1 or SEXP2, etc. If all
args are strings, use `regexp-opt' to optimize the resulting
- regular expression. Without arguments, never matches anything.
+ regular expression.
`(minimal-match SEXP)'
produce a non-greedy regexp for SEXP. Normally, regexps matching