diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ghdldrv/ghdlprint.adb | 13 | ||||
-rw-r--r-- | src/vhdl/parse.adb | 16 | ||||
-rw-r--r-- | src/vhdl/xrefs.adb | 7 | ||||
-rw-r--r-- | src/vhdl/xrefs.ads | 9 |
4 files changed, 43 insertions, 2 deletions
diff --git a/src/ghdldrv/ghdlprint.adb b/src/ghdldrv/ghdlprint.adb index d228f2d1f..53df620ae 100644 --- a/src/ghdldrv/ghdlprint.adb +++ b/src/ghdldrv/ghdlprint.adb @@ -233,22 +233,26 @@ package body Ghdlprint is Bod : Iir; Loc : Location_Type; begin - Disp_Spaces; if Flags.Flag_Xref then Loc := File_Pos_To_Location (File, Bef_Tok); Ref := Find (Loc); if Ref = Bad_Xref then + Disp_Spaces; Disp_Text; Warning_Msg_Sem (Warnid_Missing_Xref, Loc, "cannot find xref"); Missing_Xref := True; return; end if; else + Disp_Spaces; Disp_Text; return; end if; case Get_Xref_Kind (Ref) is + when Xref_Keyword => + Disp_Reserved; when Xref_Decl => + Disp_Spaces; Put ("<a"); Disp_Anchor (Loc); Decl := Get_Xref_Node (Ref); @@ -279,6 +283,7 @@ package body Ghdlprint is Put ("</a>"); when Xref_Ref | Xref_End => + Disp_Spaces; Decl := Get_Xref_Node (Ref); Loc := Get_Location (Decl); if Loc /= Location_Nil then @@ -292,6 +297,7 @@ package body Ghdlprint is Disp_Text; end if; when Xref_Body => + Disp_Spaces; Put ("<a"); Disp_Anchor (Loc); Disp_Href (Get_Location (Get_Xref_Node (Ref))); @@ -1404,6 +1410,8 @@ package body Ghdlprint is Put (" end "); when Xref_Body => Put (" body "); + when Xref_Keyword => + Put (" keyword "); end case; New_Line; end; @@ -1744,6 +1752,9 @@ package body Ghdlprint is Emit_Ref (I, 'r'); when Xref_Body => Emit_Ref (I, 'b'); + when Xref_Keyword => + -- Keywords location are not written. + null; end case; end if; end loop; 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; |