diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-05-04 16:36:55 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-05-04 16:36:55 +0200 |
commit | f6aab8b287186c49b5534c13e196ac72dc622bd4 (patch) | |
tree | baf527c8d93a2b5aa7d1ab6a3f5c5340431f0386 | |
parent | d29f7f168efee2a97d219b57ce2f2f7c2ff7fc25 (diff) | |
download | ghdl-f6aab8b287186c49b5534c13e196ac72dc622bd4.tar.gz ghdl-f6aab8b287186c49b5534c13e196ac72dc622bd4.tar.bz2 ghdl-f6aab8b287186c49b5534c13e196ac72dc622bd4.zip |
vhdl: error message on backquote.
-rw-r--r-- | src/vhdl/scanner.adb | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/vhdl/scanner.adb b/src/vhdl/scanner.adb index c8e5a9765..913883ab1 100644 --- a/src/vhdl/scanner.adb +++ b/src/vhdl/scanner.adb @@ -1593,8 +1593,7 @@ package body Scanner is is procedure Error_Missing_Directive is begin - Error_Msg_Scan - ("tool directive required after '`'"); + Error_Msg_Scan ("tool directive required after '`'"); Skip_Until_EOL; end Error_Missing_Directive; @@ -1713,6 +1712,15 @@ package body Scanner is Scan_Next_Line; end Scan_LF_Newline; + -- Emit an error message for an invalid character. + procedure Error_Bad_Character is + begin + -- Technically character literals, string literals, extended + -- identifiers and comments. + Error_Msg_Scan ("character %c can only be used in strings or comments", + +Source (Pos)); + end Error_Bad_Character; + -- Get a new token. procedure Scan is begin @@ -2208,7 +2216,7 @@ package body Scanner is return; when '?' => if Vhdl_Std < Vhdl_08 then - Error_Msg_Scan ("'?' can only be used in strings or comments"); + Error_Bad_Character; Pos := Pos + 1; goto Again; else @@ -2250,17 +2258,14 @@ package body Scanner is if Vhdl_Std >= Vhdl_08 then Scan_Tool_Directive; else - Warning_Msg_Scan (Warnid_Directive, - "tool directives are ignored"); + Error_Bad_Character; Skip_Until_EOL; end if; goto Again; when '$' | Inverted_Exclamation .. Inverted_Question | Multiplication_Sign | Division_Sign => - Error_Msg_Scan - ("character %c can only be used in strings or comments", - +Source (Pos)); + Error_Bad_Character; Pos := Pos + 1; goto Again; when '@' => @@ -2269,9 +2274,7 @@ package body Scanner is Pos := Pos + 1; return; else - Error_Msg_Scan - ("character %c can only be used in strings or comments", - +Source (Pos)); + Error_Bad_Character; Pos := Pos + 1; goto Again; end if; |