aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-11-30 20:45:04 +0100
committerTristan Gingold <tgingold@free.fr>2018-11-30 20:45:04 +0100
commitedc1bf4390318835c8f945c13e277c771dcda967 (patch)
treed1afd0a43842f021725266758826ce3b70f9e2ef /src
parenta95c7301be2f7ee279f1bf9d94cc728abd614f37 (diff)
downloadghdl-edc1bf4390318835c8f945c13e277c771dcda967.tar.gz
ghdl-edc1bf4390318835c8f945c13e277c771dcda967.tar.bz2
ghdl-edc1bf4390318835c8f945c13e277c771dcda967.zip
scanner: improve messages, eat trailing underscore of identifiers.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/scanner.adb27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/vhdl/scanner.adb b/src/vhdl/scanner.adb
index 0d99315e6..5de12cac2 100644
--- a/src/vhdl/scanner.adb
+++ b/src/vhdl/scanner.adb
@@ -949,10 +949,11 @@ package body Scanner is
-- an adjacent letter or digit.
-- Basic identifiers differing only in the use of the corresponding
-- upper and lower case letters are considered as the same.
- -- This is achieved by converting all upper case letters into
- -- equivalent lower case letters.
- -- The opposite (converting in lower case letters) is not possible,
- -- because two characters have no upper-case equivalent.
+ --
+ -- GHDL: This is achieved by converting all upper case letters into
+ -- equivalent lower case letters.
+ -- The opposite (converting to upper lower case letters) is not
+ -- possible because two characters have no upper-case equivalent.
C := Source (Pos);
case C is
when 'A' .. 'Z' =>
@@ -1004,14 +1005,16 @@ package body Scanner is
end loop;
if Source (Pos - 1) = '_' then
- if not Allow_PSL then
+ if Allow_PSL then
-- Some PSL reserved words finish with '_'. This case is handled
- -- later.
- Error_Msg_Scan ("identifier cannot finish with '_'");
+ -- later by Scan_Underscore and Scan_Exclam_Mark.
+ Pos := Pos - 1;
+ Len := Len - 1;
+ C := '_';
+ else
+ -- Eat the trailing underscore.
+ Error_Msg_Scan ("an identifier cannot finish with '_'");
end if;
- Pos := Pos - 1;
- Len := Len - 1;
- C := '_';
end if;
-- LRM93 13.2
@@ -1439,7 +1442,7 @@ package body Scanner is
if C = '_' then
if I = 1 then
Error_Msg_Option
- ("identifier cannot start with an underscore");
+ ("an identifier cannot start with an underscore");
return;
end if;
if Id (I - 1) = '_' then
@@ -1449,7 +1452,7 @@ package body Scanner is
end if;
if I = Id'Last then
Error_Msg_Option
- ("identifier cannot finish with an underscore");
+ ("an identifier cannot finish with an underscore");
return;
end if;
else