From 8e84ebdf517fde66db0659245b88319f4da25a72 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 26 Aug 2021 08:07:34 +0200 Subject: PSL: handle inf in star repeat sequence. Fix #1832 --- src/vhdl/vhdl-parse_psl.adb | 16 ++++++++++++---- src/vhdl/vhdl-prints.adb | 4 ++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/vhdl-parse_psl.adb b/src/vhdl/vhdl-parse_psl.adb index 314249c14..808c2dae7 100644 --- a/src/vhdl/vhdl-parse_psl.adb +++ b/src/vhdl/vhdl-parse_psl.adb @@ -57,9 +57,9 @@ package body Vhdl.Parse_Psl is Scan; return Res; elsif Current_Token = Tok_Inf then - -- FIXME: create node + Res := Create_Node_Loc (N_Inf); Scan; - return Null_Node; + return Res; else Error_Msg_Parse ("number expected"); return Null_Node; @@ -68,9 +68,16 @@ package body Vhdl.Parse_Psl is procedure Check_Positive_Count (N : Node) is - Low : constant Uns32 := Get_Value (Get_Low_Bound (N)); - High : constant Uns32 := Get_Value (Get_High_Bound (N)); + Low_B : constant Node := Get_Low_Bound (N); + High_B : constant Node := Get_High_Bound (N); + Low : constant Uns32 := Get_Value (Low_B); + High : Uns32; begin + if Get_Kind (High_B) = N_Inf then + return; + end if; + + High := Get_Value (High_B); if Low > High then Error_Msg_Parse ("Low bound of range must be lower than High bound," & @@ -840,6 +847,7 @@ package body Vhdl.Parse_Psl is | N_False | N_True | N_Number + | N_Inf | N_Name_Decl | N_Name | N_EOS diff --git a/src/vhdl/vhdl-prints.adb b/src/vhdl/vhdl-prints.adb index 361cbe18b..ec4d870e5 100644 --- a/src/vhdl/vhdl-prints.adb +++ b/src/vhdl/vhdl-prints.adb @@ -1958,6 +1958,10 @@ package body Vhdl.Prints is Disp_Str (Ctxt, Str); Close_Lit (Ctxt); end; + when N_Inf => + Start_Lit (Ctxt, Tok_Identifier); + Disp_Str (Ctxt, "INF"); + Close_Lit (Ctxt); when N_Name_Decl => Disp_Ident (Ctxt, Get_Identifier (N)); when N_HDL_Expr -- cgit v1.2.3