emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/wisi 7cb03cb 10/35: * packages/ada-mode/* : version 5.1


From: Stefan Monnier
Subject: [elpa] externals/wisi 7cb03cb 10/35: * packages/ada-mode/* : version 5.1.5
Date: Sat, 28 Nov 2020 14:47:51 -0500 (EST)

branch: externals/wisi
commit 7cb03cbd53094e8f1e4fe28381f2a0acffacc7ad
Author: Stephen Leake <stephen_leake@stephe-leake.org>
Commit: Stephen Leake <stephen_leake@stephe-leake.org>

    * packages/ada-mode/* : version 5.1.5
    
    * packages/ada-mode/ada-mode.texi: New file.
    
    * packages/ada-mode/gpr-mode.texi: New file.
    
    * packages/wisi/* : version 1.0.5
---
 NEWS          |  7 ++++++
 wisi-parse.el |  8 +++++++
 wisi.el       | 71 ++++++++++++++++++++++++++++++++---------------------------
 3 files changed, 54 insertions(+), 32 deletions(-)

diff --git a/NEWS b/NEWS
index a1da0cf..9aa5938 100755
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,13 @@ Please send wisi bug reports to bug-gnu-emacs@gnu.org, with
 'wisi' in the subject. If possible, use M-x report-emacs-bug.
 
 
+* wisi 1.0.5
+12 Jul 2014
+
+** wisi-parse-max-parallel-current - new variable for debugging slow parsing 
issues
+
+** wisi-set-end - new algorithm giving significant speedup
+
 * wisi 1.0.4
 19 Apr 2014
 
diff --git a/wisi-parse.el b/wisi-parse.el
index 906d19b..bd7ce7e 100755
--- a/wisi-parse.el
+++ b/wisi-parse.el
@@ -75,6 +75,10 @@
 If a file needs more than this, it's probably an indication that
 the grammar is excessively redundant.")
 
+(defvar wisi-parse-max-parallel-current (cons 0 0)
+  "Cons (count . point); Maximum number of parallel parsers used in most 
recent parse,
+point at which that max was spawned.")
+
 (defvar wisi-debug 0
   "wisi debug mode:
 0 : normal - ignore parse errors, for indenting new code
@@ -107,6 +111,8 @@ the grammar is excessively redundant.")
         (token (funcall lexer))
         some-pending)
 
+    (setq wisi-parse-max-parallel-current (cons 0 0))
+
     (aset (wisi-parser-state-stack (aref parser-states 0)) 0 0) ;; Initial 
state
 
     (while (not (eq active 'accept))
@@ -144,6 +150,8 @@ the grammar is excessively redundant.")
                         )))
                  )
                (setq active-parser-count (1+ active-parser-count))
+               (when (> active-parser-count (car 
wisi-parse-max-parallel-current))
+                 (setq wisi-parse-max-parallel-current (cons 
active-parser-count (point))))
                (setf (wisi-parser-state-label result) j)
                (aset parser-states j result))
              (when (> wisi-debug 1)
diff --git a/wisi.el b/wisi.el
index 02a2b6e..d4cd8e6 100755
--- a/wisi.el
+++ b/wisi.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2012 - 2014  Free Software Foundation, Inc.
 ;;
 ;; Author: Stephen Leake <stephen_leake@member.fsf.org>
-;; Version: 1.0.4
+;; Version: 1.0.5
 ;; package-requires: ((cl-lib "0.4") (emacs "24.2"))
 ;; URL: http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html
 ;;
@@ -333,12 +333,16 @@ wisi-forward-token, but does not look up symbol."
 
 (defvar-local wisi-change-need-invalidate nil)
 
+(defvar wisi-end-caches nil
+  "List of buffer positions of caches in current statement that need 
wisi-cache-end set.")
+
 (defun wisi-invalidate-cache()
   "Invalidate the wisi token cache for the current buffer.
 Also invalidate the Emacs syntax cache."
   (interactive)
   (setq wisi-cache-max 0)
   (setq wisi-parse-try t)
+  (setq wisi-end-caches nil)
   (syntax-ppss-flush-cache (point-min))
   (with-silent-modifications
     (remove-text-properties (point-min) (point-max) '(wisi-cache))))
@@ -527,31 +531,29 @@ Point must be at cache."
 
 ;;;; parse actions
 
-(defun wisi-set-end (tokens end-mark)
-  "Set END-MARK on all unset caches in TOKENS."
-  (let ((tokens-t tokens))
-    (while tokens-t
-      (let* ((token (pop tokens-t))
-            (region (cddr token))
-            cache)
-       (when region
-         (goto-char (car region))
-         (setq cache (wisi-get-cache (car region)))
-         (when (not cache)
-           ;; token is non-terminal; first terminal doesn't have cache.
-           (setq cache (wisi-forward-cache)))
-         (while (and cache
-                     (< (point) (cdr region)))
-           (if (not (wisi-cache-end cache))
-               (setf (wisi-cache-end cache) end-mark)
-             (goto-char (wisi-cache-end cache))
-             )
-           (setq cache (wisi-forward-cache))
-           ))
-       ))
-    ))
+(defun wisi-set-end (start-mark end-mark)
+  "Set END-MARK on all caches in `wisi-end-caches' in range START-MARK 
END-MARK,
+delete from `wisi-end-caches'."
+  (let ((i 0)
+       pos cache)
+    (while (< i (length wisi-end-caches))
+      (setq pos (nth i wisi-end-caches))
+      (setq cache (wisi-get-cache pos))
+
+      (if (and (>= pos start-mark)
+              (<  pos end-mark))
+         (progn
+           (setf (wisi-cache-end cache) end-mark)
+           (setq wisi-end-caches (delq pos wisi-end-caches)))
+
+       ;; else not in range
+       (setq i (1+ i)))
+      )))
+
+(defvar wisi-tokens nil)
+;; keep byte-compiler happy; `wisi-tokens' is bound in action created
+;; by wisi-semantic-action
 
-(defvar wisi-tokens nil);; keep byte-compiler happy; `wisi-tokens' is bound in 
action created by wisi-semantic-action
 (defun wisi-statement-action (&rest pairs)
   "Cache information in text properties of tokens.
 Intended as a grammar non-terminal action.
@@ -618,22 +620,27 @@ that token. Use in a grammar action as:
                     (1+ (car region))
                     'wisi-cache
                     (wisi-cache-create
-                     :nonterm $nterm;; $nterm defined in wisi-semantic-action
-                     :token   token
-                     :last  (- (cdr region) (car region))
-                     :class   (or override-start class)
-                     :containing   first-keyword-mark)
-                    )))
+                     :nonterm    $nterm;; $nterm defined in 
wisi-semantic-action
+                     :token      token
+                     :last       (- (cdr region) (car region))
+                     :class      (or override-start class)
+                     :containing first-keyword-mark)
+                    ))
+                 (if wisi-end-caches
+                     (push (car region) wisi-end-caches)
+                   (setq wisi-end-caches (list (car region)))
+                   ))
 
                (when first-item
                  (setq first-item nil)
                  (when (or override-start
+                           ;; FIXME: why block-middle here?
                            (memq class '(block-middle block-start 
statement-start)))
                    (setq override-start nil)
                    (setq first-keyword-mark mark)))
 
                (when (eq class 'statement-end)
-                 (wisi-set-end wisi-tokens (copy-marker (1+ (car region)))))
+                 (wisi-set-end (1- first-keyword-mark) (copy-marker (1+ (car 
region)))))
                )
 
            ;; region is nil when a production is empty; if the first



reply via email to

[Prev in Thread] Current Thread [Next in Thread]