Skip to content

Commit bef385e

Browse files
committed
Merge branch 'po/ada2022' into 'master'
po/ada2022 See merge request eng/toolchain/templates-parser!8
2 parents 5031898 + 38ccfe2 commit bef385e

15 files changed

+494
-497
lines changed

src/templates_parser-cached_files.adb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Templates Parser --
33
-- --
4-
-- Copyright (C) 1999-2012, AdaCore --
4+
-- Copyright (C) 1999-2024, AdaCore --
55
-- --
66
-- This library is free software; you can redistribute it and/or modify --
77
-- it under terms of the GNU General Public License as published by the --
@@ -27,6 +27,8 @@
2727
-- covered by the GNU Public License. --
2828
------------------------------------------------------------------------------
2929

30+
pragma Ada_2022;
31+
3032
separate (Templates_Parser)
3133

3234
package body Cached_Files is
@@ -63,7 +65,7 @@ package body Cached_Files is
6365
procedure Add
6466
(Filename : String;
6567
T : Tree;
66-
Old : out Tree)
68+
Old : out Tree)
6769
is
6870
L_Filename : constant Unbounded_String := To_Unbounded_String (Filename);
6971

@@ -128,7 +130,7 @@ package body Cached_Files is
128130
-- Tree is used, mark it as obsoleted, it will be removed
129131
-- when no more used by the Release call.
130132
Old.Obsolete := True;
131-
Old.Used := Old.Used + 1;
133+
Old.Used := @ + 1;
132134

133135
-- But current tree is not used, it has been posted here
134136
-- for futur use. But if replaced right away it should be
@@ -152,7 +154,7 @@ package body Cached_Files is
152154

153155
Files (S + 1 .. Index + 1) := Files (S .. Index);
154156

155-
Index := Index + 1;
157+
Index := @ + 1;
156158

157159
Files (S) := T;
158160

@@ -255,6 +257,7 @@ package body Cached_Files is
255257
pragma Assert (T.Info.Next /= T.C_Info);
256258
Release (T.C_Info, Include => False);
257259
end if;
260+
258261
Templates_Parser_Tasking.Unlock;
259262
exception
260263
when others =>
@@ -319,6 +322,7 @@ package body Cached_Files is
319322
if not Result then
320323
return False;
321324
end if;
325+
322326
P := P.Next;
323327
end loop;
324328

src/templates_parser-data.adb

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Templates Parser --
33
-- --
4-
-- Copyright (C) 1999-2019, AdaCore --
4+
-- Copyright (C) 1999-2024, AdaCore --
55
-- --
66
-- This library is free software; you can redistribute it and/or modify --
77
-- it under terms of the GNU General Public License as published by the --
@@ -27,7 +27,7 @@
2727
-- covered by the GNU Public License. --
2828
------------------------------------------------------------------------------
2929

30-
pragma Ada_2012;
30+
pragma Ada_2022;
3131

3232
with Ada.Text_IO;
3333

@@ -191,12 +191,13 @@ package body Data is
191191
if Pos > Str'First and then Str (Pos - 1) /= '\' then
192192
-- This is not a quoted character
193193
if Str (Pos) = ')' then
194-
Count := Count - 1;
194+
Count := @ - 1;
195195
elsif Str (Pos) = '(' then
196-
Count := Count + 1;
196+
Count := @ + 1;
197197
end if;
198198
end if;
199-
Pos := Pos - 1;
199+
200+
Pos := @ - 1;
200201
end loop;
201202

202203
if Pos = Str'First then
@@ -274,14 +275,14 @@ package body Data is
274275
loop
275276
exit when K > Str'Last;
276277

277-
I := I + 1;
278+
I := @ + 1;
278279

279280
if Str (K) = '\'
280281
and then K < Str'Last
281282
and then not (Str (K + 1) in '0' .. '9')
282283
then
283284
-- An escaped character, skip the backslash
284-
K := K + 1;
285+
K := @ + 1;
285286

286287
-- Handle some special escaped characters \n \r \t
287288

@@ -296,7 +297,7 @@ package body Data is
296297
S (I) := Str (K);
297298
end if;
298299

