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 /etc | |
| 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 'etc')
| -rw-r--r-- | etc/NEWS | 6 |
1 files changed, 6 insertions, 0 deletions
| @@ -2325,6 +2325,12 @@ expressions from simpler parts. | |||
| 2325 | +++ | 2325 | +++ |
| 2326 | *** 'not' argument can now be a character or single-char string. | 2326 | *** 'not' argument can now be a character or single-char string. |
| 2327 | 2327 | ||
| 2328 | +++ | ||
| 2329 | *** Nested 'or' forms of strings guarantee a longest match. | ||
| 2330 | For example, (or (or "IN" "OUT") (or "INPUT" "OUTPUT")) now matches | ||
| 2331 | the whole string "INPUT" if present, not just "IN". Previously, this | ||
| 2332 | was only guaranteed inside a single 'or' form of string literals. | ||
| 2333 | |||
| 2328 | ** Frames | 2334 | ** Frames |
| 2329 | 2335 | ||
| 2330 | +++ | 2336 | +++ |