Skip to content

Commit b619fc8

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents 1de377d + 6c20227 commit b619fc8

File tree

6 files changed

+98
-30
lines changed

6 files changed

+98
-30
lines changed

source/gnatdoc-comments-extractor-code_snippets.adb

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,21 +343,27 @@ package body GNATdoc.Comments.Extractor.Code_Snippets is
343343
.Token_End;
344344

345345
else
346-
raise Program_Error;
346+
-- Any other expressions, including string literals.
347+
348+
Is_Array := False;
347349
end if;
348350

349-
First_Line := Sloc_Range (Data (First_Token)).Start_Line;
350-
First_Column := Sloc_Range (Data (First_Token)).Start_Column;
351-
Last_Line := Sloc_Range (Data (Last_Token)).End_Line;
351+
if Is_Array then
352+
First_Line :=
353+
Sloc_Range (Data (First_Token)).Start_Line;
354+
First_Column :=
355+
Sloc_Range (Data (First_Token)).Start_Column;
356+
Last_Line := Sloc_Range (Data (Last_Token)).End_Line;
352357

353-
if Last_Line - First_Line >= 4 then
354-
for J in First_Line + 2 .. Last_Line - 2 loop
355-
Text.Delete (Positive (First_Line - Offset + 2));
356-
end loop;
358+
if Last_Line - First_Line >= 4 then
359+
for J in First_Line + 2 .. Last_Line - 2 loop
360+
Text.Delete (Positive (First_Line - Offset + 2));
361+
end loop;
357362

358-
Text.Replace
359-
(Positive (First_Line - Offset + 2),
360-
Character_Count (First_Column) * ' ' & "");
363+
Text.Replace
364+
(Positive (First_Line - Offset + 2),
365+
Character_Count (First_Column) * ' ' & "");
366+
end if;
361367
end if;
362368
end;
363369
end if;

source/gnatdoc-comments-extractor-trailing.adb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,10 @@ package body GNATdoc.Comments.Extractor.Trailing is
759759
null;
760760

761761
elsif Last_Line + 1 = Location.End_Line then
762-
if Infos (Location.End_Line).Item.Kind /= None then
762+
if Location.End_Line in Infos'Range
763+
and then Infos (Location.End_Line).Item.Kind
764+
/= None
765+
then
763766
Apply;
764767
end if;
765768

testsuite/extractor/objects/arrays.ads

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ package PA is
3535
5];
3636
-- Constant: Code snippet contains few items of initialization expression.
3737

38+
S : constant String := "`String` type is an array too";
39+
-- `String` type is an array, and initialization expression can be a string
40+
-- literal.
41+
3842
end PA;

testsuite/extractor/objects/test.out

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<CompilationUnit arrays.ads:1:1-38:8>
1+
<CompilationUnit arrays.ads:1:1-42:8>
22
<AdaNodeList arrays.ads:1:1-1:17>
33
<PragmaNode arrays.ads:1:1-1:17>
44
<Id "Ada_2022" arrays.ads:1:8-1:16>
55
<BaseAssocList arrays.ads:1:16-1:16>
6-
<LibraryItem arrays.ads:3:1-38:8>
6+
<LibraryItem arrays.ads:3:1-42:8>
77
<PrivateAbsent arrays.ads:1:17-1:17>
8-
<PackageDecl ["PA"] arrays.ads:3:1-38:8>
8+
<PackageDecl ["PA"] arrays.ads:3:1-42:8>
99
**************************
1010
\/ RAW <<HEADER>> ()
1111
\/ RAW <<LEADING>> ()
@@ -16,8 +16,8 @@ package PA
1616
**************************
1717
<DefiningName "PA" arrays.ads:3:9-3:11>
1818
<Id "PA" arrays.ads:3:9-3:11>
19-
<PublicPart arrays.ads:3:14-38:1>
20-
<AdaNodeList arrays.ads:5:4-35:10>
19+
<PublicPart arrays.ads:3:14-42:1>
20+
<AdaNodeList arrays.ads:5:4-38:59>
2121
<ObjectDecl ["A"] arrays.ads:5:4-5:53>
2222
**************************
2323
\/ RAW <<LEADING>> ()
@@ -100,6 +100,18 @@ ID : constant Integer_Array (1 .. 5) :=
100100
\/ DESCRIPTION ()
101101
Constant: Code snippet contains few items of initialization expression.
102102
**************************
103-
<EndName arrays.ads:38:5-38:7>
104-
<Id "PA" arrays.ads:38:5-38:7>
105-
<PragmaNodeList arrays.ads:38:8-38:8>
103+
<ObjectDecl ["S"] arrays.ads:38:4-38:59>
104+
**************************
105+
\/ RAW <<LEADING>> ()
106+
\/ RAW <<TRAILING>> ()
107+
`String` type is an array, and initialization expression can be a string
108+
literal.
109+
\/ SNIPPET ada ()
110+
S : constant String := "`String` type is an array too";
111+
\/ DESCRIPTION ()
112+
`String` type is an array, and initialization expression can be a string
113+
literal.
114+
**************************
115+
<EndName arrays.ads:42:5-42:7>
116+
<Id "PA" arrays.ads:42:5-42:7>
117+
<PragmaNodeList arrays.ads:42:8-42:8>

testsuite/extractor/subprograms_gnat/subprograms_gnat.ads

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,21 @@ package Subprograms_GNAT is
278278
-- Externals the project has no need to be analyzed again, in this case
279279
-- the Default_Signature is returned.
280280

