branch: master commit 6cd1c85c9f4b59c639a5d63d61f6c0af86d3d6b5 Author: Stephen Leake <stephen_le...@stephe-leake.org> Commit: Stephen Leake <stephen_le...@stephe-leake.org>
In ada-mode and wisi, release ada-mode 6.2.1, wisi 2.2.1; fix packaging bugs --- packages/ada-mode/NEWS | 6 + packages/ada-mode/README | 2 +- packages/ada-mode/ada-mode.el | 6 +- packages/ada-mode/ada-mode.info | 2 +- packages/ada-mode/ada-mode.texi | 4 +- packages/ada-mode/ada-project.el | 120 ++++++++ packages/ada-mode/ada_lr1_parse_table.txt.gz | Bin 3170831 -> 3170831 bytes packages/ada-mode/ada_mode_wisi_parse.gpr.gp | 4 + packages/ada-mode/build.sh | 4 +- packages/ada-mode/gnat-core.el | 1 + packages/ada-mode/run_ada_lalr_parse.ads | 32 +++ packages/ada-mode/run_ada_libadalang_parse.ads | 25 ++ packages/ada-mode/run_ada_lr1_parse.ads | 33 +++ packages/ada-mode/run_gpr_parse.ads | 31 ++ .../ada-mode/wisi-ada-format_parameter_list.adb | 315 +++++++++++++++++++++ packages/uniquify-files/uniquify-files.el | 3 +- packages/wisi/NEWS | 7 +- packages/wisi/README | 2 +- packages/wisi/build-wisitoken-bnf-generate.sh | 4 +- packages/wisi/wisi.el | 47 ++- packages/wisi/wisi.gpr | 2 +- 21 files changed, 622 insertions(+), 28 deletions(-) diff --git a/packages/ada-mode/NEWS b/packages/ada-mode/NEWS index 5cbd336..22a55ff 100644 --- a/packages/ada-mode/NEWS +++ b/packages/ada-mode/NEWS @@ -7,6 +7,12 @@ Please send ada-mode bug reports to bug-gnu-em...@gnu.org, with * Ada Mode 6.2.1 +17 Aug 2019 + +** fix packaging bugs + +* Ada Mode 6.2.0 +13 Aug 2019 ** parser Ada language protocol version 2 diff --git a/packages/ada-mode/README b/packages/ada-mode/README index f8bd5f2..7cec70d 100644 --- a/packages/ada-mode/README +++ b/packages/ada-mode/README @@ -1,4 +1,4 @@ -Emacs Ada mode version 6.2.0 +Emacs Ada mode version 6.2.1 Ada mode provides auto-casing, fontification, navigation, and indentation for Ada source code files. diff --git a/packages/ada-mode/ada-mode.el b/packages/ada-mode/ada-mode.el index f51cd35..3995491 100644 --- a/packages/ada-mode/ada-mode.el +++ b/packages/ada-mode/ada-mode.el @@ -6,8 +6,8 @@ ;; Maintainer: Stephen Leake <stephen_le...@stephe-leake.org> ;; Keywords: languages ;; ada -;; Version: 6.2.0 -;; package-requires: ((uniquify-files "1.0") (wisi "2.2.0") (emacs "25.0")) +;; Version: 6.2.1 +;; package-requires: ((uniquify-files "1.0.1") (wisi "2.2.1") (emacs "25.0")) ;; url: http://www.nongnu.org/ada-mode/ ;; ;; This file is part of GNU Emacs. @@ -167,7 +167,7 @@ (defun ada-mode-version () "Return Ada mode version." (interactive) - (let ((version-string "6.2.0")) + (let ((version-string "6.2.1")) ;; must match: ;; ada-mode.texi ;; README-ada-mode diff --git a/packages/ada-mode/ada-mode.info b/packages/ada-mode/ada-mode.info index df583fa..375f960 100644 --- a/packages/ada-mode/ada-mode.info +++ b/packages/ada-mode/ada-mode.info @@ -25,7 +25,7 @@ File: ada-mode.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) Top *** -Ada Mode Version 6.2.0 +Ada Mode Version 6.2.1 * Menu: diff --git a/packages/ada-mode/ada-mode.texi b/packages/ada-mode/ada-mode.texi index beaf7b1..718abbd 100644 --- a/packages/ada-mode/ada-mode.texi +++ b/packages/ada-mode/ada-mode.texi @@ -25,7 +25,7 @@ developing GNU and promoting software freedom.'' @titlepage @sp 10 -@title Ada Mode Version 6.2.0 +@title Ada Mode Version 6.2.1 @page @vskip 0pt plus 1filll @insertcopying @@ -37,7 +37,7 @@ developing GNU and promoting software freedom.'' @node Top, Overview, (dir), (dir) @top Top -Ada Mode Version 6.2.0 +Ada Mode Version 6.2.1 @end ifnottex @menu diff --git a/packages/ada-mode/ada-project.el b/packages/ada-mode/ada-project.el new file mode 100644 index 0000000..ae5b3a4 --- /dev/null +++ b/packages/ada-mode/ada-project.el @@ -0,0 +1,120 @@ +;; ada-project.el - project.el backend for ada-mode projects -*- lexical-binding: t -*- +;; +;; Copyright (C) 2017 - 2019 Free Software Foundation, Inc. +;; +;; Author: Stephen Leake <stephen_le...@stephe-leake.org> +;; +;; 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 'ada-mode) +(require 'cl-lib) +(require 'cl-generic) +(require 'project) +(require 'uniquify-files) + +(cl-defgeneric project-refresh (prj full) + "Refresh all cached data in PRJ. +If FULL is non-nil, very slow refresh operations may be skipped.") + +(defun refresh-project (full) + "Refresh all cached data in the current project. +With prefix arg, very slow refresh operations may be skipped." + (interactive "P") + (project-refresh (project-current) full)) + +(cl-defgeneric project-select (prj) + "User has selected PRJ as the active project; take actions to make that so." + (setq compilation-search-path + (append (project-roots prj) + (project-external-roots prj))) + ) + +(cl-defgeneric project-deselect (_prj) + "PRJ is the current project; user has selected another project. +Undo actions done in `project-select'." + (setq compilation-search-path nil) + ) + +(cl-defstruct (ada-project + (:constructor nil) ;; no default + (:constructor make-ada-project + (&key + env-vars + ada-prj-file + file-pred + &aux + (ada-prj (expand-file-name ada-prj-file)))) + ) + env-vars ;; a list of (NAME . VALUE) + ada-prj ;; The ada-mode project file name (absolute). + + file-pred ;; Function taking an absolute file name, returns non-nil + ;; if the file should be included in `project-files'. + ) + +(defvar ada-project-current nil + "The current Ada project; an `ada-project' object.") + +;;;###autoload +(defun ada-project-current (_dir) + "Return the project the user has set in `ada-project-current'. +For `project-find-functions'." + ada-project-current) + +(cl-defmethod project-id ((prj ada-project)) + ;; project-id is experimental + (ada-project-ada-prj prj)) + +(cl-defmethod project-roots ((_prj ada-project)) + ;; Not meaningful + nil) + +(cl-defmethod project-files ((prj ada-project) &optional dirs) + (let (result) + (dolist (dir (or dirs (ada-prj-get 'src_dir))) + (mapc + (lambda (absfile) + (when (and (not (string-equal "." (substring absfile -1))) + (not (string-equal ".." (substring absfile -2))) + (not (file-directory-p absfile)) + (or (null (ada-project-file-pred prj)) + (funcall (ada-project-file-pred prj) absfile))) + (push absfile result))) + (directory-files dir t))) + result)) + +(when (not (fboundp 'project--read-file-cpd-relative)) ;; emacs < 27 + (cl-defmethod project-file-completion-table ((prj ada-project) &optional dirs) + (apply-partially #'uniq-file-completion-table (uniq-file-uniquify (project-files prj dirs))))) + +(cl-defmethod project-select ((prj ada-project)) + (dolist (pair (ada-project-env-vars prj)) + (setenv (car pair) (cdr pair))) + (ada-select-prj-file (ada-project-ada-prj prj))) + +(cl-defmethod project-deselect :before ((prj ada-project)) + (ada-deselect-prj (ada-project-ada-prj prj)) + (dolist (pair (ada-project-env-vars prj)) + (setenv (car pair) nil))) + +(cl-defmethod project-refresh ((_prj ada-project) full) + ;; assume prj is current + (ada-refresh-prj-file) + (ada-xref-refresh full)) + +(provide 'ada-project) + +;; end of file diff --git a/packages/ada-mode/ada_lr1_parse_table.txt.gz b/packages/ada-mode/ada_lr1_parse_table.txt.gz index c5912bb..4192eb5 100644 Binary files a/packages/ada-mode/ada_lr1_parse_table.txt.gz and b/packages/ada-mode/ada_lr1_parse_table.txt.gz differ diff --git a/packages/ada-mode/ada_mode_wisi_parse.gpr.gp b/packages/ada-mode/ada_mode_wisi_parse.gpr.gp index 158ee54..52b6503 100644 --- a/packages/ada-mode/ada_mode_wisi_parse.gpr.gp +++ b/packages/ada-mode/ada_mode_wisi_parse.gpr.gp @@ -16,7 +16,11 @@ -- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, -- MA 02110-1335, USA. +#if ELPA="yes" +with "wisi"; +#else with "wisitoken"; +#end if; with "standard_common"; #if HAVE_LIBADALANG="yes" with "libadalang"; diff --git a/packages/ada-mode/build.sh b/packages/ada-mode/build.sh index b842619..47cbb4d 100755 --- a/packages/ada-mode/build.sh +++ b/packages/ada-mode/build.sh @@ -16,9 +16,9 @@ gnatprep -DHAVE_GNATCOLL_XREF=$HAVE_GNATCOLL_XREF gpr_query-process_refresh.adb. gnatprep -DHAVE_GNATCOLL_XREF=$HAVE_GNATCOLL_XREF gpr_query.gpr.gp gpr_query.gpr # support for libadalang is still experimental -gnatprep -DHAVE_LIBADALANG="no" ada_mode_wisi_parse.gpr.gp ada_mode_wisi_parse.gpr +gnatprep -DHAVE_LIBADALANG="no" -DELPA="yes" ada_mode_wisi_parse.gpr.gp ada_mode_wisi_parse.gpr -export GPR_PROJECT_PATH="../wisi-2.2.0" +export GPR_PROJECT_PATH="../wisi-2.2.1" gprbuild -p -P gpr_query.gpr gprinstall -f -p -P gpr_query.gpr --install-name=gpr_query diff --git a/packages/ada-mode/gnat-core.el b/packages/ada-mode/gnat-core.el index efd2c6f..d65a500 100644 --- a/packages/ada-mode/gnat-core.el +++ b/packages/ada-mode/gnat-core.el @@ -445,6 +445,7 @@ list." ("a-ioexce" . "Ada.IO_Exceptions") ("a-finali" . "Ada.Finalization") ("a-numeri" . "Ada.Numerics") + ("a-nuflra" . "Ada.Numerics.Float_Random") ("a-stream" . "Ada.Streams") ("a-ststio" . "Ada.Streams.Stream_IO") ("a-string" . "Ada.Strings") diff --git a/packages/ada-mode/run_ada_lalr_parse.ads b/packages/ada-mode/run_ada_lalr_parse.ads new file mode 100644 index 0000000..7eac49d --- /dev/null +++ b/packages/ada-mode/run_ada_lalr_parse.ads @@ -0,0 +1,32 @@ +-- Abstract : +-- +-- Run the Ada LALR parser standalone. Useful for debugging grammar issues. +-- +-- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or +-- modify it under terms of the GNU General Public License as +-- published by the Free Software Foundation; either version 3, or (at +-- your option) any later version. This program 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 +-- distributed with this program; see file COPYING. If not, write to +-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, +-- MA 02110-1335, USA. + +pragma License (GPL); + +with Ada_Process_Actions; +with Ada_Process_LALR_Main; +with Gen_Run_Wisi_LR_Parse; +with WisiToken.Parse.LR.McKenzie_Recover.Ada; +with Wisi.Ada; +procedure Run_Ada_LALR_Parse is new Gen_Run_Wisi_LR_Parse + (Wisi.Ada.Parse_Data_Type, + Ada_Process_Actions.Descriptor, + WisiToken.Parse.LR.McKenzie_Recover.Ada.Language_Fixes'Access, + WisiToken.Parse.LR.McKenzie_Recover.Ada.Matching_Begin_Tokens'Access, + WisiToken.Parse.LR.McKenzie_Recover.Ada.String_ID_Set'Access, + Ada_Process_LALR_Main.Create_Parser); diff --git a/packages/ada-mode/run_ada_libadalang_parse.ads b/packages/ada-mode/run_ada_libadalang_parse.ads new file mode 100644 index 0000000..f3b3d19 --- /dev/null +++ b/packages/ada-mode/run_ada_libadalang_parse.ads @@ -0,0 +1,25 @@ +-- Abstract : +-- +-- Run the Ada parser standalone. Useful for debugging grammar issues. +-- +-- Copyright (C) 2018 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or +-- modify it under terms of the GNU General Public License as +-- published by the Free Software Foundation; either version 3, or (at +-- your option) any later version. This program 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 +-- distributed with this program; see file COPYING. If not, write to +-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, +-- MA 02110-1335, USA. + +pragma License (GPL); + +with Ada_Process_Actions; +with Gen_Run_Wisi_Libadalang_Parse; +with Wisi.Ada; +procedure Run_Ada_Libadalang_Parse is new Gen_Run_Wisi_Libadalang_Parse + (Wisi.Ada.Parse_Data_Type, Ada_Process_Actions.Descriptor); diff --git a/packages/ada-mode/run_ada_lr1_parse.ads b/packages/ada-mode/run_ada_lr1_parse.ads new file mode 100644 index 0000000..76984a7 --- /dev/null +++ b/packages/ada-mode/run_ada_lr1_parse.ads @@ -0,0 +1,33 @@ +-- Abstract : +-- +-- Run the Ada parser standalone. Useful for debugging grammar issues. +-- +-- Copyright (C) 2017, 2018, 2019 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or +-- modify it under terms of the GNU General Public License as +-- published by the Free Software Foundation; either version 3, or (at +-- your option) any later version. This program 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 +-- distributed with this program; see file COPYING. If not, write to +-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, +-- MA 02110-1335, USA. + +pragma License (GPL); + +with Ada_Process_Actions; +with Ada_Process_LR1_Main; +with Gen_Run_Wisi_LR_Text_Rep_Parse; +with WisiToken.Parse.LR.McKenzie_Recover.Ada; +with Wisi.Ada; +procedure Run_Ada_LR1_Parse is new Gen_Run_Wisi_LR_Text_Rep_Parse + (Wisi.Ada.Parse_Data_Type, + Ada_Process_Actions.Descriptor, + WisiToken.Parse.LR.McKenzie_Recover.Ada.Language_Fixes'Access, + WisiToken.Parse.LR.McKenzie_Recover.Ada.Matching_Begin_Tokens'Access, + WisiToken.Parse.LR.McKenzie_Recover.Ada.String_ID_Set'Access, + "ada_lr1_parse_table.txt", + Ada_Process_LR1_Main.Create_Parser); diff --git a/packages/ada-mode/run_gpr_parse.ads b/packages/ada-mode/run_gpr_parse.ads new file mode 100644 index 0000000..216a5b8 --- /dev/null +++ b/packages/ada-mode/run_gpr_parse.ads @@ -0,0 +1,31 @@ +-- Abstract : +-- +-- Run the gpr parser standalone. Useful for debugging grammar issues. +-- +-- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or +-- modify it under terms of the GNU General Public License as +-- published by the Free Software Foundation; either version 3, or (at +-- your option) any later version. This program 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 +-- distributed with this program; see file COPYING. If not, write to +-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, +-- MA 02110-1335, USA. + +pragma License (GPL); + +with Gen_Run_Wisi_LR_Parse; +with Gpr_Process_Actions; +with Gpr_Process_Main; +with Wisi.Gpr; +procedure Run_Gpr_Parse is new Gen_Run_Wisi_LR_Parse + (Wisi.Gpr.Parse_Data_Type, + Gpr_Process_Actions.Descriptor, + null, + null, + null, + Gpr_Process_Main.Create_Parser); diff --git a/packages/ada-mode/wisi-ada-format_parameter_list.adb b/packages/ada-mode/wisi-ada-format_parameter_list.adb new file mode 100644 index 0000000..10bfb25 --- /dev/null +++ b/packages/ada-mode/wisi-ada-format_parameter_list.adb @@ -0,0 +1,315 @@ +-- Abstract : +-- +-- +-- +-- Copyright (C) 2019 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or +-- modify it under terms of the GNU General Public License as +-- published by the Free Software Foundation; either version 3, or (at +-- your option) any later version. This program 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 +-- distributed with this program; see file COPYING. If not, write to +-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, +-- MA 02110-1335, USA. + +pragma License (GPL); + +with WisiToken.Syntax_Trees.LR_Utils; use WisiToken.Syntax_Trees.LR_Utils; +separate (Wisi.Ada) +procedure Format_Parameter_List + (Tree : in WisiToken.Syntax_Trees.Tree; + Data : in out Parse_Data_Type; + Edit_Begin : in WisiToken.Buffer_Pos) +is + use Standard.Ada.Containers; + use Ada_Process_Actions; + use Standard.Ada.Text_IO; + use WisiToken.Syntax_Trees; + + -- First process the syntax tree and produce a list of parameters + package Region_Lists is new Standard.Ada.Containers.Doubly_Linked_Lists (Buffer_Region); + type Parameter is record + Identifiers : Region_Lists.List; + Aliased_P : Boolean := False; -- "_P" for "present" + In_P : Boolean := False; + Out_P : Boolean := False; + Not_Null_P : Boolean := False; + Access_P : Boolean := False; + Constant_P : Boolean := False; + Protected_P : Boolean := False; + Type_Region : Buffer_Region := Null_Buffer_Region; + Default_Exp : Buffer_Region := Null_Buffer_Region; + end record; + + Formal_Part : constant Node_Index := Find_ID_At (Tree, Data.Terminals, +formal_part_ID, Edit_Begin); + Param_Iter : Iterator; + Edit_End : Buffer_Pos; + Param_Count : Count_Type := 0; + + function Get_Text (Region : in WisiToken.Buffer_Region) return String + is begin + return Data.Lexer.Buffer_Text (Region); + end Get_Text; + +begin + if Formal_Part = Invalid_Node_Index then + -- Most likely the edit point is wrong. + raise SAL.Parameter_Error with "no parameter list found at byte_pos" & Edit_Begin'Image; + end if; + + if WisiToken.Trace_Action > Detail then + Put_Line (";; format parameter list node" & Formal_Part'Image); + end if; + + Edit_End := Tree.Byte_Region (Formal_Part).Last; + Param_Iter := Iterator + (Iterate (Tree, Data.Base_Terminals, Data.Lexer, Data.Descriptor, + Tree.Child (Formal_Part, 2), +parameter_specification_ID, +SEMICOLON_ID)); + + -- The last parameter might be empty, due to syntax errors. + for Param_Cur in Param_Iter loop + if not Tree.Is_Empty (Node (Param_Cur)) then + Param_Count := Param_Count + 1; + end if; + end loop; + + declare + Params : array (1 .. Param_Count) of Parameter; + Param_Cur : Cursor := First (Param_Iter); + First_Param_Node : constant Node_Index := Node (First (Param_Iter)); + Last_Param_Node : Node_Index; + begin + for Param of Params loop + Last_Param_Node := Node (Param_Cur); + + declare + Children : constant Valid_Node_Index_Array := Tree.Children (Node (Param_Cur)); + begin + for Ident_Cur in Iterate + (Tree, Data.Base_Terminals, Data.Lexer, Data.Descriptor, Children (1), +IDENTIFIER_ID, +COMMA_ID) + loop + Param.Identifiers.Append (Tree.Byte_Region (Node (Ident_Cur))); + end loop; + + Param.Aliased_P := not Tree.Is_Empty (Children (3)); + + for I in 4 .. Children'Last loop + case To_Token_Enum (Tree.ID (Children (I))) is + when mode_opt_ID => + if Tree.Is_Empty (Children (I)) then + Param.In_P := False; + Param.Out_P := False; + else + Param.In_P := Tree.ID (Tree.Child (Children (I), 1)) = +IN_ID; + Param.Out_P := Tree.ID (Tree.Child (Children (I), 1)) = +OUT_ID or + Tree.Children (Children (I))'Length > 1; -- 'in out' + end if; + + when null_exclusion_opt_ID => + Param.Not_Null_P := not Tree.Is_Empty (Children (I)); + + when name_ID => + Param.Type_Region := Tree.Byte_Region (Children (I)); + + when access_definition_ID => + -- First two children are always: + -- null_exclusion_opt ACCESS + declare + Access_Children : constant Valid_Node_Index_Array := Tree.Children (Children (I)); + begin + Param.Not_Null_P := not Tree.Is_Empty (Access_Children (1)); + Param.Access_P := True; + + if Tree.ID (Access_Children (3)) = +general_access_modifier_opt_ID then + Param.Constant_P := not Tree.Is_Empty (Access_Children (3)); + Param.Type_Region := Tree.Byte_Region (Access_Children (4)); + else + Param.Protected_P := not Tree.Is_Empty (Access_Children (3)); + Param.Type_Region := + (Tree.Byte_Region (Access_Children (4)).First, + Tree.Byte_Region (Children (I)).Last); + end if; + end; + + when COLON_EQUAL_ID => + null; + + when expression_opt_ID => + if not Tree.Is_Empty (Children (I)) then + Param.Default_Exp := Tree.Byte_Region (Children (I)); + end if; + + when others => + Raise_Programmer_Error + ("format_parameter_list param id", Data.Descriptor.all, Data.Lexer, Tree, Data.Base_Terminals.all, + Children (I)); + end case; + end loop; + end; + Param_Cur := Next (Param_Iter, Param_Cur); + end loop; + + declare + use Standard.Ada.Strings.Unbounded; + Result : Unbounded_String := +"("; + Line_End : Integer := 0; -- Index of last LF char in Result. + Multi_Line : constant Boolean := + Tree.Augmented (First_Param_Node).Line < Tree.Augmented (Last_Param_Node).Line; + Ident_Len : Integer := 0; -- Maximum over all params, includes commas + Type_Len : Integer := 0; + Aliased_P : Boolean := False; -- "_P" for "present" + In_P : Boolean := False; + Out_P : Boolean := False; + Not_Null_P : Boolean := False; + Access_P : Boolean := False; + + Len : Integer; -- temporary + Need_Comma : Boolean; + Need_New_Line : Boolean := False; + begin + if Multi_Line then + -- Find columns + for Param of Params loop + Len := 0; + for Ident of Param.Identifiers loop + Len := Len + Integer (Ident.Last - Ident.First) + 1; + end loop; + Len := Len + 2 * (Integer (Param.Identifiers.Length) - 1); + Ident_Len := Integer'Max (Ident_Len, Len); + + -- We align the default expressions after the types in parameters + -- that have defaults, not after all types. "constant", "protected" + -- are treated as part of 'type' + if Param.Default_Exp /= Null_Buffer_Region then + Len := Integer (Param.Type_Region.Last - Param.Type_Region.First) + 1 + + (if Param.Constant_P then 10 else 0) + -- "constant " + (if Param.Protected_P then 10 else 0); -- "protected" + Type_Len := Integer'Max (Type_Len, Len); + end if; + + Aliased_P := Aliased_P or Param.Aliased_P; + In_P := In_P or Param.In_P; + Out_P := Out_P or Param.Out_P; + Not_Null_P := Not_Null_P or Param.Not_Null_P; + Access_P := Access_P or Param.Access_P; + end loop; + declare + subtype Count is Standard.Ada.Text_IO.Count; + Open_Paren_Col : constant Count := Tree.Augmented (Formal_Part).Column; + Ident_Col : constant Count := Open_Paren_Col + 1; + Colon_Col : constant Count := Ident_Col + Count (Ident_Len) + 1; + In_Col : constant Count := Colon_Col + (if Aliased_P then 10 else 2); + Out_Col : constant Count := In_Col + (if In_P then 3 else 0); + Type_Col : constant Count := In_Col + + -- 'not null' without access is part of the type + (if Not_Null_P and Access_P then 16 + elsif Access_P then 7 + elsif In_P and Out_P then 7 + elsif In_P then 3 + elsif Out_P then 4 + else 0); + Default_Col : constant Count := Type_Col + Count (Type_Len) + 1; + + function Indent_To (Col : in Count) return String + is + use Standard.Ada.Strings.Fixed; + begin + return + (Integer (Col - (if Need_New_Line then 0 else Open_Paren_Col)) - + (Length (Result) - Line_End)) * ' '; + end Indent_To; + begin + for Param of Params loop + if Need_New_Line then + Result := Result & ";" & ASCII.LF; + Line_End := Length (Result); + end if; + + Result := Result & Indent_To (Ident_Col); + Need_Comma := False; + for Ident of Param.Identifiers loop + if Need_Comma then + Result := Result & ", "; + else + Need_Comma := True; + end if; + Result := Result & Get_Text (Ident); + end loop; + + Result := Result & Indent_To (Colon_Col) & ": "; + + if Param.Aliased_P then Result := Result & "aliased "; end if; + + Result := Result & Indent_To (In_Col); + + if Param.In_P then Result := Result & "in "; end if; + + if Param.Out_P then Result := Result & Indent_To (Out_Col) & "out "; end if; + + if Param.Access_P then + if Param.Not_Null_P then + Result := Result & "not null access"; + else + Result := Result & "access"; + end if; + end if; + + Result := Result & Indent_To (Type_Col); + + if Param.Not_Null_P and not Param.Access_P then Result := Result & "not null "; end if; + if Param.Constant_P then Result := Result & "constant "; end if; + if Param.Protected_P then Result := Result & "protected "; end if; + + Result := Result & Get_Text (Param.Type_Region); + if Param.Default_Exp /= Null_Buffer_Region then + Result := Result & Indent_To (Default_Col) & ":= " & Get_Text (Param.Default_Exp); + end if; + + Need_New_Line := True; + end loop; + Result := Result & ")"; + end; + else -- not Multi_Line + for Param of Params loop + if Need_New_Line then + Result := Result & "; "; + end if; + + Need_Comma := False; + for Ident of Param.Identifiers loop + if Need_Comma then + Result := Result & ", "; + else + Need_Comma := True; + end if; + Result := Result & Get_Text (Ident); + end loop; + + Result := Result & " : "; + + if Param.Aliased_P then Result := Result & "aliased "; end if; + if Param.In_P then Result := Result & "in "; end if; + if Param.Out_P then Result := Result & "out "; end if; + if Param.Not_Null_P then Result := Result & "not null "; end if; + if Param.Access_P then Result := Result & "access "; end if; + if Param.Constant_P then Result := Result & "constant "; end if; + if Param.Protected_P then Result := Result & "protected "; end if; + + Result := Result & Get_Text (Param.Type_Region); + if Param.Default_Exp /= Null_Buffer_Region then + Result := Result & " := " & Get_Text (Param.Default_Exp); + end if; + + Need_New_Line := True; + end loop; + Result := Result & ")"; + end if; + Put_Line + ("[" & Edit_Action_Code & Edit_Begin'Image & Edit_End'Image & " """ & Elisp_Escape_Quotes (-Result) & """]"); + end; + end; +end Format_Parameter_List; diff --git a/packages/uniquify-files/uniquify-files.el b/packages/uniquify-files/uniquify-files.el index c779d47..f0fb010 100644 --- a/packages/uniquify-files/uniquify-files.el +++ b/packages/uniquify-files/uniquify-files.el @@ -6,7 +6,7 @@ ;; Maintainer: Stephen Leake <stephen_le...@stephe-leake.org> ;; Keywords: completion table ;; uniquify -;; Version: 1.0 +;; Version: 1.0.1 ;; package-requires: ((emacs "25.0")) ;; ;; This file is part of GNU Emacs. @@ -36,6 +36,7 @@ (require 'cl-lib) (require 'files) +(require 'project) (defconst uniq-file--regexp "^\\(.*\\)<\\([^>]*\\)>?$" ;; The trailing '>' is optional so the user can type "<dir" in the diff --git a/packages/wisi/NEWS b/packages/wisi/NEWS index bb8f8c6..8986e40 100644 --- a/packages/wisi/NEWS +++ b/packages/wisi/NEWS @@ -6,7 +6,12 @@ Please send wisi bug reports to bug-gnu-em...@gnu.org, with 'wisi' in the subject. If possible, use M-x report-emacs-bug. -* wisi +* wisi 2.2.1 +17 Aug 2019 + +** fix packaging bugs + +* wisi 2.2.0 13 Aug 2019 ** parser process protocol version 3 diff --git a/packages/wisi/README b/packages/wisi/README index c7176d2..f23d1d8 100644 --- a/packages/wisi/README +++ b/packages/wisi/README @@ -1,4 +1,4 @@ -Emacs wisi package 2.2.0 +Emacs wisi package 2.2.1 The wisi package provides utilities for using generalized LALR parsers (in elisp or external processes) to do indentation, fontification, and diff --git a/packages/wisi/build-wisitoken-bnf-generate.sh b/packages/wisi/build-wisitoken-bnf-generate.sh index c087be6..0732e5a 100755 --- a/packages/wisi/build-wisitoken-bnf-generate.sh +++ b/packages/wisi/build-wisitoken-bnf-generate.sh @@ -1,9 +1,7 @@ # Build wisitoken-bnf-generate.exe, for generating code from grammar files. # -# Assumes build.sh has run. -# # Instead of using this, you should consider using the complete # wisitoken development tree; see # http://stephe-leake.org/ada/wisitoken.html -gprbuild -p -P wisitoken.gpr wisitoken-bnf-generate +gprbuild -p -P wisi.gpr wisitoken-bnf-generate diff --git a/packages/wisi/wisi.el b/packages/wisi/wisi.el index 3500f91..a7a2fbf 100644 --- a/packages/wisi/wisi.el +++ b/packages/wisi/wisi.el @@ -7,7 +7,7 @@ ;; Keywords: parser ;; indentation ;; navigation -;; Version: 2.2.0 +;; Version: 2.2.1 ;; package-requires: ((emacs "25.0") (seq "2.20")) ;; URL: http://stephe-leake.org/ada/wisitoken.html ;; @@ -208,6 +208,8 @@ Regions in a list are in random order.") (let ((region-list (cdr (assoc (or parse-action wisi--parse-action) wisi--cached-regions))) region) (while (and region-list + (marker-buffer (caar region-list)) ;; this can fail after editing during ediff-regions. + (marker-buffer (cdar region-list)) (not (wisi--contained-region begin end (car region-list)))) (pop region-list)) @@ -274,27 +276,43 @@ Truncate any region that overlaps POS." (defun wisi--delete-face-cache (after) (with-silent-modifications - (remove-text-properties after (point-max) '(font-lock-face nil)) - ) - (wisi-cache-delete-regions-after 'face after)) + (remove-text-properties after (point-max) '(font-lock-face nil))) + (if (= after (point-min)) + (setcdr (assoc 'face wisi--cached-regions) nil) + (wisi-cache-delete-regions-after 'face after))) (defun wisi--delete-navigate-cache (after) (with-silent-modifications ;; This text property is 'wisi-cache', not 'wisi-navigate', for ;; historical reasons. - (remove-text-properties after (point-max) '(wisi-cache nil wisi-name nil)) - ) - (wisi-cache-delete-regions-after 'navigate after)) + (remove-text-properties after (point-max) '(wisi-cache nil wisi-name nil))) + (if (= after (point-min)) + (setcdr (assoc 'navigate wisi--cached-regions) nil) + (wisi-cache-delete-regions-after 'navigate after))) (defun wisi--delete-indent-cache (after) (with-silent-modifications - (remove-text-properties after (point-max) '(wisi-indent nil)) - ) - (wisi-cache-delete-regions-after 'indent after)) + (remove-text-properties after (point-max) '(wisi-indent nil))) + (if (= after (point-min)) + (setcdr (assoc 'indent wisi--cached-regions) nil) + (wisi-cache-delete-regions-after 'indent after))) (defun wisi-invalidate-cache (action after) "Invalidate ACTION caches for the current buffer from AFTER to end of buffer." - (when (wisi-cache-contains-pos action after) + (cond + ((= after (point-min)) + (cond + ((eq 'face action) + (wisi--delete-face-cache after)) + + ((eq 'navigate action) + (wisi--delete-navigate-cache after)) + + ((eq 'indent action) + (wisi--delete-indent-cache after)) + )) + + ((wisi-cache-contains-pos action after) (when (> wisi-debug 0) (message "wisi-invalidate-cache %s:%s:%d" action (current-buffer) after)) (cond ((eq 'face action) @@ -349,11 +367,12 @@ Truncate any region that overlaps POS." (line-beginning-position))) (wisi--delete-indent-cache (max 1 (1- after)))) ) - )) + ))) (defun wisi-reset-parser () "Force a parse." (interactive) + (syntax-ppss-flush-cache (point-min)) ;; necessary after edit during ediff-regions (wisi-invalidate-cache 'indent (point-min)) (wisi-invalidate-cache 'face (point-min)) (wisi-invalidate-cache 'navigate (point-min)) @@ -774,6 +793,10 @@ Usefull if the parser appears to be hung." `wisi--parse-action' must be bound." (when (and wisi--change-beg wisi--change-end + (or (integerp wisi--change-beg) + (marker-buffer wisi--change-beg)) ;; this can fail after editing during ediff-regions. + (or (integerp wisi--change-end) + (marker-buffer wisi--change-end)) (<= wisi--change-beg wisi--change-end)) (wisi--post-change wisi--change-beg (marker-position wisi--change-end)) (setq wisi--change-beg most-positive-fixnum) diff --git a/packages/wisi/wisi.gpr b/packages/wisi/wisi.gpr index 8ca2dd2..27e890d 100644 --- a/packages/wisi/wisi.gpr +++ b/packages/wisi/wisi.gpr @@ -32,7 +32,7 @@ project Wisi is for Exec_Dir use "."; end case; - for Languages use ("Ada"); + for Languages use ("Ada", "C"); -- C needed for wisitoken-bnf-generate; wisitoken_grammar_re2c.c package Compiler is