[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ada mode 6.2.1: ada-indent-comment-col-0 no longer honored
From: |
Stephen Leake |
Subject: |
Re: Ada mode 6.2.1: ada-indent-comment-col-0 no longer honored |
Date: |
Thu, 21 Nov 2019 11:03:57 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) |
Stephen Leake <address@hidden> writes:
> Stephen Leake <address@hidden> writes:
>
>> Patch attached.
>
> Hmm. Now a comment in column 0 after the first line is indented when it
> should not be; I'll have to work on that.
Better patch attached.
--
-- Stephe
#
# old_revision [2f537cdbfca4944de3e5977240237429f17c9039]
#
# patch "wisi.adb"
# from [ff8d8ee4bae339ff41b5a20d2da38184ffb160fa]
# to [fc6ec8ce126f36cae6861d2e523a36b442422d55]
#
============================================================
*** wisi.adb ff8d8ee4bae339ff41b5a20d2da38184ffb160fa
--- wisi.adb fc6ec8ce126f36cae6861d2e523a36b442422d55
*************** package body Wisi is
*** 2115,2124 ****
if Data.Indent_Comment_Col_0 then
declare
use all type Ada.Text_IO.Count;
! Indent : Boolean := True;
begin
! if Data.Line_Begin_Token.all (Line - 1) /=
Augmented_Token_Arrays.No_Index then
! for Tok of Data.Terminals (Data.Line_Begin_Token.all (Line
- 1)).Non_Grammar loop
if Tok.Line = Line and then
Tok.ID in Data.First_Comment_ID ..
Data.Last_Comment_ID and then
Tok.Column = 0
--- 2115,2158 ----
if Data.Indent_Comment_Col_0 then
declare
use all type Ada.Text_IO.Count;
!
! function Containing_Token return Base_Token_Index
! is
! -- Return token index of terminal containing non_grammer
on Line;
! -- Invalid_Token_Index if none.
! I : Line_Number_Type := Line;
! J : Base_Token_Index;
! begin
! if Line < Data.Line_Begin_Token.First_Index then
! -- Line is before first grammar token;
Leading_Non_Grammar checked
! -- below.
! return Invalid_Token_Index;
! end if;
!
! loop
! exit when Data.Line_Begin_Token.all (I) /=
Augmented_Token_Arrays.No_Index;
! -- No_Index means Line is in a multi-line token, which
could be a block comment.
! I := I - 1;
! end loop;
!
! J := Data.Line_Begin_Token.all (I);
! if Line in Data.Terminals (J).First_Trailing_Comment_Line ..
! Data.Terminals (J).Last_Trailing_Comment_Line
! then
! return J;
! else
! return Invalid_Token_Index;
! end if;
! end Containing_Token;
!
! Indent : Boolean := True;
! Containing : constant Base_Token_Index := Containing_Token;
begin
! if Line < Data.Line_Begin_Token.First_Index then
! -- Line is before the first grammar token. We may be doing
a partial
! -- parse where the initial indent is non-zero, so we still
have to
! -- check for column 0.
! for Tok of Data.Leading_Non_Grammar loop
if Tok.Line = Line and then
Tok.ID in Data.First_Comment_ID ..
Data.Last_Comment_ID and then
Tok.Column = 0
*************** package body Wisi is
*** 2127,2132 ****
--- 2161,2177 ----
exit;
end if;
end loop;
+
+ elsif Containing /= Invalid_Token_Index then
+ for Tok of Data.Terminals (Containing).Non_Grammar loop
+ if Tok.Line = Line and then
+ Tok.ID in Data.First_Comment_ID ..
Data.Last_Comment_ID and then
+ Tok.Column = 0
+ then
+ Indent := False;
+ exit;
+ end if;
+ end loop;
end if;
if Indent then