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/vhdl-parse.adb | |
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/vhdl-parse.adb')
-rw-r--r-- | src/vhdl/vhdl-parse.adb | 20 |
1 files changed, 20 insertions, 0 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 |