mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
; use modern sort calls in more places
* lisp/emacs-lisp/regexp-opt.el (regexp-opt, regexp-opt-group): * lisp/emacs-lisp/rx.el (rx--parse-any): New-style calls, also faster.
This commit is contained in:
parent
8d3554683f
commit
8c71ef0f8e
2 changed files with 3 additions and 3 deletions
|
|
@ -140,7 +140,7 @@ usually more efficient than that of a simplified version:
|
|||
(open (cond ((stringp paren) paren) (paren "\\(")))
|
||||
(re (if strings
|
||||
(regexp-opt-group
|
||||
(delete-dups (sort (copy-sequence strings) 'string-lessp))
|
||||
(delete-dups (sort strings))
|
||||
(or open t) (not open))
|
||||
;; No strings: return an unmatchable regexp.
|
||||
(concat (or open "\\(?:") regexp-unmatchable "\\)"))))
|
||||
|
|
@ -250,7 +250,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
|
|||
(prefixes
|
||||
;; Sorting is necessary in cases such as ("ad" "d").
|
||||
(sort (mapcar (lambda (s) (substring s 0 n)) strings)
|
||||
'string-lessp)))
|
||||
:in-place t)))
|
||||
(concat open-group
|
||||
(regexp-opt-group prefixes t t)
|
||||
(regexp-quote (nreverse xiffus))
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ a list of named character classes in the order they occur in BODY."
|
|||
(cons (rx--condense-intervals
|
||||
(sort (append conses
|
||||
(mapcan #'rx--string-to-intervals strings))
|
||||
#'car-less-than-car))
|
||||
:key #'car :in-place t))
|
||||
(nreverse classes))))
|
||||
|
||||
(defun rx--generate-alt (negated intervals classes)
|
||||
|
|
|
|||
Loading…
Reference in a new issue