diff --git a/src/gnatcoll-arg_lists.adb b/src/gnatcoll-arg_lists.adb index 8b2ff47e..b44847ec 100644 --- a/src/gnatcoll-arg_lists.adb +++ b/src/gnatcoll-arg_lists.adb @@ -537,11 +537,7 @@ package body GNATCOLL.Arg_Lists is if Protect_Quotes then for S in List (L)'Range loop - if List (L)(S) = '"' - or else List (L)(S) = ' ' - or else List (L) (S) = '\' - or else List (L) (S) = ''' - then + if List (L) (S) in '"' | ' ' | '\' | ''' then Length := Length + 1; end if; end loop; @@ -555,13 +551,9 @@ package body GNATCOLL.Arg_Lists is for L in List'Range loop for J in List (L)'Range loop if Protect_Quotes then - if List (L) (J) = '"' - or else List (L) (J) = ' ' - or else List (L) (J) = '\' - or else List (L) (J) = ''' - then + if List (L) (J) in '"' | ' ' | '\' | ''' then S (Index) := '\'; - Index := Index + 1; + Index := Index + 1; end if; end if; S (Index) := List (L)(J); diff --git a/src/gnatcoll-coders-base64.adb b/src/gnatcoll-coders-base64.adb index df0dbcf3..dda6bcb3 100644 --- a/src/gnatcoll-coders-base64.adb +++ b/src/gnatcoll-coders-base64.adb @@ -333,7 +333,7 @@ package body GNATCOLL.Coders.Base64 is overriding function Finished (Coder : Decoder_Type) return Boolean is begin - return Coder.Finish and not Coder.Has; + return Coder.Finish and then not Coder.Has; end Finished; ----------- diff --git a/src/gnatcoll-email-mailboxes.adb b/src/gnatcoll-email-mailboxes.adb index 631d2f4f..621c3292 100644 --- a/src/gnatcoll-email-mailboxes.adb +++ b/src/gnatcoll-email-mailboxes.adb @@ -703,7 +703,7 @@ package body GNATCOLL.Email.Mailboxes is is C : Container_Access; begin - if Parent_Cont = null or else Parent_Cont = Cont then + if Parent_Cont in null | Cont then return; end if; diff --git a/src/gnatcoll-email-parser.adb b/src/gnatcoll-email-parser.adb index 58b06426..ca61bbda 100644 --- a/src/gnatcoll-email-parser.adb +++ b/src/gnatcoll-email-parser.adb @@ -50,7 +50,7 @@ package body GNATCOLL.Email.Parser is case N (N'First) is when 'c' => - return N = "cc" or else N = "content-type"; + return N in "cc" | "content-type"; when 'd' => return N = "date"; when 'f' => @@ -58,9 +58,9 @@ package body GNATCOLL.Email.Parser is when 'i' => return N = "in-reply-to"; when 'm' => - return N = "message-id" or else N = "mime-version"; + return N in "message-id" | "mime-version"; when 'r' => - return N = "references" or else N = "reply-to"; + return N in "references" | "reply-to"; when 's' => return N = "subject"; when 't' => diff --git a/src/gnatcoll-email-utils.adb b/src/gnatcoll-email-utils.adb index 8833fa50..f3c4c831 100644 --- a/src/gnatcoll-email-utils.adb +++ b/src/gnatcoll-email-utils.adb @@ -240,7 +240,7 @@ package body GNATCOLL.Email.Utils is is Start : constant Integer := Index; begin - if S (Index) = '-' or else S (Index) = '+' then + if S (Index) in '-' | '+' then Index := Index + 1; end if; @@ -360,11 +360,9 @@ package body GNATCOLL.Email.Utils is begin -- Timezone (we might have none in badly formed dates) if Index < Date'Last then - if Date (Index) = '-' or else Date (Index) = '+' or else - Date (Index) in '0' .. '9' - then - Read_Integer (Date (Index .. Date'Last), Index, - Value => TZ_Local); + if Date (Index) in '-' | '+' | '0' .. '9' then + Read_Integer + (Date (Index .. Date'Last), Index, Value => TZ_Local); TZ := Time_Offset ((TZ_Local / 100) * 60 + TZ_Local mod 100); else @@ -380,8 +378,9 @@ package body GNATCOLL.Email.Utils is then TZ := 0; else - TZ := Named_TZ_Offset - (Named_TZ'Value (Date (Index .. Index + 2))); + TZ := + Named_TZ_Offset + (Named_TZ'Value (Date (Index .. Index + 2))); end if; end if; end if; @@ -642,10 +641,7 @@ package body GNATCOLL.Email.Utils is -- Skip spaces while From <= Str'Last - and then (Str (From) = ASCII.LF - or else Str (From) = ASCII.CR - or else Str (From) = ASCII.HT - or else Str (From) = ' ') + and then (Str (From) in ASCII.LF | ASCII.CR | ASCII.HT | ' ') loop From := From + 1; end loop; @@ -682,15 +678,11 @@ package body GNATCOLL.Email.Utils is -- ',' is the standard separator in mail messages, but ';' is -- often used by users when manually typing a list of addresses - elsif Str (From) = ',' - or else Str (From) = ';' - or else Str (From) = ASCII.LF - or else Str (From) = ASCII.CR - or else Str (From) = ASCII.HT + elsif Str (From) in ',' | ';' | ASCII.LF | ASCII.CR | ASCII.HT or else (Buffer_Has_At and then Str (From) = ' ') then -- End of current address - From := From + 1; + From := From + 1; Found := True; return; @@ -1180,12 +1172,10 @@ package body GNATCOLL.Email.Utils is Is_EOL : Boolean) return Boolean is begin - if Char = ' ' or else Char = ASCII.HT then + if Char in ' ' | ASCII.HT then return Is_EOL or else Where in Any_Header; - elsif Char = '=' - or else Char = '?' - or else Character'Pos (Char) not in 32 .. 126 + elsif Char in '=' | '?' or else Character'Pos (Char) not in 32 .. 126 then return True; @@ -1211,7 +1201,7 @@ package body GNATCOLL.Email.Utils is -- No need to quote whitespace unless at EOL - if (Str (J) = ' ' or else Str (J) = ASCII.HT) and then not EOL then + if (Str (J) in ' ' | ASCII.HT) and then not EOL then null; elsif Needs_Quoting (Str (J), Where, EOL) then @@ -1695,27 +1685,14 @@ package body GNATCOLL.Email.Utils is if Set = Charset_US_ASCII then Encoding := Encoding_7bit; - elsif Set = Charset_ISO_8859_1 - or else Set = "latin_1" or else Set = "latin-1" - or else Set = Charset_ISO_8859_2 - or else Set = "latin_2" or else Set = "latin-2" - or else Set = Charset_ISO_8859_3 - or else Set = "latin_3" or else Set = "latin-3" - or else Set = Charset_ISO_8859_4 - or else Set = "latin_4" or else Set = "latin-4" - or else Set = Charset_ISO_8859_9 - or else Set = "latin_5" or else Set = "latin-5" - or else Set = Charset_ISO_8859_10 - or else Set = "latin_6" or else Set = "latin-6" - or else Set = Charset_ISO_8859_13 - or else Set = "latin_7" or else Set = "latin-7" - or else Set = Charset_ISO_8859_14 - or else Set = "latin_8" or else Set = "latin-8" - or else Set = Charset_ISO_8859_15 - or else Set = "latin_9" or else Set = "latin-9" - or else Set = Charset_Windows_1252 - or else Set = "viscii" - or else Set = Charset_UTF_8 or else Set = "utf8" + elsif Set in Charset_ISO_8859_1 | "latin_1" | "latin-1" | + Charset_ISO_8859_2 | "latin_2" | "latin-2" | Charset_ISO_8859_3 | + "latin_3" | "latin-3" | Charset_ISO_8859_4 | "latin_4" | + "latin-4" | Charset_ISO_8859_9 | "latin_5" | "latin-5" | + Charset_ISO_8859_10 | "latin_6" | "latin-6" | Charset_ISO_8859_13 | + "latin_7" | "latin-7" | Charset_ISO_8859_14 | "latin_8" | + "latin-8" | Charset_ISO_8859_15 | "latin_9" | "latin-9" | + Charset_Windows_1252 | "viscii" | Charset_UTF_8 | "utf8" then Encoding := Encoding_QP; else diff --git a/src/gnatcoll-email.adb b/src/gnatcoll-email.adb index a3312f0d..4426dbb7 100644 --- a/src/gnatcoll-email.adb +++ b/src/gnatcoll-email.adb @@ -136,12 +136,7 @@ package body GNATCOLL.Email is L_Name : constant String := To_Lower (Name); begin - if L_Name = "from" - or else L_Name = "sender" - or else L_Name = "to" - or else L_Name = "cc" - or else L_Name = "bcc" - then + if L_Name in "from" | "sender" | "to" | "cc" | "bcc" then return Addr_Header; else return Other_Header; @@ -154,7 +149,7 @@ package body GNATCOLL.Email is function Is_Whitespace (Char : Character) return Boolean is begin - return Char = ' ' or Char = ASCII.HT; + return Char in ' ' | ASCII.HT; end Is_Whitespace; ---------------------- @@ -1297,7 +1292,7 @@ package body GNATCOLL.Email is end if; else - if MIME_Type /= "" and not Prepend then + if MIME_Type /= "" and then not Prepend then Replace_Header (Msg, H_CT); if H_CTE = Null_Header then Delete_Headers (Msg, Content_Transfer_Encoding); diff --git a/src/gnatcoll-geometry.adb b/src/gnatcoll-geometry.adb index 6ca2c245..fb43081f 100644 --- a/src/gnatcoll-geometry.adb +++ b/src/gnatcoll-geometry.adb @@ -346,11 +346,10 @@ package body GNATCOLL.Geometry is Bis2 : constant Line := Bisector (Segment'(1 => P2, 2 => P3)); Center : constant Point := Intersection (Bis1, Bis2); begin - if Center = No_Point or else Center = Infinity_Points then + if Center in No_Point | Infinity_Points then return No_Circle; else - return (Center => Center, - Radius => Distance (Center, P1)); + return (Center => Center, Radius => Distance (Center, P1)); end if; end To_Circle; diff --git a/src/gnatcoll-io-native.adb b/src/gnatcoll-io-native.adb index 798253d4..8be06f68 100644 --- a/src/gnatcoll-io-native.adb +++ b/src/gnatcoll-io-native.adb @@ -664,16 +664,13 @@ package body GNATCOLL.IO.Native is GNAT.Directory_Operations.Read (D, Item, Last); exit when Last = 0; - if Item (1 .. Last) /= "." - and then Item (1 .. Last) /= ".." + if Item (1 .. Last) not in "." | ".." and then - (not Dirs_Only - or else - GNAT.OS_Lib.Is_Directory (Name & Item (1 .. Last))) + (not Dirs_Only + or else GNAT.OS_Lib.Is_Directory (Name & Item (1 .. Last))) and then - (not Files_Only - or else - GNAT.OS_Lib.Is_Regular_File (Name & Item (1 .. Last))) + (not Files_Only + or else GNAT.OS_Lib.Is_Regular_File (Name & Item (1 .. Last))) then if Ret = null then Ret := new GNAT.Strings.String_List (1 .. 10); @@ -685,7 +682,7 @@ package body GNATCOLL.IO.Native is Ret := Tmp; end if; - N := N + 1; + N := N + 1; Ret (N) := new String'(Item (1 .. Last)); end if; end loop; diff --git a/src/gnatcoll-io-remote-unix.adb b/src/gnatcoll-io-remote-unix.adb index 5ec5f5cf..547db4f3 100644 --- a/src/gnatcoll-io-remote-unix.adb +++ b/src/gnatcoll-io-remote-unix.adb @@ -677,8 +677,7 @@ package body GNATCOLL.IO.Remote.Unix is exit when Matched (0) = No_Match; Index := Matched (1).Last + 1; - if Output (Matched (1).First .. Matched (1).Last) /= "." - and then Output (Matched (1).First .. Matched (1).Last) /= ".." + if Output (Matched (1).First .. Matched (1).Last) not in "." | ".." then Nb_Files := Nb_Files + 1; end if; @@ -696,12 +695,12 @@ package body GNATCOLL.IO.Remote.Unix is exit when Matched (0) = No_Match; Index := Matched (1).Last + 1; - if Output (Matched (1).First .. Matched (1).Last) /= "." - and then Output (Matched (1).First .. Matched (1).Last) - /= ".." + if Output (Matched (1).First .. Matched (1).Last) not in "." | + ".." then - List (File_Idx) := new String' - (Output (Matched (1).First .. Matched (1).Last)); + List (File_Idx) := + new String' + (Output (Matched (1).First .. Matched (1).Last)); File_Idx := File_Idx + 1; end if; end loop; diff --git a/src/gnatcoll-io-remote-windows.adb b/src/gnatcoll-io-remote-windows.adb index fb7a57a4..479c2111 100644 --- a/src/gnatcoll-io-remote-windows.adb +++ b/src/gnatcoll-io-remote-windows.adb @@ -276,7 +276,7 @@ package body GNATCOLL.IO.Remote.Windows is Exec.Execute_Remotely (Args, Output, Status); Free (Args); - if Status and Output /= null then + if Status and then Output /= null then S := GNATCOLL.Utils.Split (Output.all, ' '); begin @@ -760,8 +760,7 @@ package body GNATCOLL.IO.Remote.Windows is exit when Matched (0) = No_Match; Index := Matched (1).Last + 1; - if Output (Matched (1).First .. Matched (1).Last) /= "." - and then Output (Matched (1).First .. Matched (1).Last) /= ".." + if Output (Matched (1).First .. Matched (1).Last) not in "." | ".." then Nb_Files := Nb_Files + 1; end if; @@ -779,12 +778,12 @@ package body GNATCOLL.IO.Remote.Windows is exit when Matched (0) = No_Match; Index := Matched (1).Last + 1; - if Output (Matched (1).First .. Matched (1).Last) /= "." - and then Output (Matched (1).First .. Matched (1).Last) - /= ".." + if Output (Matched (1).First .. Matched (1).Last) not in "." | + ".." then - List (File_Idx) := new String' - (Output (Matched (1).First .. Matched (1).Last)); + List (File_Idx) := + new String' + (Output (Matched (1).First .. Matched (1).Last)); File_Idx := File_Idx + 1; end if; end loop; diff --git a/src/gnatcoll-io-remote.adb b/src/gnatcoll-io-remote.adb index 32f6fba6..60fa0f77 100644 --- a/src/gnatcoll-io-remote.adb +++ b/src/gnatcoll-io-remote.adb @@ -54,7 +54,7 @@ package body GNATCOLL.IO.Remote is begin -- Regexps might return file strings with a trailing CR or LF. Let's -- remove those before creating the File record. - while Path (Last) = ASCII.CR or Path (Last) = ASCII.LF loop + while Path (Last) in ASCII.CR | ASCII.LF loop Last := Last - 1; end loop; diff --git a/src/gnatcoll-memory.adb b/src/gnatcoll-memory.adb index 2bb3bad7..46b9df59 100644 --- a/src/gnatcoll-memory.adb +++ b/src/gnatcoll-memory.adb @@ -110,7 +110,7 @@ package body GNATCOLL.Memory is procedure Free (Ptr : System.Address) is begin - if Ptr /= System.Null_Address and not Memory_Check then + if Ptr /= System.Null_Address and then not Memory_Check then if Memory_Monitor then Initialize_System_Memory_Debug_Pool; @@ -287,9 +287,8 @@ package body GNATCOLL.Memory is Memory_Check := Disable_Free; - if Activate_Monitor and not Memory_Monitor then - Initialize_System_Memory_Debug_Pool - (Has_Unhandled_Memory => True); + if Activate_Monitor and then not Memory_Monitor then + Initialize_System_Memory_Debug_Pool (Has_Unhandled_Memory => True); Memory_Monitor := True; end if; diff --git a/src/gnatcoll-mmap.adb b/src/gnatcoll-mmap.adb index 278150c7..fcb0b27d 100644 --- a/src/gnatcoll-mmap.adb +++ b/src/gnatcoll-mmap.adb @@ -409,7 +409,7 @@ package body GNATCOLL.Mmap is function Is_Mutable (Region : Mapped_Region) return Boolean is begin - return Region.Mutable or Region.Write; + return Region.Mutable or else Region.Write; end Is_Mutable; ---------------- diff --git a/src/gnatcoll-opt_parse.adb b/src/gnatcoll-opt_parse.adb index d7f3fea7..a605f699 100644 --- a/src/gnatcoll-opt_parse.adb +++ b/src/gnatcoll-opt_parse.adb @@ -149,7 +149,7 @@ package body GNATCOLL.Opt_Parse is (Self : Flag_Parser) return String is begin - if Self.Long /= "" and Self.Short /= "" then + if Self.Long /= "" and then Self.Short /= "" then return "[" & To_String (Self.Long) & "|" & To_String (Self.Short) & "]"; elsif Self.Long /= "" then @@ -166,7 +166,7 @@ package body GNATCOLL.Opt_Parse is (Self : Flag_Parser) return String is begin - if Self.Long /= "" and Self.Short /= "" then + if Self.Long /= "" and then Self.Short /= "" then return To_String (Self.Long) & ", " & To_String (Self.Short); elsif Self.Long /= "" then return To_String (Self.Long); @@ -732,13 +732,12 @@ package body GNATCOLL.Opt_Parse is Result : in out Parsed_Arguments) return Parser_Return is begin - if Args (Pos) = Self.Long or else Args (Pos) = Self.Short then + if Args (Pos) in Self.Long | Self.Short then declare - Res : constant Parser_Result_Access := new Flag_Parser_Result' - (Start_Pos => Pos, - End_Pos => Pos, - Result => True); + Res : constant Parser_Result_Access := + new Flag_Parser_Result' + (Start_Pos => Pos, End_Pos => Pos, Result => True); begin Result.Ref.Get.Results (Self.Position) := Res; end; @@ -789,10 +788,10 @@ package body GNATCOLL.Opt_Parse is end Get; begin - if Long = "" and Short = "" then + if Long = "" and then Short = "" then raise Opt_Parse_Error with "A long or short flag must be provided for Parse_Flag"; - elsif Long = "" and Name = "" then + elsif Long = "" and then Name = "" then raise Opt_Parse_Error with "Either Long or Name must be provided for Parse_Flag"; elsif Enabled then @@ -854,7 +853,7 @@ package body GNATCOLL.Opt_Parse is (if Name /= "" then Name else To_Upper (+Self.Name)); begin if Usage_Text = "" then - if Long /= "" and Short /= "" then + if Long /= "" and then Short /= "" then return "[" & Long & "|" & Short & " " & Usage_Name & "]"; elsif Long /= "" then return "[" & Long & " " & Usage_Name & "]"; @@ -872,7 +871,7 @@ package body GNATCOLL.Opt_Parse is (Dummy : Option_Parser) return String is begin - if Long /= "" and Short /= "" then + if Long /= "" and then Short /= "" then return Long & ", " & Short; elsif Long /= "" then return Long; @@ -932,10 +931,10 @@ package body GNATCOLL.Opt_Parse is end Parse_Args; begin - if Long = "" and Short = "" then + if Long = "" and then Short = "" then raise Opt_Parse_Error with "A long or short flag must be provided for Parse_Option"; - elsif Long = "" and Name = "" then + elsif Long = "" and then Name = "" then raise Opt_Parse_Error with "Either Long or Name must be provided for Parse_Option"; elsif Enabled then @@ -998,10 +997,10 @@ package body GNATCOLL.Opt_Parse is renames Internal_Option.Get; begin - if Long = "" and Short = "" then + if Long = "" and then Short = "" then raise Opt_Parse_Error with "A long or short flag must be provided for Parse_Enum_Option"; - elsif Long = "" and Name = "" then + elsif Long = "" and then Name = "" then raise Opt_Parse_Error with "Either Long or Name must be provided for Parse_Enum_Option"; end if; @@ -1062,12 +1061,14 @@ package body GNATCOLL.Opt_Parse is is begin if Usage_Text = "" then - if Long /= "" and Short /= "" then - return "[" & Long & "|" & Short & " " & (+Self.Name) & - " [" & (+Self.Name) & "...]]"; + if Long /= "" and then Short /= "" then + return + "[" & Long & "|" & Short & " " & (+Self.Name) & " [" & + (+Self.Name) & "...]]"; elsif Long /= "" then - return "[" & Long & " " & (+Self.Name) & - " [" & (+Self.Name) & "...]]"; + return + "[" & Long & " " & (+Self.Name) & " [" & (+Self.Name) & + "...]]"; end if; return "[" & Short & " " & (+Self.Name) & " [" & (+Self.Name) & "...]]"; @@ -1083,7 +1084,7 @@ package body GNATCOLL.Opt_Parse is (Dummy : Option_List_Parser) return String is begin - if Long /= "" and Short /= "" then + if Long /= "" and then Short /= "" then return Long & ", " & Short; elsif Long /= "" then return Long; @@ -1163,7 +1164,7 @@ package body GNATCOLL.Opt_Parse is end; end if; - if Args (Pos) /= +Long and then Args (Pos) /= +Short then + if Args (Pos) not in +Long | +Short then return Error_Return; end if; @@ -1192,10 +1193,10 @@ package body GNATCOLL.Opt_Parse is end Parse_Args; begin - if Long = "" and Short = "" then + if Long = "" and then Short = "" then raise Opt_Parse_Error with "A long or short flag must be provided for Parse_Option_List"; - elsif Long = "" and Name = "" then + elsif Long = "" and then Name = "" then raise Opt_Parse_Error with "Either Long or Name must be provided for Parse_Option_List"; elsif Enabled then @@ -1349,7 +1350,7 @@ package body GNATCOLL.Opt_Parse is New_Pos : out Parser_Return) return XString is begin - if Args (Pos) = Long or Args (Pos) = Short then + if Args (Pos) = Long or else Args (Pos) = Short then if Pos + 1 > Args'Last then raise Opt_Parse_Error with "Incomplete option"; end if; diff --git a/src/gnatcoll-projects-krunch.adb b/src/gnatcoll-projects-krunch.adb index c9a4f0b3..e21a73af 100644 --- a/src/gnatcoll-projects-krunch.adb +++ b/src/gnatcoll-projects-krunch.adb @@ -101,18 +101,17 @@ package body GNATCOLL.Projects.Krunch is Buffer (2 .. Len - 5) := Buffer (7 .. Len); Curlen := Len - 5; if (Curlen >= 3 and then Buffer (Curlen - 2 .. Curlen) = "128") - or else (Len >= 9 and then - (Buffer (3 .. 9) = "exn_lll" - or else Buffer (3 .. 9) = "exp_lll" - or else Buffer (3 .. 9) = "img_lll" - or else Buffer (3 .. 9) = "val_lll" - or else Buffer (3 .. 9) = "wid_lll")) + or else + (Len >= 9 + and then + (Buffer (3 .. 9) in "exn_lll" | "exp_lll" | "img_lll" | "val_lll" | + "wid_lll")) or else (Curlen = 10 and then Buffer (3 .. 6) = "pack") then if Len >= 15 and then Buffer (3 .. 15) = "compare_array" then - Buffer (3 .. 4) := "ca"; + Buffer (3 .. 4) := "ca"; Buffer (5 .. Curlen - 11) := Buffer (16 .. Curlen); - Curlen := Curlen - 11; + Curlen := Curlen - 11; end if; Krlen := 9; else @@ -163,10 +162,8 @@ package body GNATCOLL.Projects.Krunch is -- of predefined units use a tilde rather than a minus as the second -- character of the file name. - elsif Len > 1 - and then Buffer (2) = '-' - and then (B1 = 'a' or else B1 = 'g' or else B1 = 'i' or else B1 = 's') - and then Len <= Maxlen + elsif Len > 1 and then Buffer (2) = '-' + and then (B1 in 'a' | 'g' | 'i' | 's') and then Len <= Maxlen then Buffer (2) := '~'; return; @@ -221,9 +218,9 @@ package body GNATCOLL.Projects.Krunch is Num_Seps := 0; for J in Startloc .. Curlen loop - if Buffer (J) = '-' or else Buffer (J) = '_' then + if Buffer (J) in '-' | '_' then Buffer (J) := ' '; - Num_Seps := Num_Seps + 1; + Num_Seps := Num_Seps + 1; end if; end loop; diff --git a/src/gnatcoll-projects.adb b/src/gnatcoll-projects.adb index 90718331..3dbb0fad 100644 --- a/src/gnatcoll-projects.adb +++ b/src/gnatcoll-projects.adb @@ -1757,8 +1757,7 @@ package body GNATCOLL.Projects is Source := Element (Curs); loop - Imports := Source.Project = Project_Type (Self) - or else Source.Project = No_Project; + Imports := Source.Project in Project_Type (Self) | No_Project; -- predefined source file if not Imports then Iter := Self.Start @@ -2487,8 +2486,8 @@ package body GNATCOLL.Projects is Lang := GPR.No_Name; NS := Tree.Env.Naming_Schemes; while NS /= null loop - if +Ext = NS.Default_Spec_Suffix.all - or else +Ext = NS.Default_Body_Suffix.all + if +Ext in NS.Default_Spec_Suffix.all | + NS.Default_Body_Suffix.all then Lang := Get_String (NS.Language.all); exit; @@ -2692,8 +2691,7 @@ package body GNATCOLL.Projects is function Has_Predefined_Prefix (S : String) return Boolean is C : constant Character := S (S'First); begin - return S (S'First + 1) = '-' - and then (C = 'a' or else C = 'g' or else C = 'i' or else C = 's'); + return S (S'First + 1) = '-' and then (C in 'a' | 'g' | 'i' | 's'); end Has_Predefined_Prefix; Unit : Name_Id; @@ -3102,8 +3100,7 @@ package body GNATCOLL.Projects is -- Special case for the naming scheme, since we need to get access to -- the default registered values for foreign languages - if Attribute = Spec_Suffix_Attribute - or else Attribute = Specification_Suffix_Attribute + if Attribute in Spec_Suffix_Attribute | Specification_Suffix_Attribute then Lang := Get_Language_From_Name (View, Index); if Lang /= null then @@ -3121,8 +3118,8 @@ package body GNATCOLL.Projects is end; end if; - elsif Attribute = Impl_Suffix_Attribute - or else Attribute = Implementation_Suffix_Attribute + elsif Attribute in Impl_Suffix_Attribute | + Implementation_Suffix_Attribute then Lang := Get_Language_From_Name (View, Index); if Lang /= null then @@ -3164,19 +3161,15 @@ package body GNATCOLL.Projects is return ""; end if; - elsif Attribute = Old_Implementation_Attribute - or else Attribute = Body_Attribute - then + elsif Attribute in Old_Implementation_Attribute | Body_Attribute then -- Index is a unit name - Unit := Units_Htable.Get - (Project.Tree_View.Units_HT, - Get_String (Index)); - if Unit /= No_Unit_Index - and then Unit.File_Names (Impl) /= null - then + Unit := + Units_Htable.Get (Project.Tree_View.Units_HT, Get_String (Index)); + if Unit /= No_Unit_Index and then Unit.File_Names (Impl) /= null then if Unit.File_Names (Impl).Index /= 0 then - return Get_String (Unit.File_Names (Impl).Display_File) - & " at" & Unit.File_Names (Impl).Index'Img; + return + Get_String (Unit.File_Names (Impl).Display_File) & " at" & + Unit.File_Names (Impl).Index'Img; else return Get_String (Unit.File_Names (Impl).Display_File); end if; @@ -3188,18 +3181,15 @@ package body GNATCOLL.Projects is null; end if; - elsif Attribute = Old_Specification_Attribute - or else Attribute = Spec_Attribute - then + elsif Attribute in Old_Specification_Attribute | Spec_Attribute then -- Index is a unit name - Unit := Units_Htable.Get - (Project.Tree_View.Units_HT, Get_String (Index)); - if Unit /= No_Unit_Index - and then Unit.File_Names (Spec) /= null - then + Unit := + Units_Htable.Get (Project.Tree_View.Units_HT, Get_String (Index)); + if Unit /= No_Unit_Index and then Unit.File_Names (Spec) /= null then if Unit.File_Names (Spec).Index /= 0 then - return Get_String (Unit.File_Names (Spec).Display_File) - & " at" & Unit.File_Names (Spec).Index'Img; + return + Get_String (Unit.File_Names (Spec).Display_File) & " at" & + Unit.File_Names (Spec).Index'Img; else return Get_String (Unit.File_Names (Spec).Display_File); end if; @@ -3265,7 +3255,7 @@ package body GNATCOLL.Projects is end if; Pkg_Id := Package_Node_Id_Of (Get_String (Lower_Pkg)); - if Pkg_Id = Empty_Package or else Pkg_Id = Unknown_Package then + if Pkg_Id in Empty_Package | Unknown_Package then -- We don't even have such a package. return False; end if; @@ -4950,7 +4940,7 @@ package body GNATCOLL.Projects is Is_Limited_With => Is_Limited_With); end if; - return Imports and Is_Limited_With; + return Imports and then Is_Limited_With; end Is_Limited_With; @@ -4978,7 +4968,7 @@ package body GNATCOLL.Projects is Is_Limited_With => Is_Limited_With); end if; - return Imports and Is_Limited_With; + return Imports and then Is_Limited_With; end Is_Limited_With; ---------- @@ -6751,7 +6741,7 @@ package body GNATCOLL.Projects is Ext : constant String := GNAT.Directory_Operations.File_Extension (+Filename); begin - if Ext = ".ads" or else Ext = ".adb" then + if Ext in ".ads" | ".adb" then return Filename'Last - 4; end if; end; @@ -8277,8 +8267,7 @@ package body GNATCOLL.Projects is function Process_Gnatls (Gnatls : String) return Boolean is begin if Tree.Data.Env.Gnatls = null or else - (Tree.Data.Env.Gnatls.all /= Gnatls and then - Tree.Data.Env.Gnatls.all /= No_Gnatls) + (Tree.Data.Env.Gnatls.all not in Gnatls | No_Gnatls) then Tree.Data.Env.Set_Path_From_Gnatls (Gnatls => Gnatls, @@ -8452,7 +8441,7 @@ package body GNATCOLL.Projects is begin Trace (Me, "Output of gnatls is " & S); - if S = "" and Errors /= null then + if S = "" and then Errors /= null then Errors ("The output from '" & Gnatls & "-v' is empty"); end if; @@ -9768,10 +9757,8 @@ package body GNATCOLL.Projects is -- we must ensure that the project_id matches the view from the -- tree, otherwise the project will not be found by the prj* -- packages. - if P.Data.Tree.View = null - or else P.Data.Tree.View = Tree - then - P.Data.View := Proj; + if P.Data.Tree.View in null | Tree then + P.Data.View := Proj; P.Data.Tree.View := Tree; -- must match Proj end if; elsif Active (Me) then @@ -9986,15 +9973,15 @@ package body GNATCOLL.Projects is declare Ls : constant String := P.Attribute_Value (Gnatlist_Attribute); begin - if Ls /= "" and then Ls /= Gnatls then + if Ls not in "" | Gnatls then -- We do not want to mark the project as incomplete for this -- warning, so we do not need to pass an actual Error_Handler GPR.Err.Error_Msg (Flags => Create_Flags (null), Msg => - "?the project attribute IDE.gnatlist doesn't have" - & " the same value as in the root project." - & " The value """ & Gnatls & """ will be used", + "?the project attribute IDE.gnatlist doesn't have" & + " the same value as in the root project." & + " The value """ & Gnatls & """ will be used", Project => Get_View (P)); end if; end; @@ -10265,9 +10252,7 @@ package body GNATCOLL.Projects is function Get_Environment (Self : Project_Type) return Project_Environment_Access is begin - if Self = No_Project - or Self.Data.Tree = null - then + if Self = No_Project or else Self.Data.Tree = null then return null; else return Self.Data.Tree.Env; @@ -10599,10 +10584,10 @@ package body GNATCOLL.Projects is if Lower_Pkg /= "" then Pkg_Id := Package_Node_Id_Of (Get_String (Lower_Pkg)); - if Pkg_Id = Empty_Package or else Pkg_Id = Unknown_Package then + if Pkg_Id in Empty_Package | Unknown_Package then Trace (Me, "Register_New_Package (" & Lower_Pkg & ")"); - Register_New_Package (Name => Lower_Pkg, Id => Pkg_Id); - if Pkg_Id = Empty_Package or else Pkg_Id = Unknown_Package then + Register_New_Package (Name => Lower_Pkg, Id => Pkg_Id); + if Pkg_Id in Empty_Package | Unknown_Package then Trace (Me, "Error registering new package"); end if; end if; diff --git a/src/gnatcoll-scripts-shell.adb b/src/gnatcoll-scripts-shell.adb index abfb0e7d..4ebebb55 100644 --- a/src/gnatcoll-scripts-shell.adb +++ b/src/gnatcoll-scripts-shell.adb @@ -284,7 +284,7 @@ package body GNATCOLL.Scripts.Shell is (Data, "File not found: """ & Filename & '"'); end; - elsif Command = "echo" or else Command = "echo_error" then + elsif Command in "echo" | "echo_error" then declare Result : Unbounded_String; begin @@ -297,12 +297,10 @@ package body GNATCOLL.Scripts.Shell is if Command = "echo" then Insert_Text - (Get_Script (Data), - Txt => To_String (Result) & ASCII.LF); + (Get_Script (Data), Txt => To_String (Result) & ASCII.LF); else Insert_Error - (Get_Script (Data), - Txt => To_String (Result) & ASCII.LF); + (Get_Script (Data), Txt => To_String (Result) & ASCII.LF); end if; end; @@ -577,9 +575,7 @@ package body GNATCOLL.Scripts.Shell is -- Do not display the prompt in the shell console if we did not -- output to it - if not Hide_Output - and then (Console = null or else Console = Old_Console) - then + if not Hide_Output and then (Console in null | Old_Console) then Display_Prompt (Script, Script.Console); end if; end; @@ -1072,8 +1068,7 @@ package body GNATCOLL.Scripts.Shell is First := Command'First; while First <= Command'Last loop while First <= Command'Last - and then (Command (First) = ' ' - or else Command (First) = ASCII.HT) + and then (Command (First) in ' ' | ASCII.HT) loop First := First + 1; end loop; @@ -1089,10 +1084,8 @@ package body GNATCOLL.Scripts.Shell is -- Search until the beginning of the next command (separated by -- semicolon or newline). while Last <= Command'Last loop - exit when not Quoted - and then not Triple_Quoted - and then (Command (Last) = ';' - or else Command (Last) = ASCII.LF); + exit when not Quoted and then not Triple_Quoted + and then (Command (Last) in ';' | ASCII.LF); if Command (Last) = '"' then if Last <= Command'Last - 2 diff --git a/src/gnatcoll-scripts-utils.adb b/src/gnatcoll-scripts-utils.adb index a60788c3..89c41736 100644 --- a/src/gnatcoll-scripts-utils.adb +++ b/src/gnatcoll-scripts-utils.adb @@ -48,7 +48,7 @@ package body GNATCOLL.Scripts.Utils is Len := Len + Args (J)'Length + 3; for T in Args (J)'Range loop - if Args (J)(T) = Quote or else Args (J)(T) = '\' then + if Args (J) (T) in Quote | '\' then Len := Len + 1; end if; end loop; @@ -215,7 +215,7 @@ package body GNATCOLL.Scripts.Utils is Max_Args := Max_Args * 2; end if; - if Start_With_Triple and End_With_Triple then + if Start_With_Triple and then End_With_Triple then New_Argv (New_Argc) := new String'(Arg_String (Start_Idx + 3 .. Idx - 4)); else diff --git a/src/gnatcoll-scripts.adb b/src/gnatcoll-scripts.adb index 0fe28804..a9de1d54 100644 --- a/src/gnatcoll-scripts.adb +++ b/src/gnatcoll-scripts.adb @@ -368,9 +368,7 @@ package body GNATCOLL.Scripts is for T in Tmp'Range loop if Tmp (T) = Scripting_Language (Script) then - if List (T) /= null - and then List (T) /= Data - then + if List (T) not in null | Data then Free (List (T)); end if; diff --git a/src/gnatcoll-strings_impl.adb b/src/gnatcoll-strings_impl.adb index d43e1e56..02296721 100644 --- a/src/gnatcoll-strings_impl.adb +++ b/src/gnatcoll-strings_impl.adb @@ -1164,17 +1164,13 @@ package body GNATCOLL.Strings_Impl is begin Get_String (Self, S, L); - if Side = Ada.Strings.Both - or else Side = Ada.Strings.Right - then + if Side in Ada.Strings.Both | Ada.Strings.Right then while L >= 1 and then S (L) = Chars loop - L := L - 1; + L := L - 1; end loop; end if; - if Side = Ada.Strings.Both - or else Side = Ada.Strings.Left - then + if Side in Ada.Strings.Both | Ada.Strings.Left then while F <= L and then S (F) = Chars loop F := F + 1; end loop; @@ -1198,17 +1194,13 @@ package body GNATCOLL.Strings_Impl is begin Get_String (Self, S, L); - if Side = Ada.Strings.Both - or else Side = Ada.Strings.Right - then + if Side in Ada.Strings.Both | Ada.Strings.Right then while L >= 1 and then S (L) = Chars loop - L := L - 1; + L := L - 1; end loop; end if; - if Side = Ada.Strings.Both - or else Side = Ada.Strings.Left - then + if Side in Ada.Strings.Both | Ada.Strings.Left then while F <= L and then S (F) = Chars loop F := F + 1; end loop; diff --git a/src/gnatcoll-traces.adb b/src/gnatcoll-traces.adb index 3aa6d7db..6d8c656e 100644 --- a/src/gnatcoll-traces.adb +++ b/src/gnatcoll-traces.adb @@ -423,9 +423,7 @@ package body GNATCOLL.Traces is function Stream_Name return String is begin - if Tmp.Stream /= null - and then Tmp.Stream /= Global.Streams_List - then + if Tmp.Stream not in null | Global.Streams_List then return " >" & Tmp.Stream.Name.all; else return ""; @@ -536,9 +534,9 @@ package body GNATCOLL.Traces is declare V : constant String := To_Lower (A (A'First + 7 .. A'Last)); begin - if V = "on" or else V = "true" then + if V in "on" | "true" then Default_Colors := GNATCOLL.Terminal.Yes; - elsif V = "off" or else V = "false" then + elsif V in "off" | "false" then Default_Colors := GNATCOLL.Terminal.No; else Default_Colors := GNATCOLL.Terminal.Auto; @@ -983,9 +981,8 @@ package body GNATCOLL.Traces is if Handle.all in Trace_Decorator_Record'Class then Dec := Trace_Decorator (Handle); - if Dec /= Global.Colors - and then Dec /= Global.Finalize_Traces - and then Dec /= Global.Split_Lines + if Dec not in Global.Colors | Global.Finalize_Traces | + Global.Split_Lines then -- If active, store it in the list of active decorators if Active then @@ -1004,7 +1001,7 @@ package body GNATCOLL.Traces is for A in 1 .. Global.Active_Last loop if Global.Active_Decorators (A) = Dec then Global.Active_Decorators (A .. Global.Active_Last - 1) := - Global.Active_Decorators (A + 1 .. Global.Active_Last); + Global.Active_Decorators (A + 1 .. Global.Active_Last); Global.Active_Last := Global.Active_Last - 1; exit; end if; @@ -1012,9 +1009,7 @@ package body GNATCOLL.Traces is end if; end if; - if Dec = Global.Colors - or else Dec = Global.Absolute_Time - or else Dec = Global.Absolute_Date + if Dec in Global.Colors | Global.Absolute_Time | Global.Absolute_Date then Tmp := Global.Handles_List; while Tmp /= null loop @@ -1695,10 +1690,8 @@ package body GNATCOLL.Traces is Status : int; pragma Unreferenced (Status); begin - if Stream.File /= stdout - and then Stream.File /= stderr - then - Status := fclose (Stream.File); + if Stream.File not in stdout | stderr then + Status := fclose (Stream.File); Stream.File := NULL_Stream; end if; diff --git a/src/gnatcoll-utils.adb b/src/gnatcoll-utils.adb index 2a2e4a8d..cac34e08 100644 --- a/src/gnatcoll-utils.adb +++ b/src/gnatcoll-utils.adb @@ -60,11 +60,7 @@ package body GNATCOLL.Utils is function Is_Whitespace (Char : Character) return Boolean is begin - if Char = ' ' - or else Char = ASCII.HT - or else Char = ASCII.LF - or else Char = ASCII.CR - then + if Char in ' ' | ASCII.HT | ASCII.LF | ASCII.CR then return True; end if; return False; @@ -394,7 +390,7 @@ package body GNATCOLL.Utils is -- In addition to the default directory_separator allow the '/' to -- act as separator since this a valid path separator on Windows -- systems. - return C = GNAT.OS_Lib.Directory_Separator or else C = '/'; + return C in GNAT.OS_Lib.Directory_Separator | '/'; end Is_Directory_Separator; ------------------------- @@ -841,7 +837,7 @@ package body GNATCOLL.Utils is end if; for J in reverse Str'First .. Index loop - if Str (J) = ASCII.LF or else Str (J) = ASCII.CR then + if Str (J) in ASCII.LF | ASCII.CR then if J < Str'Last then return J + 1; else @@ -861,7 +857,7 @@ package body GNATCOLL.Utils is Index : constant Natural := Natural'Max (Str'First, P); begin for J in Index .. Str'Last loop - if Str (J) = ASCII.LF or else Str (J) = ASCII.CR then + if Str (J) in ASCII.LF | ASCII.CR then return J - 1; end if; end loop; @@ -1208,9 +1204,7 @@ package body GNATCOLL.Utils is and then Str (It) /= ASCII.CR and then Str (It) /= ASCII.LF loop - if Str (It) /= ' ' - and then Str (It) /= ASCII.HT - then + if Str (It) not in ' ' | ASCII.HT then return False; end if; diff --git a/src/gnatcoll-vfs.adb b/src/gnatcoll-vfs.adb index 7133e209..e144cf37 100644 --- a/src/gnatcoll-vfs.adb +++ b/src/gnatcoll-vfs.adb @@ -1788,21 +1788,21 @@ package body GNATCOLL.VFS is declare B : constant Filesystem_String := Files (F).Base_Name; begin - if B /= "." and then B /= ".." then + if B not in "." | ".." then if Extension = "" - or else Files (F).File_Extension = Extension + or else Files (F).File_Extension = Extension then case Filter is - when Dirs_Only => - if Files (F).Is_Directory then + when Dirs_Only => + if Files (F).Is_Directory then + Append (Result, Files (F)); + end if; + when Files_Only => + if Files (F).Is_Regular_File then + Append (Result, Files (F)); + end if; + when All_Files => Append (Result, Files (F)); - end if; - when Files_Only => - if Files (F).Is_Regular_File then - Append (Result, Files (F)); - end if; - when All_Files => - Append (Result, Files (F)); end case; end if;