diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-12-06 22:23:57 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-12-10 22:37:47 +0100 |
commit | ea93326cc046cb1beb7535cdf6d69b216b767685 (patch) | |
tree | 5494bab812fdaf3f7a2997cb70926bdf6ec13993 /doc/lispref/searching.texi | |
parent | 9546a2a0d6653a7d930cda722f5babbebb0a1d0c (diff) | |
download | emacs-ea93326cc046cb1beb7535cdf6d69b216b767685.tar.gz |
Add `union' and `intersection' to rx (bug#37849)
These character set operations, together with `not' for set
complement, improve the compositionality of rx, and reduce duplication
in complicated cases. Named character classes are not permitted in
set operations.
* lisp/emacs-lisp/rx.el (rx--translate-any): Split into multiple
functions.
(rx--foldl, rx--parse-any, rx--generate-alt, rx--intervals-to-alt)
(rx--complement-intervals, rx--intersect-intervals)
(rx--union-intervals, rx--charset-intervals, rx--charset-union)
(rx--charset-all, rx--charset-intersection, rx--translate-union)
(rx--translate-intersection): New.
(rx--translate-not, rx--translate-form, rx--builtin-forms, rx):
Add `union' and `intersection'.
* test/lisp/emacs-lisp/rx-tests.el (rx-union ,rx-def-in-union)
(rx-intersection, rx-def-in-intersection): New tests.
* doc/lispref/searching.texi (Rx Constructs):
* etc/NEWS:
Document `union' and `intersection'.
Diffstat (limited to 'doc/lispref/searching.texi')
-rw-r--r-- | doc/lispref/searching.texi | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 0cb30010c5e..5bf3c5b067f 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1214,11 +1214,21 @@ Corresponding string regexp: @samp{[@dots{}]} @item @code{(not @var{charspec})} @cindex @code{not} in rx Match a character not included in @var{charspec}. @var{charspec} can -be an @code{any}, @code{not}, @code{syntax} or @code{category} form, or a -character class.@* +be an @code{any}, @code{not}, @code{union}, @code{intersection}, +@code{syntax} or @code{category} form, or a character class.@* Corresponding string regexp: @samp{[^@dots{}]}, @samp{\S@var{code}}, @samp{\C@var{code}} +@item @code{(union @var{charset}@dots{})} +@itemx @code{(intersection @var{charset}@dots{})} +@cindex @code{union} in rx +@cindex @code{intersection} in rx +Match a character that matches the union or intersection, +respectively, of the @var{charset}s. Each @var{charset} can be an +@code{any} form without character classes, or a @code{union}, +@code{intersection} or @code{not} form whose arguments are also +@var{charset}s. + @item @code{not-newline}, @code{nonl} @cindex @code{not-newline} in rx @cindex @code{nonl} in rx |