Commit af5d8cb0 by Daniel Mercier Committed by Pierre-Marie de Rodat

[Ada] Pretty-print attribute names using mixed case

2018-05-21  Daniel Mercier  <mercier@adacore.com>

gcc/ada/

	* pprint.adb: Use mixed case for attribute names.

From-SVN: r260470
parent e9d08fd7
2018-04-04 Daniel Mercier <mercier@adacore.com>
* pprint.adb: Use mixed case for attribute names.
2018-04-04 Hristian Kirtchev <kirtchev@adacore.com> 2018-04-04 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch6.adb (Analyze_Generic_Subprogram_Body): Rename the call to * sem_ch6.adb (Analyze_Generic_Subprogram_Body): Rename the call to
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Atree; use Atree; with Atree; use Atree;
with Csets; use Csets;
with Einfo; use Einfo; with Einfo; use Einfo;
with Namet; use Namet; with Namet; use Namet;
with Nlists; use Nlists; with Nlists; use Nlists;
...@@ -272,11 +273,35 @@ package body Pprint is ...@@ -272,11 +273,35 @@ package body Pprint is
when N_Attribute_Reference => when N_Attribute_Reference =>
if Take_Prefix then if Take_Prefix then
declare declare
function To_Mixed_Case (S : String) return String;
-- Transform given string into the corresponding one in
-- mixed case form.
function To_Mixed_Case (S : String) return String is
Ucase : Boolean := True;
Result : String (S'Range);
begin
for J in S'Range loop
if Ucase then
Result (J) := Fold_Upper (S (J));
else
Result (J) := Fold_Lower (S (J));
end if;
Ucase := (S (J) = '_');
end loop;
return Result;
end To_Mixed_Case;
Id : constant Attribute_Id := Id : constant Attribute_Id :=
Get_Attribute_Id (Attribute_Name (Expr)); Get_Attribute_Id (Attribute_Name (Expr));
-- Always use mixed case for attributes
Str : constant String := Str : constant String :=
Expr_Name (Prefix (Expr)) & "'" Expr_Name (Prefix (Expr)) & "'"
& Get_Name_String (Attribute_Name (Expr)); & To_Mixed_Case (Get_Name_String
(Attribute_Name (Expr)));
N : Node_Id; N : Node_Id;
Ranges : List_Id; Ranges : List_Id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment