Skip to content

Commit c2d389d

Browse files
committed
Minor code clean-up and reformatting.
1 parent ce2f694 commit c2d389d

11 files changed

+76
-40
lines changed

src/templates_parser-cached_files.adb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ package body Cached_Files is
6363
procedure Add
6464
(Filename : String;
6565
T : Tree;
66-
Old : out Tree)
66+
Old : out Tree)
6767
is
6868
L_Filename : constant Unbounded_String := To_Unbounded_String (Filename);
6969

@@ -255,6 +255,7 @@ package body Cached_Files is
255255
pragma Assert (T.Info.Next /= T.C_Info);
256256
Release (T.C_Info, Include => False);
257257
end if;
258+
258259
Templates_Parser_Tasking.Unlock;
259260
exception
260261
when others =>
@@ -319,6 +320,7 @@ package body Cached_Files is
319320
if not Result then
320321
return False;
321322
end if;
323+
322324
P := P.Next;
323325
end loop;
324326

src/templates_parser-data.adb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ package body Data is
473473
-- ??? check for string literal
474474
exit when Tag (Stop + 1) = '(' or else Stop = Tag'First;
475475
end loop;
476+
476477
MP_Start := Stop + 1;
477478
end if;
478479

@@ -870,6 +871,7 @@ package body Data is
870871
else
871872
Text_IO.Put (Value);
872873
end if;
874+
873875
if Value'Length > 0 then
874876
NL := Value (Value'Last) = ASCII.LF;
875877
else
@@ -953,6 +955,7 @@ package body Data is
953955
for K in P'Range loop
954956
P (K) := Data.Parse (To_String (Parameters (K)), 0);
955957
end loop;
958+
956959
return P;
957960
end To_Data_Parameters;
958961

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: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ package body Expr is
546546

547547
elsif Expression (Index) = '"' then
548548
-- This is a string, return it
549-
Current_Token
550-
:= (Kind => Value, Start => Index + 1, Stop => Index);
549+
Current_Token :=
550+
(Kind => Value, Start => Index + 1, Stop => Index);
551551

552552
loop
553553
if Current_Token.Stop = Expression'Last then
@@ -558,6 +558,7 @@ package body Expr is
558558
Current_Token.Stop := Current_Token.Stop + 1;
559559
end if;
560560
end loop;
561+
561562
Index := Current_Token.Stop + 2;
562563

563564
else
@@ -632,13 +633,13 @@ package body Expr is
632633
Error ("variable end not found");
633634

634635
else
635-
Current_Token
636-
:= (Kind => Var, Start => I, Stop => Index - 1);
636+
Current_Token :=
637+
(Kind => Var, Start => I, Stop => Index - 1);
637638
end if;
638639

639640
else
640-
Current_Token
641-
:= (Kind => Value, Start => I, Stop => Index - 1);
641+
Current_Token :=
642+
(Kind => Value, Start => I, Stop => Index - 1);
642643
end if;
643644
end;
644645
end if;
@@ -683,6 +684,7 @@ package body Expr is
683684
end case;
684685

685686
Next_Token;
687+
686688
if Current_Token.Kind = Binary_Op
687689
and then Current_Token.Bin_Op = O_Cat
688690
then
@@ -702,6 +704,7 @@ package body Expr is
702704
when Open_Par =>
703705
Next_Token;
704706
Result := Expr;
707+
705708
if Current_Token.Kind = Close_Par then
706709
Next_Token;
707710
return Result;

src/templates_parser-filter.adb

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,13 @@ package body Filter is
473473
Upper := False;
474474
else
475475
Result (K) := Characters.Handling.To_Lower (S (K));
476+
476477
if Result (K) = ' ' or else Result (K) = '_' then
477478
Upper := True;
478479
end if;
479480
end if;
480481
end loop;
482+
481483
return Result;
482484
end Capitalize;
483485

@@ -528,6 +530,7 @@ package body Filter is
528530
Result (K) := ' ';
529531
end if;
530532
end loop;
533+
531534
return Result;
532535
end Clean_Text;
533536

@@ -573,9 +576,7 @@ package body Filter is
573576
Check_Null_Parameter (P);
574577

575578
for K in S'Range loop
576-
577579
if S (K) = ' ' then
578-
579580
if Space = False then
580581
Space := True;
581582

@@ -641,14 +642,13 @@ package body Filter is
641642

642643
else
643644
declare
644-
Pos : constant Natural := Strings.Fixed.Index (S, Param);
645+
Pos : constant Natural := Strings.Fixed.Index (S, Param);
645646
First, Last : Natural;
646647
begin
647648
if Pos < E
648649
or else
649650
(Pos + Len <= S'Last
650-
and then S (Pos + Len) /= '='
651-
and then S (Pos + Len) /= '&')
651+
and then S (Pos + Len) not in '=' | '&')
652652
then
653653
-- The parameter is not present, return original string
654654
return S;
@@ -896,8 +896,10 @@ package body Filter is
896896
U := Filter_Map.Element (C);
897897
Unchecked_Free (U.CBT);
898898
end if;
899+
899900
Filter_Map.Next (C);
900901
end loop;
902+
901903
Filter_Map.Clear (User_Filters);
902904
end Free_Filters;
903905