299-
K := K + 1;
300+
K := @ + 1;
300301
end loop;
301302

302303
return S (S'First .. I);
@@ -445,9 +446,9 @@ package body Data is
445446
raise Template_Error with "NO_DYNAMIC must be the first filter";
446447
end if;
447448

448-
K := K + 1;
449+
K := @ + 1;
449450

450-
Stop := Stop - 1;
451+
Stop := @ - 1;
451452
end loop;
452453

453454
return new Filter.Set'(FS (FS'First .. K - 1));
@@ -474,6 +475,7 @@ package body Data is
474475
-- ??? check for string literal
475476
exit when Tag (Stop + 1) = '(' or else Stop = Tag'First;
476477
end loop;
478+
477479
MP_Start := Stop + 1;
478480
end if;
479481

@@ -647,11 +649,11 @@ package body Data is
647649

648650
for K in R.Parameters'Range loop
649651
if R.Parameters (K) /= null then
650-
R.Parameters (K) := Data.Clone (R.Parameters (K));
652+
R.Parameters (K) := Data.Clone (@);
651653
end if;
652654
end loop;
653655

654-
R.Def := Clone (R.Def);
656+
R.Def := Clone (@);
655657
end if;
656658

657659
return R;
@@ -666,15 +668,16 @@ package body Data is
666668

667669
loop
668670
if N.Kind = Data.Var then
669-
N.Var := Data.Clone (N.Var);
671+
N.Var := Data.Clone (@);
670672
end if;
671673

672674
exit when N.Next = null;
673675

674-
N.Next := new Node'(N.Next.all);
676+
N.Next := new Node'(@.all);
675677
N := N.Next;
676678
end loop;
677679
end if;
680+
678681
return Root;
679682
end Clone;
680683

