aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-08-03 07:06:50 +0200
committerTristan Gingold <tgingold@free.fr>2016-08-25 03:49:37 +0200
commit5dcc9b2763c589ee135be62e162bf3dc5e87a81f (patch)
treecfa984bb8c10b6ada3f2fbfed31fc956269cd429 /src/vhdl
parentf0ac58f4318aebb4efa21472321e5d95c277cb37 (diff)
downloadghdl-5dcc9b2763c589ee135be62e162bf3dc5e87a81f.tar.gz
ghdl-5dcc9b2763c589ee135be62e162bf3dc5e87a81f.tar.bz2
ghdl-5dcc9b2763c589ee135be62e162bf3dc5e87a81f.zip
evaluation: factorize code, rewrite an error message.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/evaluation.adb16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb
index 1713e4af5..f774208b2 100644
--- a/src/vhdl/evaluation.adb
+++ b/src/vhdl/evaluation.adb
@@ -1649,9 +1649,8 @@ package body Evaluation is
if Res /= Null_Iir then
return Build_Constant (Res, Expr);
else
- Warning_Msg_Sem
- (Warnid_Runtime_Error, +Expr,
- "value """ & Value & """ not in enumeration %n", +Enum);
+ Warning_Msg_Sem (Warnid_Runtime_Error, +Expr,
+ "value %i not in enumeration %n", (+Id, +Enum));
return Build_Overflow (Expr);
end if;
end Build_Enumeration_Value;
@@ -1684,24 +1683,17 @@ package body Evaluation is
function Build_Physical_Value (Val: String; Phys_Type, Expr: Iir) return Iir
is
- function White (C : in Character) return Boolean is
- NBSP : constant Character := Character'Val (160);
- HT : constant Character := Character'Val (9);
- begin
- return C = ' ' or C = NBSP or C = HT;
- end White;
-
UnitName : String (Val'range);
Mult : Iir_Int64;
Sep : Natural;
Found_Unit : Boolean := false;
Found_Real : Boolean := false;
- Unit : Iir := Get_Primary_Unit (Phys_Type);
+ Unit : Iir;
begin
-- Separate string into numeric value and make lowercase unit.
for I in reverse Val'range loop
UnitName (I) := Ada.Characters.Handling.To_Lower (Val (I));
- if White (Val (I)) and Found_Unit then
+ if Scanner.Is_Whitespace (Val (I)) and Found_Unit then
Sep := I;
exit;
else