[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/trie e1be744 030/111: Bug-fix in trie--do-wildcard-sear
From: |
Stefan Monnier |
Subject: |
[elpa] externals/trie e1be744 030/111: Bug-fix in trie--do-wildcard-search |
Date: |
Mon, 14 Dec 2020 11:35:14 -0500 (EST) |
branch: externals/trie
commit e1be744f7e5fdd64ca35a6516df00f4142da06c7
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <toby-predictive@dr-qubit.org>
Bug-fix in trie--do-wildcard-search
---
trie.el | 44 +++++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 17 deletions(-)
diff --git a/trie.el b/trie.el
index 642af33..34df39a 100644
--- a/trie.el
+++ b/trie.el
@@ -1681,16 +1681,17 @@ wildcards will be particularly slow."
;; if pattern is null, accumulate data from current node
(if (null pattern)
- (unless (null group-stack)
- (error "Syntax error in trie wildcard pattern: missing \")\""))
- (when (setq node (trie--find-data-node node lookupfun))
- (setq groups
- (sort groups
- (lambda (a b)
- (or (< (car a) (car b))
- (and (= (car a) (car b))
- (> (cdr a) (cdr b)))))))
- (funcall accumulator node (if groups (cons seq groups) seq)))
+ (progn
+ (unless (null group-stack)
+ (error "Syntax error in trie wildcard pattern: missing \")\""))
+ (when (setq node (trie--find-data-node node lookupfun))
+ (setq groups
+ (sort groups
+ (lambda (a b)
+ (or (< (car a) (car b))
+ (and (= (car a) (car b))
+ (> (cdr a) (cdr b)))))))
+ (funcall accumulator node (if groups (cons seq groups) seq))))
;; otherwise, extract first pattern element and act on it
(setq pattern (trie--wildcard-parse-pattern pattern))
@@ -1730,11 +1731,19 @@ wildcards will be particularly slow."
;; terminal *: accumulate everything below current node
((and (null pattern) (trie--wildcard-*-p el))
- (trie--mapc accumulator mapfun node seq
- (if maxnum reverse (not reverse))))
-
- ;; terminal * then ): accumulate everything below current node and
- ;; close group(s)
+ (unless (null group-stack)
+ (error "Syntax error in trie wildcard pattern: missing \")\""))
+ (let ((grps (sort (copy-sequence groups)
+ (lambda (a b)
+ (or (< (car a) (car b))
+ (and (= (car a) (car b))
+ (> (cdr a) (cdr b))))))))
+ (trie--mapc
+ (lambda (node seq) (funcall accumulator node (cons seq grps)))
+ mapfun node seq (if maxnum reverse (not reverse)))))
+
+ ;; terminal * and ): accumulate everything below current node and
+ ;; close group(s)
((and (trie--wildcard-*-p el)
(catch 'not-group
(dolist (el pattern)
@@ -1745,10 +1754,11 @@ wildcards will be particularly slow."
(let ((grp-stack group-stack)
(grps (copy-sequence groups))
(pat pattern))
- (dotimes (i (trie--wildcard-group-count el))
+ (while pat
(if (null grp-stack)
(error "Syntax error in trie wildcard pattern: missing
\"(\"")
- (push (cons (pop grp-stack) idx) grps)))
+ (push (cons (pop grp-stack) idx) grps)
+ (setq pat (cdr pat))))
(unless (null grp-stack)
(error "Syntax error in trie wildcard pattern: missing \")\""))
(setq grps
- [elpa] externals/trie 4dc003b 006/111: Fixed bug when deleting non-existent entries., (continued)
- [elpa] externals/trie 4dc003b 006/111: Fixed bug when deleting non-existent entries., Stefan Monnier, 2020/12/14
- [elpa] externals/trie d998322 011/111: Made trie--terminator symbol into a configurable defconst., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 6cdaed0 046/111: Removed left-over debugging code and other minor tidying., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 160f092 054/111: Revert "Replaced advice with cedet-edebug.el for pretty-printing", Stefan Monnier, 2020/12/14
- [elpa] externals/trie defa7e0 053/111: Replaced advice with cedet-edebug.el for pretty-printing, Stefan Monnier, 2020/12/14
- [elpa] externals/trie af10bd5 043/111: Bug-fix in trie--do-regexp-search, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 58c6685 014/111: Replaced bare avl-trees, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 9f5b6c2 060/111: Simplified persistent-storage code for tries and dict-trees., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 6aa6701 033/111: Added optional RESULTFUN argument to trie query functions,, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 2345832 047/111: Advised edebug-prin1 and edebug-prin1-to-string to prevent edebug hanging, Stefan Monnier, 2020/12/14
- [elpa] externals/trie e1be744 030/111: Bug-fix in trie--do-wildcard-search,
Stefan Monnier <=
- [elpa] externals/trie e00ae36 058/111: Trivial docstring and comment fixes., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 153d2d4 048/111: Require advice when compiling, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 6d76748 028/111: Allow "]" to be included in a negated character alternatives, by placing immediately after the "[^"., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 00300c4 074/111: Revert trie--node-data defsetf, since it seems to work now., Stefan Monnier, 2020/12/14
- [elpa] externals/trie dd26bb3 023/111: more trivial docstring changes, Stefan Monnier, 2020/12/14
- [elpa] externals/trie bc12ecb 072/111: Exploit lexical closures to allow byte-compilation of wrapped functions., Stefan Monnier, 2020/12/14
- [elpa] externals/trie e88f10d 069/111: Remove ChangeLogs from library headers., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 4efa42d 067/111: Fix trie--node-data defsetf, so it compiles in latest Emacs trunk., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 9986ac7 068/111: Restore trie print/read transformer functions., Stefan Monnier, 2020/12/14
- [elpa] externals/trie ec5396c 071/111: Suppress bogus unused lexical variable byte-compiler warnings., Stefan Monnier, 2020/12/14