1 ;;; ada-wisi.el --- Indentation engine for Ada mode, using the wisi generalized LALR parser -*- lexical-binding:t -*-
3 ;; [1] ISO/IEC 8652:2012(E); Ada 2012 reference manual
5 ;; Copyright (C) 2012 - 2016 Free Software Foundation, Inc.
7 ;; Author: Stephen Leake <stephen_leake@member.fsf.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; implementation started Jan 2013
30 (require 'ada-fix-error)
31 (require 'ada-grammar-wy)
32 (require 'ada-indent-user-options)
36 (defconst ada-wisi-class-list
39 block-middle ;; not start of statement
40 block-start ;; start of block is start of statement
44 name-paren ;; anything that looks like a procedure call, since the grammar can't distinguish most of them
56 (defun ada-wisi-current-indentation ()
57 "Return indentation appropriate for point on current line:
58 if not in paren, beginning of line
59 if in paren, pos following paren."
60 (if (not (ada-in-paren-p))
65 (let ((line (line-number-at-pos)))
66 (ada-goto-open-paren 1)
67 (when (= line (line-number-at-pos))
74 (defun ada-wisi-indent-cache (offset cache)
75 "Return indentation of OFFSET plus indentation of line containing point. Point must be at CACHE."
76 (let ((indent (current-indentation)))
80 ((eq 'LEFT_PAREN (wisi-cache-token cache))
81 ;; test/ada_mode-long_paren.adb
85 ;; (RX_Torque_Subaddress |
88 ;; test/ada_mode-parens.adb
92 ;; indenting '(local_6)'; 'offset' = ada-indent - 1
93 (+ (current-column) 1 offset))
96 (let ((containing (wisi-goto-containing-paren cache)))
98 ;; test/ada_mode-conditional_expressions.adb
99 ;; K2 : Integer := (if J > 42
101 ;; indenting 'then'; offset = 0
103 ;; L1 : Integer := (case J is
107 ;; C_S_Controls : constant
111 ;; 1 => -- Used to be aligned on "CSCL_Type'"
112 ;; -- aligned with previous comment.
113 ;; IO_CPU_Control_State_S_Pkg.CPU2_Fault_Status_Type'
114 ;; (Unused2 => 10, -- Used to be aligned on "1 =>"
115 ;; indenting '(Unused2'
116 (+ (current-column) offset)))))
118 ;; all other structures
120 ;; current cache may be preceded by something on same
121 ;; line. Handle common cases nicely.
124 (not (= (current-column) indent))
125 (eq 'EQUAL_GREATER (wisi-cache-token cache))))
127 (eq 'WHEN (wisi-cache-token cache))
128 (not (eq 'exit_statement (wisi-cache-nonterm cache))))
129 (setq offset (+ offset ada-indent-when)))
130 (setq cache (wisi-goto-containing cache))
131 (setq indent (current-indentation)))
135 ;; test/ada_mode-opentoken.ads
136 ;; private package GDS.Commands.Add_Statement is
137 ;; type Instance is new Nonterminal.Instance with null record;
139 ;; test/ada_mode-nominal.adb
140 ;; return B : Integer :=
144 ((eq 'label_opt (wisi-cache-token cache))
145 (+ indent (- ada-indent-label) offset))
148 ;; test/ada_mode-generic_instantiation.ads
149 ;; function Function_1 is new Instance.Generic_Function
150 ;; (Param_Type => Integer,
152 ;; test/ada_mode-nested_packages.adb
153 ;; function Create (Model : in Integer;
154 ;; Context : in String) return String is
156 ;; Cache : array (1 .. 10) of Boolean := (True, False, others => False);
161 (defun ada-wisi-indent-containing (offset cache &optional before)
162 "Return indentation of OFFSET plus indentation of token containing CACHE.
163 BEFORE should be t when called from ada-wisi-before-cache, nil otherwise."
166 ((markerp (wisi-cache-containing cache))
167 (ada-wisi-indent-cache offset (wisi-goto-containing cache)))
172 (ada-goto-open-paren 1)
173 (+ (current-column) offset))
176 ;; at outermost containing statement. If called from
177 ;; ada-wisi-before-cache, we want to ignore OFFSET (indenting
178 ;; 'package' in a package spec). If called from
179 ;; ada-wisi-after-cache, we want to include offset (indenting
180 ;; first declaration in the package).
181 (if before 0 offset))
185 (defun ada-wisi-indent-list-break (cache prev-token)
186 "Return indentation for a token contained by CACHE, which must be a list-break.
187 point must be on CACHE. PREV-TOKEN is the token before the one being indented."
188 (let ((break-point (point))
189 (containing (wisi-goto-containing cache)))
190 (cl-ecase (wisi-cache-token containing)
192 (if (equal break-point (cadr prev-token))
193 ;; we are indenting the first token after the list-break; not hanging.
196 ;; Append_To (Formals,
197 ;; Make_Parameter_Specification (Loc,
198 ;; indenting 'Make_...'
200 ;; test/ada_mode-generic_instantiation.ads
201 ;; function Function_1 is new Instance.Generic_Function
202 ;; (Param_Type => Integer,
203 ;; Result_Type => Boolean,
205 ;; indenting 'Result_Type'
206 (+ (current-column) 1)
209 ;; test/ada_mode-parens.adb
216 (+ (current-column) 1 ada-indent-broken)))
219 ;; test/ada_mode-conditional_expressions.adb
220 ;; L1 : Integer := (case J is
222 ;; -- comment aligned with 'when'
223 ;; indenting '-- comment'
224 (wisi-indent-paren (+ 1 ada-indent-when)))
227 (cl-ecase (wisi-cache-nonterm containing)
229 ;; test/ada_mode-nominal-child.ads
230 ;; (Default_Parent with
231 ;; Child_Element_1 => 10,
232 ;; Child_Element_2 => 12.0,
233 ;; indenting 'Child_Element_2'
234 (wisi-indent-paren 1))
236 (aspect_specification_opt
238 ;; type Vector is tagged private
240 ;; Constant_Indexing => Constant_Reference,
241 ;; Variable_Indexing => Reference,
242 ;; indenting 'Variable_Indexing'
243 (+ (current-indentation) ada-indent-broken))
248 (defun ada-wisi-before-cache ()
249 "Point is at indentation, before a cached token. Return new indentation for point."
250 (let ((pos-0 (point))
251 (cache (wisi-get-cache (point)))
252 (prev-token (save-excursion (wisi-backward-token)))
255 (cl-ecase (wisi-cache-class cache)
257 (cl-case (wisi-cache-token cache)
258 (IS ;; subprogram body
259 (ada-wisi-indent-containing 0 cache t))
262 ;; test/ada_mode-nominal.ads; ada-indent-record-rel-type = 3
263 ;; type Private_Type_2 is abstract tagged limited
265 ;; indenting 'record'
267 ;; type Limited_Derived_Type_1d is
268 ;; abstract limited new Private_Type_1 with
270 ;; indenting 'record'
272 ;; for Record_Type_1 use
274 ;; indenting 'record'
275 (let ((containing (wisi-goto-containing cache)))
276 (while (not (memq (wisi-cache-token containing) '(FOR TYPE)))
277 (setq containing (wisi-goto-containing containing)))
278 (+ (current-column) ada-indent-record-rel-type)))
281 (ada-wisi-indent-containing ada-indent cache t))))
284 (cl-case (wisi-cache-nonterm cache)
287 (wisi-goto-containing cache);; now on 'record'
288 (current-indentation)))
291 (ada-wisi-indent-containing 0 cache t))
295 (cl-case (wisi-cache-token cache)
297 (ada-wisi-indent-containing ada-indent-when cache t))
300 (ada-wisi-indent-containing 0 cache t))
303 (close-paren (wisi-indent-paren 0))
306 ;; defer to after-cache)
310 ;; test/ada_mode-parens.adb
312 ;; , -- used to get an error here; don't care about the actual indentation
315 ;; We don't actually care what the indentation is, since this
316 ;; should only occur while editing; defer to after-cache
317 ;; avoids an error and does something reasonable.
322 ((let ((temp (save-excursion (wisi-goto-containing cache))))
324 (memq (wisi-cache-nonterm temp) '(subprogram_body subprogram_declaration))))
325 ;; test/ada_mode-nominal.ads
329 ;; Procedure_1c (Item : in out Parent_Type_1);
330 ;; indenting 'Procedure_1c'
332 ;; not overriding function
333 ;; Function_2e (Param : in Parent_Type_1) return Float;
334 ;; indenting 'Function_2e'
335 (ada-wisi-indent-containing ada-indent-broken cache t))
338 ;; defer to ada-wisi-after-cache, for consistency
343 ;; defer to ada-wisi-after-cache, for consistency
347 (let* ((containing (wisi-goto-containing cache))
348 (containing-pos (point)))
349 (cl-case (wisi-cache-token containing)
351 ;; test/ada_mode-parens.adb
352 ;; A : Matrix_Type :=
355 ;; indenting (4; containing is '),' ; 0
357 ;; test/ada_mode-parens.adb
358 ;; Local_14 : Local_14_Type :=
362 ;; indenting ("4"; contaning is '3",' ; ada-indent-broken
364 (ada-wisi-indent-containing
365 (if (= (nth 1 prev-token) containing-pos) 0 ada-indent-broken)
369 (setq containing (wisi-goto-containing containing))
370 (cl-ecase (wisi-cache-token containing)
372 ;; test/ada_mode-long_paren.adb
376 ;; (RX_Torque_Subaddress |
377 ;; indenting (RX_Torque
378 (ada-wisi-indent-containing ada-indent-broken containing t))
380 ;; test/ada_mode-parens.adb
383 ;; indenting '(1 => 12'; containing is '=>'
384 (ada-wisi-indent-cache (1- ada-indent) containing))
386 ;; test/ada_mode-conditional_expressions.adb
389 ;; indenting '(if'; containing is '=>'
390 (+ (current-column) -1 ada-indent))
393 ;; function Wuff return Boolean with Pre =>
394 ;; (for all x in U =>
395 ;; indenting '(for'; containing is '=>', 'with', 'function'
396 (ada-wisi-indent-cache (1- ada-indent) containing))
399 ((FUNCTION PROCEDURE)
400 ;; test/ada_mode-nominal.adb
401 ;; function Function_Access_11
402 ;; (A_Param : in Float)
403 ;; -- EMACSCMD:(test-face "function" font-lock-keyword-face)
404 ;; return access function
405 ;; (A_Param : in Float)
407 ;; Standard.Float -- Ada mode 4.01, GPS do this differently
408 ;; indenting second '(A_Param)
409 (+ (current-indentation) -1 ada-indent))
412 ;; test/ada_mode-parens.adb
418 (+ (current-column) 1 ada-indent-broken))
421 ;; test/ada_mode-nominal.adb
423 ;; when Local_1 = 0 and not
425 ;; indenting (Local_2
428 ;; (X : Integer) when Local_1 = 0 and not
430 (+ (ada-wisi-current-indentation) ada-indent-broken))
432 ((IDENTIFIER selected_component name)
438 ;; test/ada_mode-parens.adb
446 ;; test/ada_mode-parens.adb
447 ;; Local_11 : Local_11_Type := Local_11_Type'
453 ;; test/ada_mode-parens.adb
454 ;; Local_12 : Local_11_Type
455 ;; := Local_11_Type'(A => Integer
458 (+ (ada-wisi-current-indentation) ada-indent-broken))
462 ((memq (wisi-cache-class containing) '(block-start statement-start))
463 ;; test/ada_mode-nominal.adb
467 (ada-wisi-indent-cache ada-indent-broken containing))
470 ;; Open paren in an expression.
472 ;; test/ada_mode-conditional_expressions.adb
474 ;; (case J is when 42 => -1, when Integer'First .. 41 => 0, when others => 1);
476 (ada-wisi-indent-containing ada-indent-broken containing t))
480 (return-with-params;; parameter list
481 (let ((return-pos (point)))
482 (wisi-goto-containing cache nil) ;; matching 'function'
484 ((<= ada-indent-return 0)
485 ;; indent relative to "("
486 (wisi-forward-find-class 'open-paren return-pos)
487 (+ (current-column) (- ada-indent-return)))
490 (+ (current-column) ada-indent-return))
493 (return-without-params;; no parameter list
494 (wisi-goto-containing cache nil) ;; matching 'function'
495 (+ (current-column) ada-indent-broken))
498 (ada-wisi-indent-containing ada-indent-broken cache t))
502 (let ((containing (wisi-goto-containing cache nil)))
503 (while (not (wisi-cache-nonterm containing))
504 (setq containing (wisi-goto-containing containing)))
507 ;; cases to defer to after-cache
509 (eq (wisi-cache-nonterm cache) 'qualified_expression)
510 ;; test/ada_mode-parens.adb Local_13 Integer'
511 (not (eq (wisi-cache-token containing) 'COLON_EQUAL)))
512 ;; _not_ test/indent.ads CSCL_Type'
517 (cl-case (wisi-cache-token cache)
519 (+ (current-column) ada-indent-broken))
523 ;; elsif Current_Argument < CL.Argument_Count then
524 (ada-wisi-indent-cache 0 containing))
527 (cl-ecase (wisi-cache-nonterm containing)
528 ((generic_renaming_declaration subprogram_renaming_declaration)
529 (wisi-forward-find-token '(FUNCTION PROCEDURE) pos-0)
530 (let ((pos-subprogram (point))
532 ;; this is wrong for one return access
533 ;; function case: overriding function Foo
534 ;; return access Bar (...) renames ...;
535 (wisi-forward-find-token 'LEFT_PAREN pos-0 t)))
537 (if (<= ada-indent-renames 0)
538 ;; indent relative to paren
539 (+ (current-column) (- ada-indent-renames))
540 ;; else relative to line containing keyword
541 (goto-char pos-subprogram)
542 (+ (current-indentation) ada-indent-renames))
545 (goto-char pos-subprogram)
546 (+ (current-indentation) ada-indent-broken))
549 (object_renaming_declaration
550 (+ (current-indentation) ada-indent-broken))
554 (cl-ecase (wisi-cache-nonterm containing)
556 ;; test/ada_mode-nominal-child.adb
557 ;; return (Parent_Type_1
558 ;; with 1, 0.0, False);
559 ;; indenting 'with'; containing is '('
560 (+ (current-column) 1))
562 (component_declaration
563 ;; test/ada_mode-nominal.ads Record_Type_3 ':'
564 (+ (current-column) ada-indent-broken))
567 ;; test/ada_mode-nominal.adb
570 ;; when Local_1 = 0 and not
571 ;; indenting 'when'; containing is 'entry'
572 (+ (current-column) ada-indent-broken))
574 (formal_package_declaration
575 ;; test/ada_mode-generic_package.ads
576 ;; with package A_Package_7 is
577 ;; new Ada.Text_IO.Integer_IO (Num => Formal_Signed_Integer_Type);
578 ;; indenting 'new'; containing is 'with'
579 (+ (current-column) ada-indent-broken))
581 ((full_type_declaration
582 protected_type_declaration
583 single_protected_declaration
584 single_task_declaration
586 task_type_declaration)
588 (while (not (memq (wisi-cache-token containing) '(PROTECTED SUBTYPE TASK TYPE)))
589 (setq containing (wisi-goto-containing containing)))
592 ((eq (wisi-cache-token cache) 'WITH)
593 (let ((type-col (current-column))
594 (null_private (save-excursion (wisi-goto-end-1 cache)
595 (eq 'WITH (wisi-cache-token (wisi-backward-cache))))))
597 ((eq 'aspect_specification_opt (wisi-cache-nonterm cache))
599 ;; subtype Integer_String is String
600 ;; with Dynamic_Predicate => Integer'Value (Integer_String) in Integer
604 ;; protected Separate_Protected_Body
609 ;; test/ada_nominal.ads
610 ;; task type Task_Type_1 (Name : access String)
612 ;; Storage_Size => 512 + 256
617 ;; 'with null record;' or 'with private;'
618 ;; test/ada_mode-nominal.ads
619 ;; type Limited_Derived_Type_3 is abstract limited new Private_Type_1
621 ;; indenting 'with'; containing is 'is'
622 (+ type-col ada-indent-broken))
625 ;; test/ada_mode-nominal.ads
626 ;; type Unconstrained_Array_Type_3 is array (Integer range <>, Standard.Character range <>)
627 ;; of Object_Access_Type_1;
628 ;; indenting 'of'; containing is 'is'
630 ;; type Object_Access_Type_7
631 ;; is access all Integer;
632 ;; indenting 'is'; containing is 'type'
633 (+ type-col ada-indent-record-rel-type)))))
636 ;; test/ada_mode-nominal.ads
637 ;; type Limited_Derived_Type_2a is abstract limited new Private_Type_1
639 ;; indenting 'with record'
641 ;; test/access_in_record.ads
643 ;; is new Ada.Streams.Root_Stream_Type with record
645 ;; test/adacore_9717_001.ads A_Long_Name
646 ;; subtype A_Long_Name
647 ;; is Ada.Text_Io.Count;
649 (+ (current-column) ada-indent-broken))
652 (generic_instantiation
653 ;; test/ada_mode-generic_instantiation.ads
654 ;; procedure Procedure_7 is
655 ;; new Instance.Generic_Procedure (Integer, Function_1);
657 (+ (current-column) ada-indent-broken))
659 (generic_renaming_declaration
660 ;; indenting keyword following 'generic'
664 (cl-ecase (wisi-cache-token containing)
666 ;; test/ada_mode-nominal.ads
667 ;; Anon_Array_3 : array (1 .. 10)
670 (+ (current-indentation) ada-indent-broken))
674 ;; C_S_Controls : constant
677 ;; indenting 'CSCL_Type'
678 (+ (current-indentation) ada-indent-broken))
681 ;; test/ada_mode-nominal.adb
682 ;; Local_2 : constant Float
684 (+ (current-indentation) ada-indent-broken))
687 (private_extension_declaration
688 (cl-ecase (wisi-cache-token cache)
691 ;; type Date_Set is tagged private
694 (current-indentation))
697 ;; test/ada_mode-nominal.ads
698 ;; type Limited_Derived_Type_3 is abstract limited
699 ;; new Private_Type_1 with private;
701 (+ (current-indentation) ada-indent-broken))
704 (private_type_declaration
706 ;; type Vector is tagged private
709 (current-indentation))
711 (qualified_expression
712 ;; test/ada_mode-nominal-child.ads
713 ;; Child_Obj_5 : constant Child_Type_1 :=
715 ;; (Parent_Element_1 => 1,
716 (ada-wisi-indent-cache ada-indent-broken containing))
719 (cl-case (wisi-cache-token containing)
721 (- (current-column) ada-indent-label))
724 ;; test/ada_mode-nominal.adb
730 (ada-wisi-indent-cache ada-indent-broken cache))
733 ((abstract_subprogram_declaration
734 expression_function_declaration
736 subprogram_declaration
737 subprogram_specification
738 null_procedure_declaration)
739 (cl-ecase (wisi-cache-token cache)
741 ;; test/ada_mode-nominal.ads
742 ;; procedure Procedure_1d
743 ;; (Item : in out Parent_Type_1;
744 ;; Item_1 : in Character;
745 ;; Item_2 : out Character)
748 (+ (current-column) ada-indent-broken))
751 ;; indenting 'overriding' following 'not'
754 ((PROCEDURE FUNCTION)
755 ;; indenting 'procedure' or 'function following 'overriding'
759 ;; indenting aspect specification on subprogram declaration
761 ;; procedure Foo (X : Integer;
763 ;; with Pre => X > 10 and
769 )))) ;; end statement-other
773 ((eq 'label_opt (wisi-cache-token cache))
774 (ada-wisi-indent-containing (+ ada-indent-label ada-indent) cache t))
777 (let ((containing-cache (wisi-get-containing-cache cache)))
778 (if (not containing-cache)
782 (cl-case (wisi-cache-class containing-cache)
783 ((block-start block-middle)
784 (wisi-goto-containing cache)
785 (cl-case (wisi-cache-nonterm containing-cache)
787 (+ (current-indentation) ada-indent))
790 (ada-wisi-indent-cache ada-indent containing-cache))
794 (ada-wisi-indent-list-break cache prev-token))
801 (defun ada-wisi-after-cache ()
802 "Point is at indentation, not before a cached token. Find previous
803 cached token, return new indentation for point."
805 (let ((start (point))
806 (prev-token (save-excursion (wisi-backward-token)))
807 (cache (wisi-backward-cache)))
814 (while (memq (wisi-cache-class cache) '(keyword name name-paren type))
815 ;; not useful for indenting
816 (setq cache (wisi-backward-cache)))
818 (cl-ecase (wisi-cache-class cache)
820 ;; indenting block/subprogram name after 'end'
821 (wisi-indent-current ada-indent-broken))
824 (cl-case (wisi-cache-token cache)
826 (cl-case (wisi-cache-nonterm cache)
828 ;; between 'case .. is' and first 'when'; most likely a comment
829 (ada-wisi-indent-containing 0 cache t))
832 (+ (ada-wisi-indent-containing ada-indent cache t)))
837 ;; test/ada_mode-conditional_expressions.adb
838 ;; K3 : Integer := (if
846 (cl-ecase (wisi-cache-nonterm (wisi-get-containing-cache cache))
847 ((statement if_statement elsif_statement_item) ada-indent)
848 ((if_expression elsif_expression_item) ada-indent-broken))))
849 (ada-wisi-indent-containing indent cache t)))
852 ;; between 'when' and '=>'
853 (+ (current-column) ada-indent-broken))
856 ;; block-middle keyword may not be on separate line:
857 ;; function Create (Model : in Integer;
858 ;; Context : in String) return String is
859 (ada-wisi-indent-containing ada-indent cache nil))
863 (cl-case (wisi-cache-nonterm cache)
865 ;; between 'when' and '=>'
866 (+ (current-column) ada-indent-broken))
869 (ada-wisi-indent-containing ada-indent-broken cache nil))
872 (ada-wisi-indent-containing (+ ada-indent-when ada-indent-broken) cache nil))
874 (t ;; other; normal block statement
875 (ada-wisi-indent-cache ada-indent cache))
879 ;; actual_parameter_part: test/ada_mode-nominal.adb
881 ;; Foo (Bar) + -- multi-line expression that happens to have a cache at a line start
883 ;; indenting '12'; don't indent relative to containing function name
885 ;; attribute_designator: test/ada_mode-nominal.adb
886 ;; raise Constraint_Error with Count'Image (Line (File)) &
888 ;; indenting '"foo"'; relative to raise
890 ;; test/ada_mode-slices.adb
891 ;; Put_Line(Day'Image(D1) & " - " & Day'Image(D2) & " = " &
892 ;; Integer'Image(N));
893 ;; indenting 'Integer'
894 (when (memq (wisi-cache-nonterm cache)
895 '(actual_parameter_part attribute_designator))
896 (setq cache (wisi-goto-containing cache)))
897 (ada-wisi-indent-containing ada-indent-broken cache nil))
900 (ada-wisi-indent-list-break cache prev-token))
903 ;; 1) A parenthesized expression, or the first item in an aggregate:
910 ;; we are indenting 'bar'
912 ;; 2) A parenthesized expression, or the first item in an
913 ;; aggregate, and there is whitespace between
914 ;; ( and the first token:
916 ;; test/ada_mode-parens.adb
917 ;; Local_9 : String := (
920 ;; 3) A parenthesized expression, or the first item in an
921 ;; aggregate, and there is a comment between
922 ;; ( and the first token:
924 ;; test/ada_mode-nominal.adb
927 ;; -- a comment between paren and first association
930 ;; test/ada_mode-parens.adb
933 ;; indenting 'Integer'
934 (let ((paren-column (current-column))
935 (start-is-comment (save-excursion (goto-char start) (looking-at comment-start-skip))))
936 (wisi-forward-token); point is now after paren
938 (skip-syntax-forward " >"); point is now on comment
939 (forward-comment (point-max)); point is now on first token
941 (if (= (point) start)
945 (+ paren-column 1 ada-indent-broken))))
947 ((return-with-params return-without-params)
948 ;; test/ada_mode-nominal.adb
949 ;; function Function_Access_1
950 ;; (A_Param : in Float)
953 ;; indenting 'Standard.Float'
955 ;; test/ada_mode-expression_functions.ads
956 ;; function Square (A : in Float) return Float
960 ;; test/ada_mode-nominal.ads
961 ;; function Function_2g
962 ;; (Param : in Private_Type_1)
966 (back-to-indentation)
967 (+ (current-column) ada-indent-broken))
970 (ada-wisi-indent-containing 0 cache nil))
973 (cl-ecase (wisi-cache-token cache)
979 ;; -- 'abort' indented with ada-indent-broken, since this is part
981 (ada-wisi-indent-containing ada-indent cache))
983 ;; test/subdir/ada_mode-separate_task_body.adb
985 ;; Local_3 : constant Float :=
988 ;; test/ada_mode-nominal.ads
989 ;; type Record_Type_3 (Discriminant_1 : access Integer) is tagged record
990 ;; Component_1 : Integer; -- end 2
993 ;; indenting 'Integer'; containing is ';'
994 (ada-wisi-indent-cache ada-indent-broken cache))
997 (cl-ecase (wisi-cache-nonterm cache)
999 (cl-ecase (wisi-cache-nonterm (wisi-get-containing-cache cache))
1001 ;; test/with_use1.adb
1002 (ada-wisi-indent-containing ada-indent-use cache))
1005 ;; test/ada_mode-nominal.ads
1006 ;; limited private with Ada.Strings.Bounded,
1007 ;; --EMACSCMD:(test-face "Ada.Containers" 'default)
1010 ;; test/with_use1.adb
1011 (ada-wisi-indent-containing ada-indent-with cache))
1016 ;; test/g-comlin.adb
1017 ;; elsif Index_Switches + Max_Length <= Switches'Last
1018 ;; and then Switches (Index_Switches + Max_Length) = '?'
1019 (ada-wisi-indent-cache ada-indent-broken cache))
1022 (let ((cache-col (current-column))
1024 (line-end-pos (line-end-position))
1025 (containing (wisi-goto-containing cache nil)))
1026 (while (eq (wisi-cache-nonterm containing) 'association_list)
1027 (setq containing (wisi-goto-containing containing nil)))
1029 (cl-ecase (wisi-cache-nonterm containing)
1030 ((actual_parameter_part aggregate)
1031 ;; ada_mode-generic_package.ads
1032 ;; with package A_Package_2 is new Ada.Text_IO.Integer_IO (Num =>
1033 ;; Formal_Signed_Integer_Type);
1034 ;; indenting 'Formal_Signed_...', point on '(Num'
1036 ;; test/ada_mode-parens.adb
1041 ;; indenting '1,' or '1 +'; point on '(1'
1043 ;; test/ada_mode-parens.adb
1044 ;; Local_13 : Local_11_Type
1047 ;; indenting 'Integer'; point on '(Integer'
1048 (+ (current-column) 1 ada-indent-broken))
1050 (aspect_specification_opt
1052 ;; with Pre => X > 10 and
1057 ;; indenting 'X < 50' or 'Y >= X'; cache is '=>', point is on '=>'
1058 ;; or indenting 'Post =>'; cache is ',', point is on 'with'
1059 (cl-ecase (wisi-cache-token cache)
1061 (+ (current-indentation) ada-indent-broken))
1064 (if (= (+ 2 cache-pos) line-end-pos)
1068 (goto-char cache-pos)
1069 (+ (current-indentation) ada-indent-broken))
1070 ;; with Pre => X > 10 and
1076 (cl-ecase (save-excursion (wisi-cache-token (wisi-goto-containing cache nil)))
1078 (ada-wisi-indent-containing (* 2 ada-indent-broken) cache))
1081 ((case_expression_alternative case_statement_alternative exception_handler)
1082 ;; containing is 'when'
1083 (+ (current-column) ada-indent))
1085 (generic_renaming_declaration
1086 ;; not indenting keyword following 'generic'
1087 (+ (current-column) ada-indent-broken))
1090 ;; test/ada_mode-quantified_expressions.adb
1091 ;; if (for some J in 1 .. 10 =>
1093 (ada-wisi-indent-containing ada-indent-broken cache))
1097 ;; test/ada_mode-nominal.adb
1101 ;; indenting 'accept'; point is on 'when'
1102 (+ (current-column) ada-indent))
1105 ;; test/generic_param.adb
1106 ;; case Item_Type is
1107 ;; when Fix | Airport =>
1110 (+ (current-column) ada-indent))
1115 (setq cache (wisi-goto-containing cache))
1116 (cl-ecase (wisi-cache-nonterm cache)
1117 (full_type_declaration
1118 ;; ada_mode/nominal.ads
1119 ;; type Limited_Derived_Type_1a is abstract limited new
1120 ;; Private_Type_1 with record
1121 ;; Component_1 : Integer;
1122 ;; indenting 'Private_Type_1'; look for 'record'
1123 (let ((type-column (current-column)))
1125 (if (wisi-forward-find-token 'RECORD (line-end-position) t)
1126 ;; 'record' on line being indented
1127 (+ type-column ada-indent-record-rel-type)
1128 ;; 'record' on later line
1129 (+ type-column ada-indent-broken))))
1131 ((formal_type_declaration
1132 ;; test/ada_mode-generic_package.ads
1133 ;; type Synchronized_Formal_Derived_Type is abstract synchronized new Formal_Private_Type and Interface_Type
1137 ;; test/ada_mode-nominal.ads
1138 ;; subtype Subtype_2 is Signed_Integer_Type range 10 ..
1141 private_type_declaration
1142 ;; type Private_Type_2 is abstract tagged limited
1145 (+ (current-column) ada-indent-broken))
1147 (null_procedure_declaration
1148 ;; ada_mode-nominal.ads
1149 ;; procedure Procedure_3b is
1152 (+ (current-column) ada-indent-broken))
1158 ;; C_S_Controls : constant
1163 (+ (current-column) 1))
1166 ;; ada_mode-nominal.ads
1167 ;; type Limited_Derived_Type_2 is abstract limited new Private_Type_1 with
1170 ;; test/ada_mode-generic_instantiation.ads
1171 ;; procedure Procedure_6 is new
1172 ;; Instance.Generic_Procedure (Integer, Function_1);
1173 ;; indenting 'Instance'; containing is 'new'
1174 (ada-wisi-indent-containing ada-indent-broken cache))
1177 ;; ada_mode-nominal.ads
1178 ;; Anon_Array_2 : array (1 .. 10) of
1180 (ada-wisi-indent-containing ada-indent-broken cache))
1183 ;; test/ada_mode-parens.adb
1186 (ada-wisi-indent-containing ada-indent-broken cache))
1189 (cl-ecase (wisi-cache-nonterm cache)
1191 ;; test/ada_mode-nominal-child.ads
1192 ;; (Default_Parent with
1194 ;; indenting '10'; containing is '('
1195 (ada-wisi-indent-containing 0 cache nil))
1197 (aspect_specification_opt
1199 ;; type Vector is tagged private
1201 ;; Constant_Indexing => Constant_Reference,
1202 ;; indenting 'Constant_Indexing'; point is on 'with'
1203 (+ (current-indentation) ada-indent-broken))
1206 ;; otherwise just hanging
1207 ((ACCEPT FUNCTION PROCEDURE RENAMES)
1208 (back-to-indentation)
1209 (+ (current-column) ada-indent-broken))
1214 (cl-case (wisi-cache-token cache)
1215 (WITH ;; with_clause
1216 (+ (current-column) ada-indent-with))
1219 ;; comment after label
1220 (+ (current-column) (- ada-indent-label)))
1223 ;; procedure Procedure_8
1224 ;; is new Instance.Generic_Procedure (Integer, Function_1);
1225 ;; indenting 'is'; hanging
1227 ;; test/ada_mode-conditional_expressions.adb
1228 ;; K3 : Integer := (if
1235 (ada-wisi-indent-cache ada-indent-broken cache))
1240 (defun ada-wisi-comment ()
1241 "Compute indentation of a comment. For `wisi-indent-calculate-functions'."
1242 ;; We know we are at the first token on a line. We check for comment
1243 ;; syntax, not comment-start, to accomodate gnatprep, skeleton
1244 ;; placeholders, etc.
1245 (when (and (not (= (point) (point-max))) ;; no char after EOB!
1246 (= 11 (syntax-class (syntax-after (point)))))
1248 ;; We are at a comment; indent to previous code or comment.
1250 ((and ada-indent-comment-col-0
1251 (= 0 (current-column)))
1255 (save-excursion (forward-line -1) (looking-at "\\s *$"))
1256 (save-excursion (forward-comment -1)(not (looking-at comment-start))))
1257 ;; comment is after a blank line or code; indent as if code
1259 ;; ada-wisi-before-cache will find the keyword _after_ the
1260 ;; comment, which could be a block-middle or block-end, and that
1261 ;; would align the comment with the block-middle, which is wrong. So
1262 ;; we only call ada-wisi-after-cache.
1264 (let ((indent (ada-wisi-after-cache))
1265 prev-indent next-indent)
1266 (if ada-indent-comment-gnat
1267 ;; match the gnat comment indent style check; comments must
1268 ;; be aligned to one of:
1270 ;; - multiple of ada-indent
1271 ;; - next non-blank line
1272 ;; - previous non-blank line
1274 ;; Note that we must indent the prev and next lines, in case
1275 ;; they are not currently correct.
1277 ((= 0 (% indent ada-indent))
1278 ;; this will handle comments at bob and eob, so we don't
1279 ;; need to worry about those positions in the next checks.
1282 ((and (setq prev-indent
1283 (save-excursion (forward-line -1)(indent-according-to-mode)(current-indentation)))
1284 (= indent prev-indent))
1287 ((and (setq next-indent
1288 ;; we use forward-comment here, instead of
1289 ;; forward-line, because consecutive comment
1290 ;; lines are indented to the current one, which
1291 ;; we don't know yet.
1292 (save-excursion (forward-comment (point-max))(indent-according-to-mode)(current-indentation)))
1293 (= indent next-indent))
1300 (floor indent ada-indent)))
1303 ;; not forcing gnat style
1307 ;; comment is after a comment
1308 (forward-comment -1)
1312 (defun ada-wisi-post-parse-fail ()
1313 "For `wisi-post-parse-fail-hook'."
1315 (let ((start-cache (wisi-goto-start (or (wisi-get-cache (point)) (wisi-backward-cache)))))
1317 ;; nil when in a comment at point-min
1318 (indent-region (point) (wisi-cache-end start-cache)))
1320 (back-to-indentation))
1322 ;;;; ada-mode functions (alphabetical)
1324 (defun ada-wisi-declarative-region-start-p (cache)
1325 "Return t if cache is a keyword starting a declarative region."
1326 (cl-case (wisi-cache-token cache)
1329 (memq (wisi-cache-class cache) '(block-start block-middle)))
1333 (defun ada-wisi-context-clause ()
1334 "For `ada-fix-context-clause'."
1335 (wisi-validate-cache (point-max))
1337 (goto-char (point-min))
1343 (setq cache (wisi-forward-cache))
1344 (cl-case (wisi-cache-nonterm cache)
1345 (pragma (wisi-goto-end-1 cache))
1346 (use_clause (wisi-goto-end-1 cache))
1349 (setq begin (point-at-bol)))
1350 (wisi-goto-end-1 cache))
1352 ;; start of compilation unit
1353 (setq end (point-at-bol))
1360 (defun ada-wisi-on-context-clause ()
1361 "For `ada-on-context-clause'."
1364 ;; Don't require parse of large file just for ada-find-other-file
1365 (and (< (point-max) wisi-size-threshold)
1366 (setq cache (wisi-goto-statement-start))
1367 (memq (wisi-cache-nonterm cache) '(use_clause with_clause))
1370 (defun ada-wisi-in-case-expression ()
1371 "For `ada-in-case-expression'."
1373 ;; Used by ada-align, which does indent, which will require parse
1374 ;; We know we are in a paren.
1375 (ada-goto-open-paren 1)
1376 (let ((cache (wisi-get-cache (point))))
1378 (eq (wisi-cache-nonterm cache) 'case_expression)))
1381 (defun ada-wisi-goto-subunit-name ()
1382 "For `ada-goto-subunit-name'."
1383 (wisi-validate-cache (point-max))
1384 (if (not (> wisi-cache-max (point)))
1386 (message "parse failed; can't goto subunit name")
1393 ;; move to top declaration
1394 (goto-char (point-min))
1395 (setq cache (or (wisi-get-cache (point))
1396 (wisi-forward-cache)))
1398 (cl-case (wisi-cache-nonterm cache)
1399 ((pragma use_clause with_clause)
1400 (wisi-goto-end-1 cache)
1401 (setq cache (wisi-forward-cache)))
1403 ;; start of compilation unit
1406 (when (eq (wisi-cache-nonterm cache) 'subunit)
1407 (wisi-forward-find-class 'name (point-max)) ;; parent name
1408 (wisi-forward-token)
1409 (wisi-forward-find-class 'name (point-max)) ;; subunit name
1410 (setq name-pos (point)))
1413 (goto-char name-pos))
1416 (defun ada-wisi-goto-declaration-start ()
1417 "For `ada-goto-declaration-start', which see.
1418 Also return cache at start."
1419 (wisi-validate-cache (point))
1420 (unless (> wisi-cache-max (point))
1421 (error "parse failed; can't goto declarative-region-start"))
1423 (let ((cache (wisi-get-cache (point)))
1426 (setq cache (wisi-backward-cache)))
1427 ;; cache is null at bob
1432 (cl-case (wisi-cache-nonterm cache)
1433 ((generic_package_declaration generic_subprogram_declaration)
1434 (eq (wisi-cache-token cache) 'GENERIC))
1436 ((package_body package_declaration)
1437 (eq (wisi-cache-token cache) 'PACKAGE))
1439 ((protected_body protected_type_declaration single_protected_declaration)
1440 (eq (wisi-cache-token cache) 'PROTECTED))
1442 ((abstract_subprogram_declaration
1444 subprogram_declaration
1445 null_procedure_declaration)
1446 (memq (wisi-cache-token cache) '(NOT OVERRIDING FUNCTION PROCEDURE)))
1448 (task_type_declaration
1449 (eq (wisi-cache-token cache) 'TASK))
1453 (setq cache (wisi-goto-containing cache nil))))
1458 (defun ada-wisi-goto-declaration-end ()
1459 "For `ada-goto-declaration-end', which see."
1460 ;; first goto-declaration-start, so we get the right end, not just
1461 ;; the current statement end.
1462 (wisi-goto-end-1 (ada-wisi-goto-declaration-start)))
1464 (defun ada-wisi-goto-declarative-region-start ()
1465 "For `ada-goto-declarative-region-start', which see."
1466 (wisi-validate-cache (point))
1467 (unless (> wisi-cache-max (point))
1468 (error "parse failed; can't goto declarative-region-start"))
1474 (wisi-get-cache (point))
1475 ;; we use forward-cache here, to handle the case where point is after a subprogram declaration:
1478 ;; function ... is ... end;
1480 ;; function ... is ... end;
1481 (wisi-forward-cache))))
1483 (if (ada-wisi-declarative-region-start-p cache)
1485 (wisi-forward-token)
1487 (cl-case (wisi-cache-class cache)
1488 ((block-middle block-end)
1489 (setq cache (wisi-prev-statement-cache cache)))
1492 ;; 1) test/ada_mode-nominal.adb
1493 ;; protected body Protected_1 is -- target 2
1497 ;; 2) test/ada_mode-nominal.adb
1498 ;; function Function_Access_1
1499 ;; (A_Param <point> : in Float)
1505 ;; 3) test/ada_mode-nominal-child.adb
1506 ;; overriding <point> function Function_2c (Param : in Child_Type_1)
1508 ;; is -- target Function_2c
1513 (setq cache (wisi-goto-containing cache t))
1515 (cl-case (wisi-cache-nonterm cache)
1517 (while (not (eq 'IS (wisi-cache-token cache)))
1518 (setq cache (wisi-next-statement-cache cache))))
1520 (setq cache (wisi-goto-containing cache t)))
1523 (setq cache (wisi-goto-containing cache t)))
1525 (when first (setq first nil)))
1528 (defun ada-wisi-in-paramlist-p (&optional parse-result)
1529 "For `ada-in-paramlist-p'."
1530 (wisi-validate-cache (point))
1531 ;; (info "(elisp)Parser State" "*syntax-ppss*")
1532 (let ((parse-result (or parse-result (syntax-ppss)))
1534 (and (> (nth 0 parse-result) 0)
1535 ;; cache is nil if the parse failed
1536 (setq cache (wisi-get-cache (nth 1 parse-result)))
1537 (eq 'formal_part (wisi-cache-nonterm cache)))
1540 (defun ada-wisi-make-subprogram-body ()
1541 "For `ada-make-subprogram-body'."
1542 (wisi-validate-cache (point))
1543 (when wisi-parse-failed
1544 (error "syntax parse failed; cannot create body"))
1546 (let* ((begin (point))
1547 (end (save-excursion (wisi-forward-find-class 'statement-end (point-max)) (point)))
1548 (cache (wisi-forward-find-class 'name end))
1549 (name (buffer-substring-no-properties
1551 (+ (point) (wisi-cache-last cache)))))
1554 (insert " is begin\nnull;\nend ");; legal syntax; parse does not fail
1558 ;; newline after body to separate from next body
1559 (newline-and-indent)
1560 (indent-region begin (point))
1562 (back-to-indentation); before 'null;'
1565 (defun ada-wisi-scan-paramlist (begin end)
1566 "For `ada-scan-paramlist'."
1567 (wisi-validate-cache end)
1568 (when (< wisi-cache-max end)
1569 (error "parse failed; can't scan paramlist"))
1591 (let ((token-text (wisi-forward-token)))
1592 (setq token (nth 0 token-text))
1593 (setq text (wisi-token-text token-text)))
1595 ((equal token 'COMMA) nil);; multiple identifiers
1597 ((equal token 'COLON)
1598 ;; identifiers done. find type-begin; there may be no mode
1599 (skip-syntax-forward " ")
1600 (setq type-begin (point))
1602 (while (member (car (wisi-forward-token)) '(ALIASED IN OUT NOT NULL ACCESS CONSTANT PROTECTED))
1603 (skip-syntax-forward " ")
1604 (setq type-begin (point)))))
1606 ((equal token 'ALIASED) (setq aliased-p t))
1607 ((equal token 'IN) (setq in-p t))
1608 ((equal token 'OUT) (setq out-p t))
1609 ((and (not type-end)
1610 (member token '(NOT NULL)))
1611 ;; "not", "null" could be part of the default expression
1612 (setq not-null-p t))
1613 ((equal token 'ACCESS) (setq access-p t))
1614 ((equal token 'CONSTANT) (setq constant-p t))
1615 ((equal token 'PROTECTED) (setq protected-p t))
1617 ((equal token 'COLON_EQUAL)
1618 (setq type-end (save-excursion (backward-char 2) (skip-syntax-backward " ") (point)))
1619 (skip-syntax-forward " ")
1620 (setq default-begin (point))
1621 (wisi-forward-find-token 'SEMICOLON end t))
1623 ((equal token 'LEFT_PAREN)
1624 ;; anonymous access procedure type
1625 (goto-char (scan-sexps (1- (point)) 1)))
1627 ((member token '(SEMICOLON RIGHT_PAREN))
1628 (when (not type-end)
1629 (setq type-end (save-excursion (backward-char 1) (skip-syntax-backward " ") (point))))
1631 (setq type (buffer-substring-no-properties type-begin type-end))
1634 (setq default (buffer-substring-no-properties default-begin (1- (point)))))
1636 (when (equal token 'RIGHT_PAREN)
1639 (setq param (list (reverse identifiers)
1640 aliased-p in-p out-p not-null-p access-p constant-p protected-p
1642 (cl-pushnew param paramlist :test #'equal)
1643 (setq identifiers nil
1658 (when (not type-begin)
1659 (cl-pushnew text identifiers :test #'equal)))
1663 (defun ada-wisi-which-function-1 (keyword add-body)
1664 "Used in `ada-wisi-which-function'."
1665 (let* ((cache (wisi-forward-find-class 'name (point-max)))
1666 (result (wisi-cache-text cache)))
1668 ;; See comment at ada-mode.el on why we don't overwrite ff-function-name.
1669 (when (not ff-function-name)
1670 (setq ff-function-name
1673 (when add-body "\\s-+body")
1679 (defun ada-wisi-which-function ()
1680 "For `ada-which-function'."
1681 (wisi-validate-cache (point))
1684 (cache (condition-case nil (ada-wisi-goto-declaration-start) (error nil))))
1686 ;; bob or failed parse
1689 (when (memq (wisi-cache-nonterm cache)
1690 '(generic_package_declaration generic_subprogram_declaration))
1691 ;; name is after next statement keyword
1692 (wisi-next-statement-cache cache)
1693 (setq cache (wisi-get-cache (point))))
1695 ;; add or delete 'body' as needed
1696 (cl-ecase (wisi-cache-nonterm cache)
1698 (setq result (ada-wisi-which-function-1 "package" nil)))
1700 ((package_declaration
1701 generic_package_declaration) ;; after 'generic'
1702 (setq result (ada-wisi-which-function-1 "package" t)))
1705 (setq result (ada-wisi-which-function-1 "protected" nil)))
1707 ((protected_type_declaration single_protected_declaration)
1708 (setq result (ada-wisi-which-function-1 "protected" t)))
1710 ((abstract_subprogram_declaration
1711 subprogram_declaration
1712 generic_subprogram_declaration ;; after 'generic'
1713 null_procedure_declaration)
1714 (setq result (ada-wisi-which-function-1
1715 (wisi-cache-text (wisi-forward-find-token '(FUNCTION PROCEDURE) (point-max)))
1716 nil))) ;; no 'body' keyword in subprogram bodies
1719 (setq result (ada-wisi-which-function-1
1720 (wisi-cache-text (wisi-forward-find-token '(FUNCTION PROCEDURE) (point-max)))
1723 (task_type_declaration
1724 (setq result (ada-wisi-which-function-1 "task" t)))
1730 (defun ada-wisi-debug-keys ()
1731 "Add debug key definitions to `ada-mode-map'."
1733 (define-key ada-mode-map "\M-e" 'wisi-show-parse-error)
1734 (define-key ada-mode-map "\M-h" 'wisi-show-containing-or-previous-cache)
1735 (define-key ada-mode-map "\M-i" 'wisi-goto-statement-end)
1736 (define-key ada-mode-map "\M-j" 'wisi-show-cache)
1737 (define-key ada-mode-map "\M-k" 'wisi-show-token)
1740 (defun ada-wisi-number-p (token-text)
1741 "Return t if TOKEN-TEXT plus text after point matches the
1742 syntax for a real literal; otherwise nil. point is after
1743 TOKEN-TEXT; move point to just past token."
1744 ;; test in test/wisi/ada-number-literal.input
1746 ;; starts with a simple integer
1747 (let ((end (point)))
1748 ;; this first test must be very fast; it is executed for every token
1749 (when (and (memq (aref token-text 0) '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
1750 (string-match "^[0-9_]+$" token-text))
1752 ((= (char-after) ?#)
1755 (if (not (looking-at "[0-9a-fA-F_]+"))
1756 (progn (goto-char end) nil)
1758 (goto-char (match-end 0))
1760 ((= (char-after) ?#)
1765 ((= (char-after) ?.)
1768 (if (not (looking-at "[0-9a-fA-F]+"))
1769 (progn (goto-char end) nil)
1771 (goto-char (match-end 0))
1773 (if (not (= (char-after) ?#))
1774 (progn (goto-char end) nil)
1779 (if (not (memq (char-after) '(?e ?E)))
1780 ;; based real, no exponent
1785 (if (not (looking-at "[+-]?[0-9]+"))
1786 (progn (goto-char end) t)
1788 (goto-char (match-end 0))
1793 ;; missing trailing #
1794 (goto-char end) nil)
1797 ((= (char-after) ?.)
1798 ;; decimal real number?
1800 (if (not (looking-at "[0-9_]+"))
1802 (progn (goto-char end) t)
1804 (setq end (goto-char (match-end 0)))
1806 (if (not (memq (char-after) '(?e ?E)))
1807 ;; decimal real, no exponent
1812 (if (not (looking-at "[+-]?[0-9]+"))
1813 (progn (goto-char end) t)
1815 (goto-char (match-end 0))
1825 (defun ada-wisi-setup ()
1826 "Set up a buffer for parsing Ada files with wisi."
1827 (wisi-setup '(ada-wisi-comment
1828 ada-wisi-before-cache
1829 ada-wisi-after-cache)
1830 'ada-wisi-post-parse-fail
1832 ada-grammar-wy--keyword-table
1833 ada-grammar-wy--token-table
1834 ada-grammar-wy--parse-table)
1836 ;; Handle escaped quotes in strings
1837 (setq wisi-string-quote-escape-doubled t)
1839 (set (make-local-variable 'comment-indent-function) 'wisi-comment-indent)
1842 (add-hook 'ada-mode-hook 'ada-wisi-setup)
1844 (setq ada-fix-context-clause 'ada-wisi-context-clause)
1845 (setq ada-goto-declaration-end 'ada-wisi-goto-declaration-end)
1846 (setq ada-goto-declaration-start 'ada-wisi-goto-declaration-start)
1847 (setq ada-goto-declarative-region-start 'ada-wisi-goto-declarative-region-start)
1848 (setq ada-goto-end 'wisi-goto-statement-end)
1849 (setq ada-goto-subunit-name 'ada-wisi-goto-subunit-name)
1850 (setq ada-in-paramlist-p 'ada-wisi-in-paramlist-p)
1851 (setq ada-indent-statement 'wisi-indent-statement)
1852 (setq ada-make-subprogram-body 'ada-wisi-make-subprogram-body)
1853 (setq ada-next-statement-keyword 'wisi-forward-statement-keyword)
1854 (setq ada-on-context-clause 'ada-wisi-on-context-clause)
1855 (setq ada-in-case-expression 'ada-wisi-in-case-expression)
1856 (setq ada-prev-statement-keyword 'wisi-backward-statement-keyword)
1857 (setq ada-reset-parser 'wisi-invalidate-cache)
1858 (setq ada-scan-paramlist 'ada-wisi-scan-paramlist)
1859 (setq ada-show-parse-error 'wisi-show-parse-error)
1860 (setq ada-which-function 'ada-wisi-which-function)
1863 (provide 'ada-indent-engine)