@@ -870,6 +873,7 @@ package body Data is
870873
else
871874
Text_IO.Put (Value);
872875
end if;
876+
873877
if Value'Length > 0 then
874878
NL := Value (Value'Last) = ASCII.LF;
875879
else
@@ -927,7 +931,7 @@ package body Data is
927931
begin
928932
while T /= null loop
929933
P := T;
930-
T := T.Next;
934+
T := @.Next;
931935

932936
case P.Kind is
933937
when Var => Release (P.Var);
@@ -953,6 +957,7 @@ package body Data is
953957
for K in P'Range loop
954958
P (K) := Data.Parse (To_String (Parameters (K)), 0);
955959
end loop;
960+
956961
return P;
957962
end To_Data_Parameters;
958963

src/templates_parser-debug.adb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ package body Templates_Parser.Debug is
6565
else
6666
Print (N.VS.all, K + 1);
6767
end if;
68+
6869
N := N.Next;
6970
end loop;
7071

src/templates_parser-expr.adb

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Templates Parser --
33
-- --
4-
-- Copyright (C) 1999-2019, AdaCore --
4+
-- Copyright (C) 1999-2024, AdaCore --
55
-- --
66
-- This library is free software; you can redistribute it and/or modify --
77
-- it under terms of the GNU General Public License as published by the --
@@ -27,7 +27,7 @@
2727
-- covered by the GNU Public License. --
2828
------------------------------------------------------------------------------
2929

30-
pragma Ada_2012;
30+
pragma Ada_2022;
3131

3232
with Ada.Text_IO;
3333

@@ -312,7 +312,7 @@ package body Expr is
312312
end F_Xor;
313313

314314
Op_Table : constant array (Expr.Ops) of Ops_Fct :=
315-
(Expr.O_And => F_And'Access,
315+
[Expr.O_And => F_And'Access,
316316
Expr.O_Or => F_Or'Access,
317317
Expr.O_Xor => F_Xor'Access,
318318
Expr.O_Sup => F_Sup'Access,
@@ -322,10 +322,10 @@ package body Expr is
322322
Expr.O_Equal => F_Equ'Access,
323323
Expr.O_Diff => F_Diff'Access,
324324
Expr.O_In => F_In'Access,
325-
Expr.O_Cat => F_Cat'Access);
325+
Expr.O_Cat => F_Cat'Access];
326326

327327
U_Op_Table : constant array (Expr.U_Ops) of U_Ops_Fct :=
328-
(Expr.O_Not => F_Not'Access);
328+
[Expr.O_Not => F_Not'Access];
329329

330330
begin
331331
case E.Kind is
@@ -511,28 +511,28 @@ package body Expr is
511511
-- Check symbolic operators
512512
elsif Expression (Index) = '(' then
513513
Current_Token := (Kind => Open_Par);
514-
Index := Index + 1;
514+
Index := @ + 1;
515515

516516
elsif Expression (Index) = ')' then
517517
Current_Token := (Kind => Close_Par);
518-
Index := Index + 1;
518+
Index := @ + 1;
519519

520520
elsif Expression (Index) = '=' then
521521
Current_Token := (Kind => Binary_Op, Bin_Op => O_Equal);
522-
Index := Index + 1;
522+
Index := @ + 1;
523523

524524
elsif Expression (Index) = '/'
525525
and then Index < Expression'Last
526526
and then Expression (Index + 1) = '='
527527
then
528528
Current_Token := (Kind => Binary_Op, Bin_Op => O_Diff);
529-
Index := Index + 2;
529+
Index := @ + 2;
530530

531531
elsif Expression (Index) = '<' then
532532
Index := Index + 1;
533533
if Expression (Index) = '=' then
534534
Current_Token := (Kind => Binary_Op, Bin_Op => O_Einf);
535-
Index := Index + 1;
535+
Index := @ + 1;
536536
else
537537
Current_Token := (Kind => Binary_Op, Bin_Op => O_Inf);
538538
end if;
@@ -541,15 +541,15 @@ package body Expr is
541541
Index := Index + 1;
542542
if Expression (Index) = '=' then
543543
Current_Token := (Kind => Binary_Op, Bin_Op => O_Esup);
544-
Index := Index + 1;
544+
Index := @ + 1;
545545
else
546546
Current_Token := (Kind => Binary_Op, Bin_Op => O_Sup);
547547
end if;
548548

549549
elsif Expression (Index) = '"' then
550550
-- This is a string, return it
551-
Current_Token
552-
:= (Kind => Value, Start => Index + 1, Stop => Index);
551+
Current_Token :=
552+
(Kind => Value, Start => Index + 1, Stop => Index);
553553

554554
loop
555555
if Current_Token.Stop = Expression'Last then
@@ -560,6 +560,7 @@ package body Expr is
560560
Current_Token.Stop := Current_Token.Stop + 1;
561561
end if;
562562
end loop;
563+
563564
Index := Current_Token.Stop + 2;
564565

565566
else
@@ -584,7 +585,7 @@ package body Expr is
584585
exit when Expression (Index) /= '/'
585586
or else Expression (Index + 1) = '=';
586587

587-
Index := Index + 1;
588+
Index := @ + 1;
588589
end loop;
589590

590591
declare
@@ -634,13 +635,13 @@ package body Expr is
634635
Error ("variable end not found");
635636

636637
else
637-
Current_Token
638-
:= (Kind => Var, Start => I, Stop => Index - 1);
638+
Current_Token :=
639+
(Kind => Var, Start => I, Stop => Index - 1);
639640
end if;
640641

641642
else
642-
Current_Token
643-
:= (Kind => Value, Start => I, Stop => Index - 1);
643+
Current_Token :=
644+
(Kind => Value, Start => I, Stop => Index - 1);
644645
end if;
645646
end;
646647
end if;
@@ -685,6 +686,7 @@ package body Expr is
685686
end case;
686687

687688
Next_Token;
689+
688690
if Current_Token.Kind = Binary_Op
689691
and then Current_Token.Bin_Op = O_Cat
690692
then
@@ -704,6 +706,7 @@ package body Expr is
704706
when Open_Par =>
705707
Next_Token;
706708
Result := Expr;
709+
707710
if Current_Token.Kind = Close_Par then
708711
Next_Token;
709712
return Result;

0 commit comments

Comments
 (0)