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

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

[elpa] externals/wisi 2f33bf8 21/35: Release Ada mode 5.3.1, wisi 1.1.6


From: Stefan Monnier
Subject: [elpa] externals/wisi 2f33bf8 21/35: Release Ada mode 5.3.1, wisi 1.1.6
Date: Sat, 28 Nov 2020 14:47:53 -0500 (EST)

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

    Release Ada mode 5.3.1, wisi 1.1.6
    
    * packages/ada-mode/*: Release Ada mode 5.3.1.
    
    * packages/ada-mode/ada_mode_gps_indent.gpr: Rename to
    ada_mode_gps_indent.gpr.gp; generate .gpr via gnatprep.
    
    * packages/ada-mode/build.sh: New file.
    
    * packages/wisi/parse_table-mode.el: New file.
    
    * packages/wisi/wisi.el: Release wisi 1.1.6.
---
 NEWS                |  9 ++++++++
 README              |  2 +-
 parse_table-mode.el | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 wisi.el             | 18 +++++++++++----
 4 files changed, 88 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index bd9be26..5e837c7 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,15 @@ 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.1.6
+3 Oct 2017
+
+** wisi-forward-find-cache-token - new function.
+
+** New minor-mode parse_table-mode helps navigating parse table
+   listings output by 'wisi-generate -v 1'; useful when debugging
+   grammars.
+
 * wisi 1.1.5
 9 Jul 2017
 
diff --git a/README b/README
index 8e6fa68..648f35c 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Emacs wisi package 1.1.5
+Emacs wisi package 1.1.6
 
 The wisi package provides utilities for using generalized LALR parsers
 to do indentation, fontification, and navigation. See ada-mode for an
diff --git a/parse_table-mode.el b/parse_table-mode.el
new file mode 100755
index 0000000..d8d2651
--- /dev/null
+++ b/parse_table-mode.el
@@ -0,0 +1,64 @@
+;; parse_table-mode.el --- For navigating in a parse_table as output by 
wisi-generate. -*- lexical-binding:t -*-
+;;
+;; Copyright (C) 2017  Free Software Foundation, Inc.
+;;
+;; Author: Stephen Leake <stephen_leake@stephe-leake.org>
+;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org>
+;; Keywords: parser
+;; Version: 1.0
+;; package-requires: ((emacs "25.1"))
+;; URL: http://www.nongnu.org/ada-mode/wisi/wisi.html
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+(require 'xref)
+
+(defun parse_table--xref-backend () 'parse_table)
+
+(cl-defgeneric xref-backend-identifier-completion-table ((_backend (eql 
parse_table)))
+  ;; could complete on nonterms, find productions
+  nil)
+
+(cl-defmethod xref-backend-identifier-at-point ((_backend (eql parse_table)))
+  ;; assume we are on one of:
+  ;; - ’goto state nnn’ in a state action
+  ;; - ’=> State nnn’ in the debug kernels list
+  ;; - ’( nnn)’ in the unknown conflicts list
+  (save-excursion
+    (end-of-line)
+    (when (or (looking-back "[Ss]tate \\([0-9]+\\),?" 
(line-beginning-position))
+             (looking-back "( \\([0-9]+\\))" (line-beginning-position)))
+      (match-string 1))))
+
+(cl-defgeneric xref-backend-definitions ((_backend (eql parse_table)) 
identifier)
+  ;; state tables are self-contained; IDENTIFIER must be a state number
+  (save-excursion
+    (goto-char (point-min))
+    (search-forward-regexp (concat "^State " identifier ":$"))
+    (list (xref-make identifier (xref-make-buffer-location (current-buffer) 
(match-beginning 0))))))
+
+(define-minor-mode parse_table-mode
+  "Provides navigation in wisi-generate parse table output."
+  nil ":parse_table" nil
+  (add-hook 'xref-backend-functions #'parse_table--xref-backend nil t)
+
+  (if parse_table-mode
+      (read-only-mode 0)
+    (read-only-mode 1)
+  ))
+
+(provide 'parse_table-mode)
+;; end of file
diff --git a/wisi.el b/wisi.el
index 139ff98..b063321 100755
--- a/wisi.el
+++ b/wisi.el
@@ -2,13 +2,13 @@
 ;;
 ;; Copyright (C) 2012 - 2017  Free Software Foundation, Inc.
 ;;
-;; Author: Stephen Leake <stephen_leake@member.fsf.org>
-;; Maintainer: Stephen Leake <stephen_leake@member.fsf.org>
+;; Author: Stephen Leake <stephen_leake@stephe-leake.org>
+;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org>
 ;; Keywords: parser
 ;;  indentation
 ;;  navigation
-;; Version: 1.1.5
-;; package-requires: ((cl-lib "0.4") (emacs "24.2"))
+;; Version: 1.1.6
+;; package-requires: ((cl-lib "0.4") (emacs "24.3"))
 ;; URL: http://www.nongnu.org/ada-mode/wisi/wisi.html
 ;;
 ;; This file is part of GNU Emacs.
@@ -1246,6 +1246,16 @@ error, if non-nil, return nil."
          (error "cache with token %s not found" token))))
     cache))
 
+(defun wisi-forward-find-cache-token (ids limit)
+  "Search forward for a cache with token in IDS (a list of token ids).
+Return cache, or nil if at LIMIT or end of buffer."
+  (let ((cache (wisi-forward-cache)))
+    (while (and (< (point) limit)
+               (not (eobp))
+               (not (memq (wisi-cache-token cache) ids)))
+      (setq cache (wisi-forward-cache)))
+    cache))
+
 (defun wisi-forward-find-nonterm (nonterm limit)
   "Search forward for a token that has a cache with NONTERM.
 NONTERM may be a list; stop on any cache that has a member of the list.



reply via email to

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