-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Formatting gives different results, depending on the formatting tool used (gnatpp, gnatstudio, ada-ts-mode), particularly for subwords.
Using ALS 25.0.20241014 on aarch64 macOS Sequoia 15.0.1.
Source code in formatting_control.zip.
I have this project demo.gpr
project demo is
package pretty_printer is
for default_switches ("ada") use
("--name-mixed-case",
"--dictionary=case_exceptions.txt");
end pretty_printer;
end demo;
with this case exception dictionary case_exceptions.txt
HTTP
ID
and this Ada source demo.adb
with ada.text_io;
with gnat.io;
with ada.containers.vectors;
procedure demo is
package vectors is new ada.containers.vectors
(index_type => natural, element_type => positive);
package http renames vectors;
subtype http_id is http.vector;
subtype id is positive;
begin
gnat.io.put_line ("test");
end demo;
With gnatpp 24.0.0, the formatted output is
$ gnatpp -Pdemo --pipe demo.adb
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package HTTP renames Vectors;
subtype Http_Id is HTTP.Vector;
subtype ID is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
where we see that http
and id
have been upcased, but http_id
has merely been title-cased, whereas we’d have expected them to have been upcased too, as subwords.
With GNATStudio 25, as provided at Sourceforge by Blady, we get
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package Http renames Vectors;
subtype Http_Id is Http.Vector;
subtype Id is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
and neither http
nor id
has been upcased.
The same happens with ada-ts-mode
, which is ALS-based.
If I alter case_exceptions.txt
to what I believe to be an older way of specifying subwords
*HTTP*
*ID*
then gnatpp -Pdemo --pipe demo.adb
gives
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package HTTP renames Vectors;
subtype HTTP_ID is HTTP.Vector;
subtype ID is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
(http
and id
are upcased everywhere! Great!)
GNATStudio gives
with Ada.Text_Io;
with Gnat.Io;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package Http renames Vectors;
subtype Http_Id is Http.Vector;
subtype Id is Positive;
begin
Gnat.Io.Put_Line ("test");
end Demo;
(gnat
, http
, id
, and io
are title-cased).
ada-ts-mode
gives
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package Http renames Vectors;
subtype Http_Id is Http.Vector;
subtype Id is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
(at least gnat
and io
are upcased).