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

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

[elpa] externals/wisitoken-grammar-mode e475bf9 1/3: Release version 1.0


From: Stephen Leake
Subject: [elpa] externals/wisitoken-grammar-mode e475bf9 1/3: Release version 1.0.1; fix packaging bugs
Date: Sat, 17 Aug 2019 19:15:11 -0400 (EDT)

branch: externals/wisitoken-grammar-mode
commit e475bf98f9e5a87c98c97cda3dd9639c2f998020
Author: Stephen Leake <address@hidden>
Commit: Stephen Leake <address@hidden>

    Release version 1.0.1; fix packaging bugs
---
 build.sh                       |   4 +-
 wisi-wisitoken_grammar.adb     |   4 +-
 wisi-wisitoken_grammar.ads     |   2 +-
 wisitoken-grammar-mmm.el       |  29 ---------
 wisitoken-grammar-mode.el      |  72 +++++++++++++++-------
 wisitoken_grammar.gpr          |   4 +-
 wisitoken_grammar_1-process.el | 133 +++++++++++++++++++++++++++++++++++++++++
 7 files changed, 190 insertions(+), 58 deletions(-)

diff --git a/build.sh b/build.sh
index cc44216..bd8fb9d 100755
--- a/build.sh
+++ b/build.sh
@@ -1,7 +1,9 @@
 #!/bin/sh
 # Build and install executables for WisiToken grammar mode.
 
-export GPR_PROJECT_PATH="../wisi-2.0.1"
+export GPR_PROJECT_PATH="../wisi-2.2.1"
+
+gnatprep -DELPA="yes" wisitoken_grammar.gpr.gp wisitoken_grammar.gpr
 
 gprbuild -p -P wisitoken_grammar.gpr
 gprinstall -f -p -P wisitoken_grammar.gpr --install-name=wisitoken_grammar