@@ -927,9 +929,12 @@ package body Filter is
927929

928930
else
929931
case P.Mode is
930-
when Str => return '(' & To_String (P.S) & ')';
931-
when Regexp => return '(' & To_String (P.R_Str) & ')';
932-
when Regpat => return
932+
when Str =>
933+
return '(' & To_String (P.S) & ')';
934+
when Regexp =>
935+
return '(' & To_String (P.R_Str) & ')';
936+
when Regpat =>
937+
return
933938
'(' & To_String (P.P_Str) & '/' & To_String (P.Param) & ')';
934939
when Slice =>
935940
return '(' & Utils.Image (P.First)
@@ -1145,14 +1150,15 @@ package body Filter is
11451150

11461151
if Table (K).Name.all < Name then
11471152
F := K;
1153+
11481154
if F /= Mode'Last then
11491155
F := Mode'Succ (F);
11501156
end if;
11511157

11521158
exit when Table (F).Name.all > Name;
1153-
11541159
else
11551160
L := K;
1161+
11561162
if L /= Mode'First then
11571163
L := Mode'Pred (L);
11581164
end if;
@@ -1726,6 +1732,7 @@ package body Filter is
17261732
for K in S'Range loop
17271733
Result (Result'Last - K + Result'First) := S (K);
17281734
end loop;
1735+
17291736
return Result;
17301737
end Reverse_Data;
17311738

@@ -2078,8 +2085,8 @@ package body Filter is
20782085
else
20792086
-- There is only one word on the line: cut it
20802087

2081-
Append (Result, S (First .. Last - 1) & ASCII.LF);
2082-
First := Last;
2088+
Append (Result, S (First .. Last - 1) & ASCII.LF);
2089+
First := Last;
20832090
end if;
20842091

20852092
Last_Space := Last_Space_Init;

src/templates_parser-input.ads

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ package Templates_Parser.Input is
5656

5757
procedure Get_Line
5858
(File : File_Type;
59-
Buffer : out String;
60-
Last : out Natural);
59+
Buffer : out String;
60+
Last : out Natural);
6161
-- Like Text_IO.Get_Line. Raises Text_IO.Status_Error is file is not open
6262

6363
private

src/templates_parser-macro.adb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ package body Macro is
123123
Set.Delete (Name);
124124
Release (Old);
125125
end if;
126+
126127
Set.Insert (Name, T);
127128
end Register;
128129

@@ -216,6 +217,7 @@ package body Macro is
216217
Old := C;
217218
Prev.Next := C.Next;
218219
end if;
220+
219221
Data.Release (Old, Single => True);
220222
end Delete_Node;
221223

@@ -230,6 +232,7 @@ package body Macro is
230232
New_Node : constant Data.Tree := Data.Clone (Parameters (Ref));
231233
begin
232234
New_Node.Next := C.Next;
235+
233236
if Prev = null then
234237
Data.Release (T, Single => True);
235238
T := New_Node;
@@ -393,7 +396,6 @@ package body Macro is
393396
case Parameters (Ref).Kind is
394397
when Data.Text =>
395398
-- We need to evaluate the value against the filters
396-
397399
Replace
398400
(T,
399401
Data.Translate

src/templates_parser-simplifier.adb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ package body Simplifier is
4949
while N.Next /= null loop
5050
N := N.Next;
5151
end loop;
52+
5253
N.Next := To;
5354
Link := N;
5455
end Link_End;

src/templates_parser-utils.adb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,17 @@ package body Templates_Parser.Utils is
221221
Result : Unbounded_String;
222222
begin
223223
Append (Result, """");
224+
224225
for K in Str'Range loop
225226
if Str (K) = '"' then
226227
Append (Result, """""");
227228
else
228229
Append (Result, Str (K));
229230
end if;
230231
end loop;
232+
231233
Append (Result, """");
234+
232235
return To_String (Result);
233236
end Quote;
234237

@@ -300,6 +303,7 @@ package body Templates_Parser.Utils is
300303
Append (Result, Str (K));
301304
end if;
302305
end loop;
306+
303307
return To_String (Result);
304308
end Clear_Quote;
305309

0 commit comments

Comments
 (0)