diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-05-25 21:27:13 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-05-25 21:27:13 +0200 |
commit | 9a1b98eeeda9e998a9e3898fb979fe874c8a15e2 (patch) | |
tree | 696a15162044618b63485300783713d77d75b677 /src/vhdl | |
parent | 3fafb1354ff36f3ba23e5efbde7599b1d72caf88 (diff) | |
download | ghdl-9a1b98eeeda9e998a9e3898fb979fe874c8a15e2.tar.gz ghdl-9a1b98eeeda9e998a9e3898fb979fe874c8a15e2.tar.bz2 ghdl-9a1b98eeeda9e998a9e3898fb979fe874c8a15e2.zip |
vhdl: move Current_Text from vhdl-utils to vhdl-parse.
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/vhdl-parse.adb | 20 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.adb | 27 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.ads | 4 |
3 files changed, 23 insertions, 28 deletions
diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 140317d3f..e10be4998 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -157,6 +157,26 @@ package body Vhdl.Parse is end if; end Expect_Scan; + -- Transform the current token into an iir literal. + -- The current token must be either a character or an identifier. + function Current_Text return Iir is + Res: Iir; + begin + case Current_Token is + when Tok_Identifier => + Res := Create_Iir (Iir_Kind_Simple_Name); + when Tok_Character => + Res := Create_Iir (Iir_Kind_Character_Literal); + when others => + raise Internal_Error; + end case; + Set_Identifier (Res, Current_Identifier); + Invalidate_Current_Identifier; + Invalidate_Current_Token; + Set_Location (Res, Get_Token_Location); + return Res; + end Current_Text; + -- Expect the identifier for node RES. procedure Scan_Identifier (Res : Iir) is begin diff --git a/src/vhdl/vhdl-utils.adb b/src/vhdl/vhdl-utils.adb index e1477a7bc..ea269f2cc 100644 --- a/src/vhdl/vhdl-utils.adb +++ b/src/vhdl/vhdl-utils.adb @@ -15,37 +15,16 @@ -- along with GHDL; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -with Vhdl.Scanner; use Vhdl.Scanner; -with Vhdl.Tokens; use Vhdl.Tokens; -with Vhdl.Errors; use Vhdl.Errors; + +with Flags; use Flags; with Name_Table; with Str_Table; with Std_Names; use Std_Names; with Vhdl.Std_Package; -with Flags; use Flags; +with Vhdl.Errors; use Vhdl.Errors; with PSL.Nodes; package body Vhdl.Utils is - -- Transform the current token into an iir literal. - -- The current token must be either a character or an identifier. - function Current_Text return Iir is - Res: Iir; - begin - case Current_Token is - when Tok_Identifier => - Res := Create_Iir (Iir_Kind_Simple_Name); - when Tok_Character => - Res := Create_Iir (Iir_Kind_Character_Literal); - when others => - raise Internal_Error; - end case; - Set_Identifier (Res, Current_Identifier); - Invalidate_Current_Identifier; - Invalidate_Current_Token; - Set_Location (Res, Get_Token_Location); - return Res; - end Current_Text; - function Is_Error (N : Iir) return Boolean is begin return Get_Kind (N) = Iir_Kind_Error; diff --git a/src/vhdl/vhdl-utils.ads b/src/vhdl/vhdl-utils.ads index f94d5996e..fabe48f81 100644 --- a/src/vhdl/vhdl-utils.ads +++ b/src/vhdl/vhdl-utils.ads @@ -20,10 +20,6 @@ with Vhdl.Nodes; use Vhdl.Nodes; with PSL.Types; use PSL.Types; package Vhdl.Utils is - -- Transform the current token into an iir literal. - -- The current token must be either a character, a string or an identifier. - function Current_Text return Iir; - -- Get identifier of NODE as a string. function Image_Identifier (Node : Iir) return String; function Image_String_Lit (Str : Iir) return String; |