diff options
| -rw-r--r-- | src/vhdl/nodes.adb | 12 | ||||
| -rw-r--r-- | src/vhdl/scanner.adb | 60 | ||||
| -rw-r--r-- | src/vhdl/sem_specs.adb | 1 | 
3 files changed, 46 insertions, 27 deletions
| diff --git a/src/vhdl/nodes.adb b/src/vhdl/nodes.adb index 2b0997cef..3f0a2b317 100644 --- a/src/vhdl/nodes.adb +++ b/src/vhdl/nodes.adb @@ -83,7 +83,17 @@ package body Nodes is           end if;           case Format is              when Format_Short => -               Nodet.Table (Res) := Init_Short; +               --  Inline initialization for speed. +               Nodet.Table (Res) := Node_Record' +                 (Format => Format_Short, +                  Kind => 0, +                  State1 | State2 => 0, +                  Odigit1 => 0, +                  Unused_Odigit2 => 0, +                  Location => Location_Nil, +                  Field0 | Field1 | Field2 | Field3  => Null_Node, +                  Field4 | Field5 => Null_Node, +                  others => False);              when Format_Medium =>                 raise Program_Error;              when Format_Fp => diff --git a/src/vhdl/scanner.adb b/src/vhdl/scanner.adb index 7f68b3238..b480533c5 100644 --- a/src/vhdl/scanner.adb +++ b/src/vhdl/scanner.adb @@ -572,8 +572,8 @@ package body Scanner is        -- This is an identifier or a key word.        Len := 0;        loop -         -- source (pos) is correct. -         -- LRM93 13.3.1 +         --  Source (pos) is correct. +         --  LRM93 13.3.1           --   All characters if a basic identifier are signifiant, including           --   any underline character inserted between a letter or digit and           --   an adjacent letter or digit. @@ -584,33 +584,41 @@ package body Scanner is           -- The opposite (converting in lower case letters) is not possible,           -- because two characters have no upper-case equivalent.           C := Source (Pos); -         case Characters_Kind (C) is -            when Upper_Case_Letter => -               if Vhdl_Std = Vhdl_87 and C > 'Z' then -                  Error_8bit; -               end if; -               Len := Len + 1; -               Name_Buffer (Len) := Ada.Characters.Handling.To_Lower (C); -            when Lower_Case_Letter | Digit => -               if Vhdl_Std = Vhdl_87 and C > 'z' then -                  Error_8bit; -               end if; -               Len := Len + 1; -               Name_Buffer (Len) := C; -            when Special_Character => -               -- The current character is legal in an identifier. -               if C = '_' then -                  if Source (Pos + 1) = '_' then -                     Error_Msg_Scan ("two underscores can't be consecutive"); -                  end if; -                  Len := Len + 1; -                  Name_Buffer (Len) := C; -               else -                  exit; +         case C is +            when 'A' .. 'Z' => +               C := Character'Val +                 (Character'Pos (C) +                    + Character'Pos ('a') - Character'Pos ('A')); +            when 'a' .. 'z' | '0' .. '9' => +               null; +            when '_' => +               if Source (Pos + 1) = '_' then +                  Error_Msg_Scan ("two underscores can't be consecutive");                 end if; -            when others => +            when ' ' | ')' | '.' | ';' | ':' =>                 exit; +            when others => +               --  Non common case. +               case Characters_Kind (C) is +                  when Upper_Case_Letter | Lower_Case_Letter => +                     if Vhdl_Std = Vhdl_87 then +                        Error_8bit; +                     end if; +                     Len := Len + 1; +                     C := Ada.Characters.Handling.To_Lower (C); +                  when Digit => +                     raise Internal_Error; +                  when others => +                     exit; +               end case;           end case; + +         --  Put character in name buffer.  FIXME: compute the hash at the same +         --  time ? +         Len := Len + 1; +         Name_Buffer (Len) := C; + +         --  Next character.           Pos := Pos + 1;        end loop; diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb index 4c04ea4e7..80fc5abf4 100644 --- a/src/vhdl/sem_specs.adb +++ b/src/vhdl/sem_specs.adb @@ -1749,6 +1749,7 @@ package body Sem_Specs is        Inter := Get_Interpretation (Name);        if Valid_Interpretation (Inter) then +         --  LRM93 5.2.2 Default binding indication           --  A visible entity declaration is either:           --           --  a) An entity declaration that has the same simple name as that of | 