diff --git a/wisi-wisitoken_grammar.adb b/wisi-wisitoken_grammar.adb
index a45fd78..0b83748 100644
--- a/wisi-wisitoken_grammar.adb
+++ b/wisi-wisitoken_grammar.adb
@@ -27,7 +27,7 @@ package body Wisi.WisiToken_Grammar is
      (Data              : in out Parse_Data_Type;
       Lexer             : in     WisiToken.Lexer.Handle;
       Descriptor        : access constant WisiToken.Descriptor;
-      Source_File_Name  : in     String;
+      Base_Terminals    : in     WisiToken.Base_Token_Array_Access;
       Post_Parse_Action : in     Post_Parse_Action_Type;
       Begin_Line        : in     WisiToken.Line_Number_Type;
       End_Line          : in     WisiToken.Line_Number_Type;
@@ -38,7 +38,7 @@ package body Wisi.WisiToken_Grammar is
       use all type Wisitoken_Grammar_1_Process_Actions.Token_Enum_ID;
    begin
       Wisi.Initialize
-        (Wisi.Parse_Data_Type (Data), Lexer, Descriptor, Source_File_Name, 
Post_Parse_Action,
+        (Wisi.Parse_Data_Type (Data), Lexer, Descriptor, Base_Terminals, 
Post_Parse_Action,
          Begin_Line, End_Line, Begin_Indent, "");
 
       Data.First_Comment_ID := +COMMENT_ID;
diff --git a/wisi-wisitoken_grammar.ads b/wisi-wisitoken_grammar.ads
index d2c3e5d..6bc87ad 100644
--- a/wisi-wisitoken_grammar.ads
+++ b/wisi-wisitoken_grammar.ads
@@ -28,7 +28,7 @@ package Wisi.WisiToken_Grammar is
      (Data              : in out Parse_Data_Type;
       Lexer             : in     WisiToken.Lexer.Handle;
       Descriptor        : access constant WisiToken.Descriptor;
-      Source_File_Name  : in     String;
+      Base_Terminals    : in     WisiToken.Base_Token_Array_Access;
       Post_Parse_Action : in     Post_Parse_Action_Type;
       Begin_Line        : in     WisiToken.Line_Number_Type;
       End_Line          : in     WisiToken.Line_Number_Type;
diff --git a/wisitoken-grammar-mmm.el b/wisitoken-grammar-mmm.el
deleted file mode 100644
index 7c76b21..0000000
--- a/wisitoken-grammar-mmm.el
+++ /dev/null
@@ -1,29 +0,0 @@
-;;; Define multi-major-mode stuff for wisitoken-grammar mode.  -*- 
lexical-binding:t -*-
-
-(require 'mmm-mode)
-
-(mmm-add-classes
- '((wisi-action
-    :match-submode wisitoken-grammar-mmm-submode
-    :face mmm-code-submode-face
-    :front "%("
-    :back ")%"
-    :insert ((?a wisi-action nil @ "%(" @ "" _ "" @ ")%")))
-   (wisi-code
-    :match-submode wisi-mmm-submode
-    :face mmm-code-submode-face
-    :front "%{"
-    :back "}%"
-    :insert ((?a wisi-code nil @ "%{" @ "" _ "" @ "}%")))
-   ))
-
-(defvar wisitoken-grammar-action-mode) ;; in wisitoken-grammar-mode.el
-(defun wisitoken-grammar-mmm-submode (_delim)
-  "for :match-submode"
-  wisitoken-grammar-action-mode)
-
-(add-to-list 'mmm-mode-ext-classes-alist '(wisitoken-grammar-mode nil 
wisi-action))
-(add-to-list 'mmm-mode-ext-classes-alist '(wisitoken-grammar-mode nil 
wisi-code))
-
-(provide 'wisitoken-grammar-mmm)
-;;; end of file
diff --git a/wisitoken-grammar-mode.el b/wisitoken-grammar-mode.el
index aab4ee7..1b0b29f 100644
--- a/wisitoken-grammar-mode.el
+++ b/wisitoken-grammar-mode.el
@@ -6,10 +6,9 @@
 ;; Maintainer: Stephen Leake <address@hidden>
 ;; Keywords: languages
 ;; Version: 1.0.0
-;; package-requires: ((wisi "2.1.1") (emacs "25.0") (mmm-mode "0.5.7"))
+;; package-requires: ((wisi "2.2.1") (emacs "25.0") (mmm-mode "0.5.7"))
 
-;; (Gnu ELPA requires single digits between dots in versions)
-;; no ’url’; just ELPA
+;; no upstream url; just ELPA
 
 ;; This file is part of GNU Emacs.
 
@@ -31,15 +30,12 @@
 ;;; Commentary:
 
 (require 'cl-lib)
+(require 'mmm-mode)
 (require 'xref)
 (require 'wisi)
 (require 'wisitoken_grammar_1-process)
 (require 'wisi-process-parse)
 
-(eval-and-compile
-  (when (locate-library "mmm-mode")
-    (require 'wisitoken-grammar-mmm)))
-
 (defgroup wisitoken-grammar nil
   "Major mode for editing Wisi grammar files in Emacs."
   :group 'languages)
@@ -68,9 +64,6 @@
     map
   )  "Local keymap used for wisitoken-grammar mode.")
 
-(defvar-local wisitoken-grammar-action-mode nil
-  "Emacs major mode used for actions and code, inferred from ’%generate’ 
declaration or file local variable.")
-
 (cl-defstruct (wisitoken-grammar-parser (:include wisi-process--parser))
   ;; no new slots
   )
@@ -254,31 +247,64 @@ Otherwise insert a plain new line."
         ))
       )))
 
-(defun wisitoken-grammar-set-action-mode ()
+;;; mmm (multi-major-mode) integration
+
+(defvar-local wisitoken-grammar-action-mode nil
+  "Emacs major mode used for grammar actions, from ’%generate’ declaration.")
+
+(defun wisitoken-grammar-mmm-action (_delim)
+  "for :match-submode"
+  wisitoken-grammar-action-mode)
+
+(defvar-local wisitoken-grammar-code-mode nil
+  "Emacs major mode used for code blocks, from ’%generate’ declaration.")
+
+(defun wisitoken-grammar-mmm-code (_delim)
+  "for :match-submode"
+  wisitoken-grammar-code-mode)
+
+(defun wisitoken-grammar-set-submodes ()
   (save-excursion
     (goto-char (point-min))
     (if (search-forward-regexp "%generate +\\([A-Za-z_0-9]+\\) 
*\\([A-Za-z_0-9]+\\)?" (point-max) t)
        (cond
         ((string-equal (match-string 1) "None")
-         ;; unit test
-         (setq wisitoken-grammar-action-mode 'emacs-lisp-mode))
+         (setq wisitoken-grammar-action-mode nil)
+         (setq wisitoken-grammar-code-mode nil))
 
-        ((or
-          (string-equal (match-string 2) "Ada_Emacs")
-          (string-equal (match-string 2) "Elisp")
-          (string-equal (match-string 2) "elisp"))
-         (setq wisitoken-grammar-action-mode 'emacs-lisp-mode))
+        ((string-equal (match-string 2) "Ada_Emacs")
+         (setq wisitoken-grammar-action-mode 'emacs-lisp-mode)
+         (setq wisitoken-grammar-code-mode 'ada-mode))
 
         ((string-equal (match-string 2) "Ada")
-         (setq wisitoken-grammar-action-mode 'ada-mode))
+         (setq wisitoken-grammar-action-mode 'ada-mode)
+         (setq wisitoken-grammar-code-mode 'ada-mode))
 
         (t
          (error "unrecognized output language %s" (match-string 2)))
         )
 
-      ;; We can still support the grammar statements, just not the actions.
+      ;; %generate not found; we can still support the grammar
+      ;; statements, just not the actions.
       (setq wisitoken-grammar-action-mode 'nil))))
 
+(mmm-add-classes
+ '((wisi-action
+    :match-submode wisitoken-grammar-mmm-action
+    :face mmm-code-submode-face
+    :front "%("
+    :back ")%"
+    :insert ((?a wisi-action nil @ "%(" @ "" _ "" @ ")%")))
+   (wisi-code
+    :match-submode wisitoken-grammar-mmm-code
+    :face mmm-code-submode-face
+    :front "%{"
+    :back "}%"
+    :insert ((?a wisi-code nil @ "%{" @ "" _ "" @ "}%")))
+   ))
+
+(add-to-list 'mmm-mode-ext-classes-alist '(wisitoken-grammar-mode nil 
wisi-action))
+(add-to-list 'mmm-mode-ext-classes-alist '(wisitoken-grammar-mode nil 
wisi-code))
 
 ;;; xref integration
 (defun wisitoken-grammar--xref-backend ()
@@ -331,7 +357,7 @@ Otherwise insert a plain new line."
   (set (make-local-variable 'add-log-current-defun-function)
        #'wisitoken-grammar-add-log-current-function)
 
-  (wisitoken-grammar-set-action-mode)
+  (wisitoken-grammar-set-submodes)
 
   (add-hook 'xref-backend-functions #'wisitoken-grammar--xref-backend
            nil ;; append
@@ -350,8 +376,7 @@ Otherwise insert a plain new line."
             :face-table wisitoken_grammar_1-process-face-table
             :token-table wisitoken_grammar_1-process-token-table
             :language-action-table [wisitoken-grammar-check-parens]
-            ))
-   :lexer nil)
+            )))
 
   ;; Our wisi parser does not fontify comments and strings, so tell
   ;; font-lock to do that.
@@ -364,6 +389,7 @@ Otherwise insert a plain new line."
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.wy\\'" . wisitoken-grammar-mode))
 
+;; Tie the mode to the defcustoms above.
 (put 'wisitoken-grammar-mode 'custom-mode-group 'wisitoken-grammar)
 
 (provide 'wisitoken-grammar-mode)
diff --git a/wisitoken_grammar.gpr b/wisitoken_grammar.gpr
index ce95959..61e22c0 100644
--- a/wisitoken_grammar.gpr
+++ b/wisitoken_grammar.gpr
@@ -2,7 +2,7 @@
 --
 --  build executables
 --
---  Copyright (C) 2017 Stephen Leake All Rights Reserved.
+--  Copyright (C) 2017, 2019 Stephen Leake All Rights Reserved.
 --
 --  This program is free software; you can redistribute it and/or
 --  modify it under terms of the GNU General Public License as
@@ -16,7 +16,7 @@
 --  the Free Software Foundation, 51 Franklin Street, Suite 500, Boston,
 --  MA 02110-1335, USA.
 
-with "wisi_runtime";
+with "wisi";
 with "wisitoken";
 with "standard_common";
 project WisiToken_Grammar is
diff --git a/wisitoken_grammar_1-process.el b/wisitoken_grammar_1-process.el
new file mode 100644
index 0000000..a994e0e
--- /dev/null
+++ b/wisitoken_grammar_1-process.el
@@ -0,0 +1,133 @@
+;;; wisitoken_grammar_1-process.el --- Generated parser support file  -*- 
lexical-binding:t -*-
+;;  command line: wisitoken-bnf-generate.exe  --generate LR1 Ada_Emacs re2c 
PROCESS wisitoken_grammar_1.wy
+
+;;  Copyright (C) 2017 - 2019 Free Software Foundation, Inc.
+;;
+;;  Author: Stephen Leake <address@hidden>
+;;
+;;  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 'wisi-process-parse)
+
+(defconst wisitoken_grammar_1-process-token-table
+  [WHITESPACE
+   NEW_LINE
+   COMMENT
+   CODE
+   END
+   IF
+   KEYWORD
+   NON_GRAMMAR
+   TOKEN
+   RAW_CODE
+   REGEXP
+   ACTION
+   BAR
+   COLON
+   COLON_COLON_EQUAL
+   COMMA
+   EQUAL
+   GREATER
+   LEFT_BRACE
+   LEFT_BRACKET
+   LEFT_PAREN
+   LESS
+   MINUS
+   PERCENT
+   PLUS
+   QUESTION
+   RIGHT_BRACE
+   RIGHT_BRACKET
+   RIGHT_PAREN
+   SEMICOLON
+   SLASH
+   STAR
+   NUMERIC_LITERAL
+   IDENTIFIER
+   STRING_LITERAL_1
+   STRING_LITERAL_2
+   Wisi_EOI
+   wisitoken_accept
+   declaration
+   token_keyword_non_grammar
+   identifier_list
+   declaration_item_list
+   declaration_item
+   nonterminal
+   semicolon_opt
+   rhs_list
+   rhs
+   rhs_attribute
+   rhs_element
+   rhs_item_list
+   rhs_item
+   rhs_group_item
+   rhs_optional_item
+   rhs_multiple_item
+   rhs_alternative_list
+   compilation_unit
+   compilation_unit_list
+   nonterminal_004
+   ])
+
+(defconst wisitoken_grammar_1-process-face-table
+  [
+   font-lock-constant-face
+   font-lock-function-name-face
+   font-lock-keyword-face
+   font-lock-string-face
+   font-lock-type-face
+   nil
+   ])
+
+(defconst wisitoken_grammar_1-process-repair-image
+  '(
+   (CODE . "code")
+   (END . "end")
+   (IF . "if")
+   (KEYWORD . "keyword")
+   (NON_GRAMMAR . "non_grammar")
+   (TOKEN . "token")
+   (RAW_CODE . "}%")
+   (REGEXP . "]%")
+   (ACTION . ")%")
+   (BAR . "|")
+   (COLON . ":")
+   (COLON_COLON_EQUAL . "::=")
+   (COMMA . ",")
+   (EQUAL . "=")
+   (GREATER . ">")
+   (LEFT_BRACE . "{")
+   (LEFT_BRACKET . "[")
+   (LEFT_PAREN . "(")
+   (LESS . "<")
+   (MINUS . "-")
+   (PERCENT . "%")
+   (PLUS . "+")
+   (QUESTION . "?")
+   (RIGHT_BRACE . "}")
+   (RIGHT_BRACKET . "]")
+   (RIGHT_PAREN . ")")
+   (SEMICOLON . ";")
+   (SLASH . "/")
+   (STAR . "*")
+   (NUMERIC_LITERAL . "1234567890")
+   (IDENTIFIER . "bogus")
+   (STRING_LITERAL_1 . "\"\"")
+   (STRING_LITERAL_2 . "''")
+   ))
+
+(provide 'wisitoken_grammar_1-process)



reply via email to

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