From dec65fa49d9e5255521fcdd01ba4e57c43b8c4c0 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 7 Jan 2023 18:25:59 +0100 Subject: synth: fix handling of extended enumeration identifiers. --- src/synth/synth-vhdl_eval.adb | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3