aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt
diff options
context:
space:
mode:
authorJonas Baggett <jonas17b@gmail.com>2016-12-20 20:27:29 +0100
committertgingold <tgingold@users.noreply.github.com>2016-12-20 20:27:29 +0100
commitc3ed5c426b8be1144574b9e33135450cf6ceab1a (patch)
tree53c3ae2d7bc469804df8db2eac24bf17ebc5990c /src/grt
parent7fd06aadb2e9863cb34f3dce468ac3ab0d39eb2c (diff)
downloadghdl-c3ed5c426b8be1144574b9e33135450cf6ceab1a.tar.gz
ghdl-c3ed5c426b8be1144574b9e33135450cf6ceab1a.tar.bz2
ghdl-c3ed5c426b8be1144574b9e33135450cf6ceab1a.zip
Add support for extended identifiers in wave option files. (#236)
Diffstat (limited to 'src/grt')
-rw-r--r--src/grt/grt-strings.adb7
-rw-r--r--src/grt/grt-strings.ads1
-rw-r--r--src/grt/grt-wave_opt-file.adb28
3 files changed, 27 insertions, 9 deletions
diff --git a/src/grt/grt-strings.adb b/src/grt/grt-strings.adb
index 82fd331e5..325d91483 100644
--- a/src/grt/grt-strings.adb
+++ b/src/grt/grt-strings.adb
@@ -79,13 +79,6 @@ package body Grt.Strings is
end if;
end To_Lower;
- procedure To_Lower (S : in out String) is
- begin
- for I in S'Range loop
- S (I) := To_Lower (S (I));
- end loop;
- end To_Lower;
-
function Value (Str : String) return Integer
is
Decimal : Positive;
diff --git a/src/grt/grt-strings.ads b/src/grt/grt-strings.ads
index 46d89008b..61e1c8c87 100644
--- a/src/grt/grt-strings.ads
+++ b/src/grt/grt-strings.ads
@@ -51,7 +51,6 @@ package Grt.Strings is
-- Convert C/S to lowercase.
function To_Lower (C : Character) return Character;
- procedure To_Lower (S : in out String);
-- Str/Char : image of a natural number/digit
function Value (Str : String) return Integer;
diff --git a/src/grt/grt-wave_opt-file.adb b/src/grt/grt-wave_opt-file.adb
index bf961f8ae..da3e1f8ca 100644
--- a/src/grt/grt-wave_opt-file.adb
+++ b/src/grt/grt-wave_opt-file.adb
@@ -50,6 +50,8 @@ with Grt.Errors; use Grt.Errors;
package body Grt.Wave_Opt.File is
+ procedure To_Lower (Signal_Path : in out String);
+
-- Open the wave option file
function Open (Option_File : String; To_Be_Created : Boolean) return FILEs;
@@ -237,6 +239,7 @@ package body Grt.Wave_Opt.File is
Tree_Index : Tree_Index_Type;
Tree_Cursor : Elem_Acc;
Tree_Updated : Boolean;
+ Is_Extended_Identifier : Boolean := False;
begin
To_Lower (Line);
Last := Line'First;
@@ -267,10 +270,21 @@ package body Grt.Wave_Opt.File is
-- Find next identifier
loop
- if Line (Last) = Seps (Tree_Index) then
+ if Line (Last) = '\' then
+ Is_Extended_Identifier := not Is_Extended_Identifier;
+ end if;
+ -- What is enclosed between \ and \ is interpreted as an extended
+ -- identifier, so we need to make sure that nothing in between will
+ -- be interpreted as a signal path separator.
+ if not Is_Extended_Identifier and Line (Last) = Seps (Tree_Index)
+ then
Last := Last - 1;
exit;
elsif Last = Line'Last then
+ if Is_Extended_Identifier then
+ Error_Context("Extended identifier not terminated by a '\'",
+ Lineno, First);
+ end if;
exit;
end if;
Last := Last + 1;
@@ -376,6 +390,18 @@ package body Grt.Wave_Opt.File is
New_Line (Stream);
end Write_Version;
+ procedure To_Lower (Signal_Path : in out String) is
+ Is_Extended_Identifier : Boolean := false;
+ begin
+ for I in Signal_Path'Range loop
+ if Signal_Path (I) = '\' then
+ Is_Extended_Identifier := not Is_Extended_Identifier;
+ elsif not Is_Extended_Identifier then
+ Signal_Path (I) := To_Lower (Signal_Path (I));
+ end if;
+ end loop;
+ end To_Lower;
+
function Open (Option_File : String; To_Be_Created : Boolean) return FILEs
is
Read_Mode : constant String := "rt" & ASCII.Nul;