aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-01-15 08:01:27 +0100
committerTristan Gingold <tgingold@free.fr>2017-01-15 08:01:27 +0100
commitf6c9bc0e66602c86003f118d8d8e35693d4abcaf (patch)
treea7b9a92a785d9c0ceec7a901a27a5b657374c1e4 /src/vhdl
parent26cb40f846c974ccec22bf1165e5b519bba2247c (diff)
downloadghdl-f6c9bc0e66602c86003f118d8d8e35693d4abcaf.tar.gz
ghdl-f6c9bc0e66602c86003f118d8d8e35693d4abcaf.tar.bz2
ghdl-f6c9bc0e66602c86003f118d8d8e35693d4abcaf.zip
Add xref_keyword for PSL keywords that aren't reserved words.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/parse.adb16
-rw-r--r--src/vhdl/xrefs.adb7
-rw-r--r--src/vhdl/xrefs.ads9
3 files changed, 31 insertions, 1 deletions
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;