Skip to content

Commit

Permalink
Merge branch 'topic/VC08-011' into 'master'
Browse files Browse the repository at this point in the history
Add multiple functionalities to gnatrefactor array_aggregates

Closes #16

See merge request eng/ide/libadalang-tools!40
  • Loading branch information
joaopsazevedo committed Feb 7, 2023
2 parents 9aa711d + 727c6e6 commit b0ff915
Show file tree
Hide file tree
Showing 42 changed files with 1,742 additions and 532 deletions.
32 changes: 32 additions & 0 deletions src/lint/lint-command_line.ads
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
with Ada.Strings.Unbounded;

with GNATCOLL.Opt_Parse; use GNATCOLL.Opt_Parse;
with GNATCOLL.VFS;

with Lint.Tools;

Expand Down Expand Up @@ -69,4 +70,35 @@ package Lint.Command_Line is
Convert => Ada.Strings.Unbounded.To_Unbounded_String,
Default_Val => Ada.Strings.Unbounded.Null_Unbounded_String);

package Sources is new Parse_Option_List
(Parser => Parser,
Short => "-S",
Long => "--sources",
Help => "Source files to refactor",
Arg_Type => Ada.Strings.Unbounded.Unbounded_String,
Convert => Ada.Strings.Unbounded.To_Unbounded_String);

package Scenario_Variables is new Parse_Option_List
(Parser => Parser,
Short => "-X",
Help => "Specify an external reference for Project Files",
Arg_Type => Ada.Strings.Unbounded.Unbounded_String,
Convert => Ada.Strings.Unbounded.To_Unbounded_String,
Name => "nm=val");

function To_Virtual_File
(File_Name : String)
return GNATCOLL.VFS.Virtual_File
is (GNATCOLL.VFS.Create (GNATCOLL.VFS."+" (File_Name)));

package From_GNAT_Warnings is new Parse_Option
(Parser => Parser,
Short => "-fgw",
Long => "--from-gnat-warnings",
Help => "File with all obsolescent syntax GNAT warnings",
Arg_Type => GNATCOLL.VFS.Virtual_File,
Convert => To_Virtual_File,
Default_Val => GNATCOLL.VFS.No_File,
Name => "<file_with_gnat_warnings>");

end Lint.Command_Line;
22 changes: 11 additions & 11 deletions src/lint/lint-file_edits.adb
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,6 @@ package body Lint.File_Edits is
Current_Column_Number :=
Column_Number (C_It.Character_Index);
if Current_Text_Edit /= No_Text_Edit then
if Current_Line_Number =
Current_Text_Edit.Location.Start_Line
and then Current_Column_Number =
Current_Text_Edit.Location.Start_Column
then
Output_Buffer.Append
(To_Virtual_String
(To_String (Current_Text_Edit.Text)));
Inside_Text_Edit := True;
end if;

if Current_Line_Number =
Current_Text_Edit.Location.End_Line
and then Current_Column_Number =
Expand All @@ -222,6 +211,17 @@ package body Lint.File_Edits is
end if;
Inside_Text_Edit := False;
end if;

if Current_Line_Number =
Current_Text_Edit.Location.Start_Line
and then Current_Column_Number =
Current_Text_Edit.Location.Start_Column
then
Output_Buffer.Append
(To_Virtual_String
(To_String (Current_Text_Edit.Text)));
Inside_Text_Edit := True;
end if;
end if;

if not Inside_Text_Edit then
Expand Down
Loading

0 comments on commit b0ff915

Please sign in to comment.