aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMattias Engdegård2019-10-09 10:22:10 +0200
committerMattias Engdegård2019-10-18 14:46:12 +0200
commit6331d23de3a861de2374be2c03b42e3a2f150792 (patch)
tree1efa44e4818ae482688a3872154592597eed6488 /lisp
parentae5407b8579feae17ab34ed9ac68149cc29387c9 (diff)
downloademacs-6331d23de3a861de2374be2c03b42e3a2f150792.tar.gz
emacs-6331d23de3a861de2374be2c03b42e3a2f150792.zip
Use [^z-a] for matching any character (anychar/anything) in rx
* lisp/emacs-lisp/rx.el (rx--translate-symbol): * test/lisp/emacs-lisp/rx-tests.el (rx-any, rx-atoms): Use [^z-a] instead of ".\\|\n" for anychar. The new expression is faster (about 2×) and does not allocate regexp stack space. For example, (0+ anychar) now matches strings of any size (bug#37659).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/rx.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index cf02df239fe..87b3133b7f5 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -136,7 +136,7 @@ Each entry is:
136 ;; Use `list' instead of a quoted list to wrap the strings here, 136 ;; Use `list' instead of a quoted list to wrap the strings here,
137 ;; since the return value may be mutated. 137 ;; since the return value may be mutated.
138 ((or 'nonl 'not-newline 'any) (cons (list ".") t)) 138 ((or 'nonl 'not-newline 'any) (cons (list ".") t))
139 ((or 'anychar 'anything) (rx--translate-form '(or nonl "\n"))) 139 ((or 'anychar 'anything) (cons (list "[^z-a]") t))
140 ('unmatchable (rx--empty)) 140 ('unmatchable (rx--empty))
141 ((or 'bol 'line-start) (cons (list "^") 'lseq)) 141 ((or 'bol 'line-start) (cons (list "^") 'lseq))
142 ((or 'eol 'line-end) (cons (list "$") 'rseq)) 142 ((or 'eol 'line-end) (cons (list "$") 'rseq))