[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tNFA 1af1e58 22/23: Implement trie-fuzzy-match and trie
From: |
Stefan Monnier |
Subject: |
[elpa] externals/tNFA 1af1e58 22/23: Implement trie-fuzzy-match and trie-fuzzy-complete functions. |
Date: |
Mon, 14 Dec 2020 12:08:32 -0500 (EST) |
branch: externals/tNFA
commit 1af1e58d974fded9b320b7b53c952d66b43538f5
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Implement trie-fuzzy-match and trie-fuzzy-complete functions.
Searches a trie for matches or completions within a given Lewenstein
distance
of a string.
---
tNFA.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/tNFA.el b/tNFA.el
index 7605481..370d6eb 100644
--- a/tNFA.el
+++ b/tNFA.el
@@ -80,7 +80,7 @@
;;; ================================================================
;;; Replcements for CL functions
-(defun* tNFA--assoc (item alist &key (test 'eq))
+(defun* tNFA--assoc (item alist &key (test #'eq))
;; Return first cons cell in ALIST whose CAR matches ITEM according to
;; :test function (defaulting to `eq')
(while (and alist
@@ -312,14 +312,14 @@
(:constructor tNFA--DFA-state--create
(list pool
&key
- (test 'eq)
+ (test #'eq)
&aux
(transitions ())))
(:copier nil))
list transitions test wildcard match pool)
-(defun* tNFA--DFA-state-create (state-list state-pool &key (test 'eq))
+(defun* tNFA--DFA-state-create (state-list state-pool &key (test #'eq))
;; create DFA state and add it to the state pool
(let ((DFA-state (tNFA--DFA-state--create
state-list state-pool :test test))
@@ -361,10 +361,10 @@
DFA-state))
-(defun* tNFA--DFA-state-create-initial (state-list &key (test 'eq))
+(defun* tNFA--DFA-state-create-initial (state-list &key (test #'eq))
;; create initial DFA state from initial tNFA state INITIAL-STATE
(tNFA--DFA-state-create state-list
- (make-hash-table :test 'equal)
+ (make-hash-table :test #'equal)
:test test))
@@ -379,7 +379,7 @@
(defun tNFA-transitions (state)
"Return list of literal transitions from tNFA state STATE."
- (mapcar 'car (tNFA--DFA-state-transitions state)))
+ (mapcar #'car (tNFA--DFA-state-transitions state)))
@@ -458,7 +458,7 @@
;;; Regexp -> tNFA
;;;###autoload
-(defun* tNFA-from-regexp (regexp &key (test 'eq))
+(defun* tNFA-from-regexp (regexp &key (test #'eq))
"Create a tagged NFA that recognizes the regular expression REGEXP.
The return value is the initial state of the tagged NFA.
@@ -484,7 +484,7 @@ beginning and end of the regexp to get an unanchored
match)."
(declare (special NFA--state-id))
(destructuring-bind (fragment num-tags min-tags max-tags regexp)
(let ((NFA--state-id -1))
- (tNFA--from-regexp (append regexp nil) 0 '() '() 'top-level))
+ (tNFA--from-regexp (append regexp nil) 0 '() '() 'top))
(if regexp
(error "Syntax error in regexp: missing \"(\"")
(setf (tNFA--NFA-state-type (tNFA--fragment-final fragment))
@@ -511,10 +511,10 @@ beginning and end of the regexp to get an unanchored
match)."
(defun tNFA--from-regexp (regexp num-tags min-tags max-tags
- &optional top-level shy-group)
+ &optional toplevel shy-group)
;; Construct a tagged NFA fragment from REGEXP, up to first end-group
;; character or end of REGEXP. The TAGS arguments are used to pass the
- ;; tags created so far. A non-nil TOP-LEVEL indicates that REGEXP is
+ ;; tags created so far. A non-nil TOPLEVEL indicates that REGEXP is
;; the complete regexp, so we're constructing the entire tNFA. A
;; non-nil SHY-GROUP indicates that we're constructing a shy subgroup
;; fragment. (Both optional arguments are only used for spotting
@@ -541,12 +541,12 @@ beginning and end of the regexp to get an unanchored
match)."
;; ----- construct new fragment -----
(cond
;; syntax error: missing )
- ((and (null type) (not top-level))
+ ((and (null type) (not toplevel))
(error "Syntax error in regexp:\
extra \"(\" or missing \")\""))
;; syntax error: extra )
- ((and (eq type 'shy-group-end) top-level)
+ ((and (eq type 'shy-group-end) toplevel)
(error "Syntax error in regexp:\
extra \")\" or missing \"(\""))
@@ -1042,7 +1042,7 @@ POS in a string."
;;; tNFA matching
;;;###autoload
-(defun* tNFA-regexp-match (regexp string &key (test 'eq))
+(defun* tNFA-regexp-match (regexp string &key (test #'eq))
"Return non-nil if STRING matches REGEXP, nil otherwise.
Sets the match data if there was a match; see `match-beginning',
`match-end' and `match-string'.
- [elpa] externals/tNFA f150b88 06/23: Added support for \{...\} postfix repetition operator, (continued)
- [elpa] externals/tNFA f150b88 06/23: Added support for \{...\} postfix repetition operator, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 3835750 17/23: Trivial whitespace tidying., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 664c98e 20/23: Remove ChangeLogs from library headers., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 892122c 23/23: Tidy up unnecessary macros by making them into defsubst or defun., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA c9f0989 04/23: Converted transition hash tables to alists, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 74b68dd 16/23: Updated copyright attribution and license (GPL2 -> GPL3)., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 241dd74 03/23: Bug-fix in tNFA--from-regexp; added public tNFA-group-data function., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 9e1ca74 13/23: Added changelog entries, and bumped tNFA version number., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 83ab8b3 10/23: Re-filled to 72 chars/line, for mailing to gnu-emacs-sources list, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA b457403 14/23: Trivial docstring and comment fixes., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 1af1e58 22/23: Implement trie-fuzzy-match and trie-fuzzy-complete functions.,
Stefan Monnier <=
- [elpa] externals/tNFA 7b44eeb 02/23: Bug-fix in tNFA--from-regexp: add tag transitions *outside* their group fragment,, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 5463a53 07/23: Bug-fix to \{...\} postfix operator processing in tNFA--from-regexp, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 4771c2f 12/23: Redefined tNFA--NFA-state-create and tNFA--NFA-state-create-tag using defun, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 5f3bdf7 21/23: Enable lexical binding, and fix issues it picks up., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 7e38f4c 19/23: Add missing autoload cookies., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 454c544 09/23: Added commentary, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA 9a742f6 01/23: Implementation of tagged non-deterministic finite state automata, for regular expression matching, Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA b035e48 11/23: Removed left-over debugging code and other minor tidying., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA ff30781 18/23: More minor whitespace and commentary changes., Stefan Monnier, 2020/12/14
- [elpa] externals/tNFA c5004e1 08/23: Updated docstrings for regexp-related functions and others., Stefan Monnier, 2020/12/14