diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2021-12-01 15:53:45 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-01-05 11:32:36 +0000 |
commit | 7c58372ad22f94d21b15ae2f2838e761b36b3486 (patch) | |
tree | 84c57398b16a65de51e920f6c3bd940675c326bb | |
parent | 3814652309edac1154ee3c7e40ff65ff861d17f3 (diff) | |
download | gcc-7c58372ad22f94d21b15ae2f2838e761b36b3486.zip gcc-7c58372ad22f94d21b15ae2f2838e761b36b3486.tar.gz gcc-7c58372ad22f94d21b15ae2f2838e761b36b3486.tar.bz2 |
[Ada] Simplify handling of user-defined numeric literals
gcc/ada/
* sem_util.adb (String_From_Numeric_Literal): Simplify using
membership tests and ranges; fix whitespace.
-rw-r--r-- | gcc/ada/sem_util.adb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 7064dfa..bfe15fa 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -28978,7 +28978,7 @@ package body Sem_Util is Source_Text (Get_Source_File_Index (Loc)); Src_Ptr : Source_Ptr := Loc; - C : Character := Sbuffer (Src_Ptr); + C : Character := Sbuffer (Src_Ptr); -- Current source program character function Belongs_To_Numeric_Literal (C : Character) return Boolean; @@ -28991,9 +28991,7 @@ package body Sem_Util is function Belongs_To_Numeric_Literal (C : Character) return Boolean is begin case C is - when '0' .. '9' - | '_' | '.' | 'e' | '#' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' - => + when '0' .. '9' | '_' | '.' | 'e' | '#' | 'A' .. 'F' => return True; -- Make sure '+' or '-' is part of an exponent @@ -29002,7 +29000,7 @@ package body Sem_Util is declare Prev_C : constant Character := Sbuffer (Src_Ptr - 1); begin - return Prev_C = 'e' or else Prev_C = 'E'; + return Prev_C in 'e' | 'E'; end; -- Other characters cannot belong to a numeric literal |