diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-10-07 18:28:18 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-10-18 14:46:06 +0200 |
commit | ae5407b8579feae17ab34ed9ac68149cc29387c9 (patch) | |
tree | 357255e1bf523e6d403c6ea066ec15a5852387a8 /lisp/emacs-lisp | |
parent | e5a446b0a706ddd4bedf973baeaf54f105198b09 (diff) | |
download | emacs-ae5407b8579feae17ab34ed9ac68149cc29387c9.tar.gz emacs-ae5407b8579feae17ab34ed9ac68149cc29387c9.tar.bz2 emacs-ae5407b8579feae17ab34ed9ac68149cc29387c9.zip |
Add `unmatchable' as alias for (or) in rx (bug#37659)
* lisp/emacs-lisp/rx.el (rx--translate-symbol, rx--builtin-symbols, rx):
* test/lisp/emacs-lisp/rx-tests.el (rx-atoms):
* doc/lispref/searching.texi (Rx Constructs):
* etc/NEWS:
Add `unmatchable', more descriptive than (or), and corresponding to
the variable `regexp-unmatchable'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/rx.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 6c0b2069302..cf02df239fe 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -126,7 +126,6 @@ Each entry is: (get name 'rx-definition))) ;; TODO: Additions to consider: -;; - A name for (or), maybe `unmatchable'. ;; - A construct like `or' but without the match order guarantee, ;; maybe `unordered-or'. Useful for composition or generation of ;; alternatives; permits more effective use of regexp-opt. @@ -138,6 +137,7 @@ Each entry is: ;; since the return value may be mutated. ((or 'nonl 'not-newline 'any) (cons (list ".") t)) ((or 'anychar 'anything) (rx--translate-form '(or nonl "\n"))) + ('unmatchable (rx--empty)) ((or 'bol 'line-start) (cons (list "^") 'lseq)) ((or 'eol 'line-end) (cons (list "$") 'rseq)) ((or 'bos 'string-start 'bot 'buffer-start) (cons (list "\\`") t)) @@ -912,7 +912,7 @@ can expand to any number of values." "List of built-in rx function-like symbols.") (defconst rx--builtin-symbols - (append '(nonl not-newline any anychar anything + (append '(nonl not-newline any anychar anything unmatchable bol eol line-start line-end bos eos string-start string-end bow eow word-start word-end @@ -1016,6 +1016,7 @@ CHAR Match a literal character. or a character class. not-newline Match any character except a newline. Alias: nonl. anychar Match any character. Alias: anything. +unmatchable Never match anything at all. CHARCLASS Match a character from a character class. One of: alpha, alphabetic, letter Alphabetic characters (defined by Unicode). |