From f6c9bc0e66602c86003f118d8d8e35693d4abcaf Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 15 Jan 2017 08:01:27 +0100 Subject: Add xref_keyword for PSL keywords that aren't reserved words. --- src/vhdl/parse.adb | 16 ++++++++++++++++ src/vhdl/xrefs.adb | 7 +++++++ src/vhdl/xrefs.ads | 9 ++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) (limited to 'src/vhdl') diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 3adf845e2..fbe5a9f95 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -3888,14 +3888,26 @@ package body Parse is begin Res := Create_Iir (Iir_Kind_Psl_Default_Clock); Set_Location (Res); + + -- Recognize PSL keywords. Scanner.Flag_Psl := True; + + -- Skip 'default'. Scan_Expect (Tok_Psl_Clock); + Xrefs.Xref_Keyword (Get_Token_Location); + + -- Skip 'clock'. Scan_Expect (Tok_Is); + + -- Skip 'is'. Scan; + Set_Psl_Boolean (Res, Parse_Psl.Parse_Psl_Boolean); Expect (Tok_Semi_Colon); + Scanner.Flag_Scan_In_Comment := False; Scanner.Flag_Psl := False; + return Res; end Parse_Psl_Default_Clock; @@ -4420,6 +4432,10 @@ package body Parse is if Vhdl_Std >= Vhdl_08 and then Current_Identifier = Name_Default then + -- This identifier is a PSL keyword. + Xrefs.Xref_Keyword (Get_Token_Location); + + -- Check whether default clock are allowed in this region. case Get_Kind (Parent) is when Iir_Kind_Function_Body | Iir_Kind_Procedure_Body diff --git a/src/vhdl/xrefs.adb b/src/vhdl/xrefs.adb index aa2329505..58b52e2d9 100644 --- a/src/vhdl/xrefs.adb +++ b/src/vhdl/xrefs.adb @@ -110,6 +110,13 @@ package body Xrefs is end if; end Xref_End; + procedure Xref_Keyword (Loc : Location_Type) is + begin + if Flags.Flag_Xref then + Add_Xref (Loc, Null_Iir, Xref_Keyword); + end if; + end Xref_Keyword; + procedure Xref_Name_1 (Name : Iir) is begin case Get_Kind (Name) is diff --git a/src/vhdl/xrefs.ads b/src/vhdl/xrefs.ads index 74f2d0c7e..c89470e9b 100644 --- a/src/vhdl/xrefs.ads +++ b/src/vhdl/xrefs.ads @@ -31,7 +31,10 @@ package Xrefs is Xref_End, -- Body of a declaration (for package, subprograms or protected type). - Xref_Body + Xref_Body, + + -- A PSL keyword that would be scanned as an identifier + Xref_Keyword ); -- Initialize the xref table. @@ -63,6 +66,10 @@ package Xrefs is procedure Xref_End (Loc : Location_Type; Decl : Iir); pragma Inline (Xref_End); + -- LOC is the location of a PSL keyword. + procedure Xref_Keyword (Loc : Location_Type); + pragma Inline (Xref_Keyword); + -- Sort the xref table by location. This is required before searching with -- Find. procedure Sort_By_Location; -- cgit v1.2.3