diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-07 18:25:59 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-09 06:40:14 +0100 |
commit | dec65fa49d9e5255521fcdd01ba4e57c43b8c4c0 (patch) | |
tree | 4a4ffd2b4b8c693c4d0bb01a5e11e44020122739 /src/synth/synth-vhdl_eval.adb | |
parent | 1461594acf5bd134a5f011f44767eeef0d373500 (diff) | |
download | ghdl-dec65fa49d9e5255521fcdd01ba4e57c43b8c4c0.tar.gz ghdl-dec65fa49d9e5255521fcdd01ba4e57c43b8c4c0.tar.bz2 ghdl-dec65fa49d9e5255521fcdd01ba4e57c43b8c4c0.zip |
synth: fix handling of extended enumeration identifiers.
Diffstat (limited to 'src/synth/synth-vhdl_eval.adb')
-rw-r--r-- | src/synth/synth-vhdl_eval.adb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/synth/synth-vhdl_eval.adb b/src/synth/synth-vhdl_eval.adb index 2191e7a9c..448b0b96f 100644 --- a/src/synth/synth-vhdl_eval.adb +++ b/src/synth/synth-vhdl_eval.adb @@ -788,7 +788,30 @@ package body Synth.Vhdl_Eval is C (1) := Get_Character (Lit_Id); return String_To_Memtyp (C, Res_Typ); else - return String_To_Memtyp (Image (Lit_Id), Res_Typ); + declare + Img : String := Image (Lit_Id); + P, Idx : Natural; + begin + if Img (Img'First) = '\' then + -- Extended identifier. + -- Remove initial and final backslash. + -- Un-duplicate doubled backslashes. + P := Img'First - 1; + Idx := 2; + while Idx < Img'Last loop + P := P + 1; + Img (P) := Img (Idx); + if Img (Idx) = '\' then + Idx := Idx + 2; + else + Idx := Idx + 1; + end if; + end loop; + else + P := Img'Last; + end if; + return String_To_Memtyp (Img (Img'First .. P), Res_Typ); + end; end if; end Eval_Enum_To_String; |