[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/trie 333151b 045/111: Bug-fix in trie--do-regexp-search
From: |
Stefan Monnier |
Subject: |
[elpa] externals/trie 333151b 045/111: Bug-fix in trie--do-regexp-search relating to accumulation of results |
Date: |
Mon, 14 Dec 2020 11:35:17 -0500 (EST) |
branch: externals/trie
commit 333151b3f6c6726940084cafe953c73d5cc21d5d
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <toby-predictive@dr-qubit.org>
Bug-fix in trie--do-regexp-search relating to accumulation of results
---
trie.el | 49 ++++++++++++++++++++++++++++++-------------------
1 file changed, 30 insertions(+), 19 deletions(-)
diff --git a/trie.el b/trie.el
index e2b557f..e73c0a1 100644
--- a/trie.el
+++ b/trie.el
@@ -1645,8 +1645,8 @@ default key-data cons cell."
(trie--root trie)
(tNFA-from-regexp regexp :test (trie--construct-equality-function
(trie--comparison-function trie)))
- (cond ((stringp regexp) "") ((listp regexp) ()) (t []))
- 0 (or (and maxnum reverse) (and (not maxnum) (not reverse)))
+ (cond ((stringp regexp) "") ((listp regexp) ()) (t [])) 0
+ (or (and maxnum reverse) (and (not maxnum) (not reverse)))
(trie--comparison-function trie)
(trie--lookupfun trie)
(trie--mapfun trie))))
@@ -1663,8 +1663,9 @@ default key-data cons cell."
;; trie functions.
(declare (special accumulator))
- ;; if NFA has matched, check if trie contains current string
- (when (tNFA-match-p tNFA)
+ ;; if NFA has matched and we're accumulating in normal order, check if
+ ;; trie contains current string
+ (when (and (not reverse) (tNFA-match-p tNFA))
(let (node groups)
(when (setq node (trie--find-data-node
--trie--regexp-search--node lookupfun))
@@ -1674,25 +1675,25 @@ default key-data cons cell."
(trie--node-data node)))))
(cond
- ;; data node
- ((trie--node-data-p --trie--regexp-search--node)
- (when (tNFA-match-p tNFA)
- (let ((groups (tNFA-group-data tNFA)))
- (funcall accumulator
- (if groups (cons seq groups) seq)
- (trie--node-data --trie--regexp-search--node)))))
+ ;; ;; data node
+ ;; ((trie--node-data-p --trie--regexp-search--node)
+ ;; (when (tNFA-match-p tNFA)
+ ;; (let ((groups (tNFA-group-data tNFA)))
+ ;; (funcall accumulator
+ ;; (if groups (cons seq groups) seq)
+ ;; (trie--node-data --trie--regexp-search--node)))))
;; wildcard transition: map over all nodes in subtree
((tNFA-wildcard-p tNFA)
(let (state groups)
(funcall mapfun
(lambda (node)
- (if (trie--node-data-p node)
- (when (tNFA-match-p tNFA)
- (setq groups (tNFA-group-data tNFA))
- (funcall accumulator
- (if groups (cons seq groups) seq)
- (trie--node-data node)))
+ (unless (trie--node-data-p node)
+ ;; (when (tNFA-match-p tNFA)
+ ;; (setq groups (tNFA-group-data tNFA))
+ ;; (funcall accumulator
+ ;; (if groups (cons seq groups) seq)
+ ;; (trie--node-data node)))
(when (setq state (tNFA-next-state
tNFA (trie--node-split node) pos))
(trie--do-regexp-search
@@ -1715,8 +1716,18 @@ default key-data cons cell."
(setq state (tNFA-next-state tNFA chr pos)))
(trie--do-regexp-search
node state (trie--seq-append seq chr) (1+ pos)
- reverse comparison-function lookupfun mapfun)))))
- ))
+ reverse comparison-function lookupfun mapfun))))))
+
+ ;; if NFA has matched and we're accumulating in reverse order, check if
+ ;; trie contains current string
+ (when (and reverse (tNFA-match-p tNFA))
+ (let (node groups)
+ (when (setq node (trie--find-data-node
+ --trie--regexp-search--node lookupfun))
+ (setq groups (tNFA-group-data tNFA))
+ (funcall accumulator
+ (if groups (cons seq groups) seq)
+ (trie--node-data node))))))
- [elpa] externals/trie 0c21bf4 073/111: Add note to self to use cust-print pretty-printing instead of advice., (continued)
- [elpa] externals/trie 0c21bf4 073/111: Add note to self to use cust-print pretty-printing instead of advice., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 490c011 025/111: Bug fixes to trie--wildcard-stack-repopulate, Stefan Monnier, 2020/12/14
- [elpa] externals/trie f398b8e 063/111: Updated copyright attribution and license (GPL2 -> GPL3)., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 14fa4ee 075/111: Code cleanup., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 1e246d0 009/111: Bug-fix to remove setf inside backquote construct from trie-insert, Stefan Monnier, 2020/12/14
- [elpa] externals/trie ecf872e 061/111: Updated Package-Version, Package-Requires, and Keywords package headers., Stefan Monnier, 2020/12/14
- [elpa] externals/trie d746b4d 017/111: Added safeguards to throw errors if stack operations attempted, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 304b8e9 059/111: Added fboundp guard around ad-define-subr-args (removed in Emacs-24)., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 0ecad1b 016/111: Fixed avl type trie--createfun to accept (and ignore) extra seq argument, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 1b3b473 031/111: Another bug-fix in trie--do-wildcard-search, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 333151b 045/111: Bug-fix in trie--do-regexp-search relating to accumulation of results,
Stefan Monnier <=
- [elpa] externals/trie cc94506 070/111: Enable lexical binding, and fix issues it picks up., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 6a449ed 049/111: Improved edebug-prin1 advice, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 7bf9008 100/111: Implement fuzzy-completion with fixed initial prefix segment., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 3117b5b 076/111: Fix bugs in trie searches introduced by code cleanup., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 5909c59 083/111: Include prefix length information in fuzzy completion results., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 18dc856 084/111: Don't wrap rank and filter functions for regexp and fuzzy queries., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 633c8b1 089/111: Mention iterator generators in Commentary., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 1eb515f 078/111: Implement trie fuzzy match and completion stacks., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 3b7aa3c 082/111: Document that fuzzy queries with distance 0 won't work., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 53146c1 080/111: Implement fuzzy match and completion on dict-trees., Stefan Monnier, 2020/12/14