From eb6f017f823ff323570a76941e69218fbd07de8d Mon Sep 17 00:00:00 2001 From: David Aspinall Date: Wed, 22 Sep 2010 09:56:59 +0000 Subject: Fix some bugs in coq regexp generation --- coq/coq-db.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'coq/coq-db.el') diff --git a/coq/coq-db.el b/coq/coq-db.el index 020e3291..a91fb3c9 100644 --- a/coq/coq-db.el +++ b/coq/coq-db.el @@ -93,17 +93,20 @@ regexp. See `coq-syntax-db' for DB structure." (let ((l db) res) (while l (let* ((hd (car l)) (tl (cdr l)) ; hd is the first infos list - (color (concat "\\_<" (nth 4 hd) "\\_>"))) ; colorization string -; (color (nth 4 hd))) ; colorization string + (color (nth 4 hd))) ; colorization string +; da: do this below, otherwise we get empty words in result!! +; (color (concat "\\_<" (nth 4 hd) "\\_>"))) ; colorization string ;; TODO delete doublons (when (and color (or (not filter) (funcall filter hd))) - (setq res (nconc res (list color)))) ; careful: nconc destructive! + (setq res + (nconc res (list + (concat "\\_<" color "\\_>"))))) (setq l tl))) res)) (defun coq-build-opt-regexp-from-db (db &optional filter) "Take a keyword database DB and return a regexps for font-lock. -If non-nil Optional argument FILTER is a function applying to each line of DB. +If non-nil optional argument FILTER is a function applying to each line of DB. For each line if FILTER returns nil, then the keyword is not added to the regexp. See `coq-syntax-db' for DB structure." (let ((l db) res) @@ -114,7 +117,9 @@ regexp. See `coq-syntax-db' for DB structure." (when (and color (or (not filter) (funcall filter hd))) (setq res (nconc res (list color)))) ; careful: nconc destructive! (setq l tl))) - (proof-ids-to-regexp res))) +; da: next call is wrong? +; (proof-ids-to-regexp res))) + (proof-regexp-alt-list res))) ;; Computes the max length of strings in a list -- cgit v1.2.3