281+
----------------
282+
-- GNATdoc#90 --
283+
----------------
284+
285+
procedure Report_Preference_File_Error
286+
(Handle : access Kernel_Handle_Record;
287+
Filename : Virtual_File;
288+
Is_Saving : Boolean := True);
289+
-- Print out an error message in messages window, or display a dialog
290+
-- if GNAT Studio is exiting. Is_Saving controls whether we try to save
291+
-- or load the file.
292+
--
293+
-- Subprogram's description use incorrect alignment for description of the
294+
-- subprogram.
295+
281296
private
282297

283298
-- This is description of the package at the beginning of the private

testsuite/extractor/subprograms_gnat/test.out

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<CompilationUnit subprograms_gnat.ads:5:1-286:22>
1+
<CompilationUnit subprograms_gnat.ads:5:1-301:22>
22
<AdaNodeList subprograms_gnat.ads:5:1-5:17>
33
<WithClause subprograms_gnat.ads:5:1-5:17>
44
<LimitedAbsent subprograms_gnat.ads:5:1-5:1>
55
<PrivateAbsent subprograms_gnat.ads:5:1-5:1>
66
<NameList subprograms_gnat.ads:5:6-5:16>
77
<Id "Interfaces" subprograms_gnat.ads:5:6-5:16>
8-
<LibraryItem subprograms_gnat.ads:7:1-286:22>
8+
<LibraryItem subprograms_gnat.ads:7:1-301:22>
99
<PrivateAbsent subprograms_gnat.ads:5:17-5:17>
10-
<PackageDecl ["Subprograms_GNAT"] subprograms_gnat.ads:7:1-286:22>
10+
<PackageDecl ["Subprograms_GNAT"] subprograms_gnat.ads:7:1-301:22>
1111
**************************
1212
\/ RAW <<HEADER>> ()
1313
\/ RAW <<LEADING>> ()
@@ -21,8 +21,8 @@ This is description of the package at the top of the specification.
2121
**************************
2222
<DefiningName "Subprograms_GNAT" subprograms_gnat.ads:7:9-7:25>
2323
<Id "Subprograms_GNAT" subprograms_gnat.ads:7:9-7:25>
24-
<PublicPart subprograms_gnat.ads:7:28-281:1>
25-
<AdaNodeList subprograms_gnat.ads:9:4-274:53>
24+
<PublicPart subprograms_gnat.ads:7:28-296:1>
25+
<AdaNodeList subprograms_gnat.ads:9:4-288:36>
2626
<PragmaNode subprograms_gnat.ads:9:4-9:24>
2727
<Id "Preelaborate" subprograms_gnat.ads:9:11-9:23>
2828
<BaseAssocList subprograms_gnat.ads:9:23-9:23>
@@ -592,11 +592,39 @@ if so the project is to be analyzed again. Note that if there is no
592592
Externals the project has no need to be analyzed again, in this case
593593
the Default_Signature is returned.
594594
**************************
595-
<PrivatePart subprograms_gnat.ads:281:8-286:1>
596-
<AdaNodeList subprograms_gnat.ads:281:8-281:8>
597-
<EndName subprograms_gnat.ads:286:5-286:21>
598-
<Id "Subprograms_GNAT" subprograms_gnat.ads:286:5-286:21>
599-
<PragmaNodeList subprograms_gnat.ads:286:22-286:22>
595+
<SubpDecl ["Report_Preference_File_Error"] subprograms_gnat.ads:285:4-288:36>
596+
**************************
597+
\/ RAW <<CALLABLE>> ()
598+
599+
Subprogram's description use incorrect alignment for description of the
600+
subprogram.
601+
\/ PARAMETER handle (Handle)
602+
Print out an error message in messages window, or display a dialog
603+
if GNAT Studio is exiting. Is_Saving controls whether we try to save
604+
or load the file.
605+
\/ PARAMETER filename (Filename)
606+
Print out an error message in messages window, or display a dialog
607+
if GNAT Studio is exiting. Is_Saving controls whether we try to save
608+
or load the file.
609+
\/ PARAMETER is_saving (Is_Saving)
610+
Print out an error message in messages window, or display a dialog
611+
if GNAT Studio is exiting. Is_Saving controls whether we try to save
612+
or load the file.
613+
\/ SNIPPET ada ()
614+
procedure Report_Preference_File_Error
615+
(Handle : access Kernel_Handle_Record;
616+
Filename : Virtual_File;
617+
Is_Saving : Boolean := True)
618+
\/ DESCRIPTION ()
619+
620+
Subprogram's description use incorrect alignment for description of the
621+
subprogram.
622+
**************************
623+
<PrivatePart subprograms_gnat.ads:296:8-301:1>
624+
<AdaNodeList subprograms_gnat.ads:296:8-296:8>
625+
<EndName subprograms_gnat.ads:301:5-301:21>
626+
<Id "Subprograms_GNAT" subprograms_gnat.ads:301:5-301:21>
627+
<PragmaNodeList subprograms_gnat.ads:301:22-301:22>
600628
<CompilationUnit monitor_loop.ads:7:1-7:45>
601629
<AdaNodeList monitor_loop.ads:7:1-7:1>
602630
<LibraryItem monitor_loop.ads:7:1-7:45>

0 commit comments

Comments
 (0)