diff options
| author | Mattias EngdegÄrd | 2020-02-11 20:04:42 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2020-03-01 10:47:14 +0100 |
| commit | 49d3cd90bd80a225d5ec26027318ffb4606ff513 (patch) | |
| tree | 13ba7b7faec7014b626d1c4dfdbfec98df44631f /doc/lispref | |
| parent | 6b48aedb6b3b1de0b41b61b727d14ab8277d2f73 (diff) | |
| download | emacs-49d3cd90bd80a225d5ec26027318ffb4606ff513.tar.gz emacs-49d3cd90bd80a225d5ec26027318ffb4606ff513.zip | |
rx: Improve 'or' compositionality (bug#37659)
Perform 'regexp-opt' on nested 'or' forms, and after expansion of
user-defined and 'eval' forms. Characters are now turned into strings
for wider 'regexp-opt' scope. This preserves the longest-match
semantics for string in 'or' forms over composition.
* doc/lispref/searching.texi (Rx Constructs): Document.
* lisp/emacs-lisp/rx.el (rx--normalise-or-arg)
(rx--all-string-or-args): New.
(rx--translate-or): Normalise arguments first, and check for strings
in subforms.
(rx--expand-eval): Extracted from rx--translate-eval.
(rx--translate-eval): Call rx--expand-eval.
* test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-def-in-or): Add tests.
* etc/NEWS: Announce.
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/searching.texi | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index a4d5a27203f..1a090ebe101 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -1086,8 +1086,9 @@ Corresponding string regexp: @samp{@var{A}@var{B}@dots{}} | |||
| 1086 | @itemx @code{(| @var{rx}@dots{})} | 1086 | @itemx @code{(| @var{rx}@dots{})} |
| 1087 | @cindex @code{|} in rx | 1087 | @cindex @code{|} in rx |
| 1088 | Match exactly one of the @var{rx}s. | 1088 | Match exactly one of the @var{rx}s. |
| 1089 | If all arguments are string literals, the longest possible match | 1089 | If all arguments are strings, characters, or @code{or} forms |
| 1090 | will always be used. Otherwise, either the longest match or the | 1090 | so constrained, the longest possible match will always be used. |
| 1091 | Otherwise, either the longest match or the | ||
| 1091 | first (in left-to-right order) will be used. | 1092 | first (in left-to-right order) will be used. |
| 1092 | Without arguments, the expression will not match anything at all.@* | 1093 | Without arguments, the expression will not match anything at all.@* |
| 1093 | Corresponding string regexp: @samp{@var{A}\|@var{B}\|@dots{}}. | 1094 | Corresponding string regexp: @samp{@var{A}\|@var{B}\|@dots{}}. |