aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-formatters.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-09 18:20:14 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-09 18:20:14 +0100
commitdd4003d099f2acb8510ded0a71ea668372f58f2f (patch)
tree585a7395456bc828c46de7fdc96cbe27664ab13c /src/vhdl/vhdl-formatters.adb
parent266a237f7708bf57638a9973a8a6757ca28b4d80 (diff)
downloadghdl-dd4003d099f2acb8510ded0a71ea668372f58f2f.tar.gz
ghdl-dd4003d099f2acb8510ded0a71ea668372f58f2f.tar.bz2
ghdl-dd4003d099f2acb8510ded0a71ea668372f58f2f.zip
vhdl-formatters: minor refactoring.
Diffstat (limited to 'src/vhdl/vhdl-formatters.adb')
-rw-r--r--src/vhdl/vhdl-formatters.adb45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/vhdl/vhdl-formatters.adb b/src/vhdl/vhdl-formatters.adb
index 807436033..a12c889d4 100644
--- a/src/vhdl/vhdl-formatters.adb
+++ b/src/vhdl/vhdl-formatters.adb
@@ -29,32 +29,39 @@ package body Vhdl.Formatters is
-- cases.
procedure Check_Token (Tok : Token_Type) is
begin
- -- There are a couple of exceptions due to attributes or
- -- PSL.
+ if Tok = Current_Token then
+ return;
+ end if;
+
+ -- There are a couple of exceptions.
+ -- Range and Subtype are considered as identifiers when used as
+ -- attributes.
if Tok = Tok_Identifier
and then (Current_Token = Tok_Range
or else Current_Token = Tok_Subtype)
then
- null;
- elsif (Tok = Tok_Default
- or else Tok = Tok_Psl_Clock)
+ return;
+ end if;
+
+ -- 'default clock' are considered as identifiers.
+ if (Tok = Tok_Default or else Tok = Tok_Psl_Clock)
and then Current_Token = Tok_Identifier
then
- null;
- elsif Tok /= Current_Token then
- declare
- use Simple_IO;
- begin
- Put_Line_Err ("error: token mismatch. ");
- Put_Err (" need to print: ");
- Put_Err (Image (Tok));
- Put_Err (", but read ");
- Put_Err (Image (Current_Token));
- Put_Err (" from file.");
- New_Line_Err;
- end;
- raise Internal_Error;
+ return;
end if;
+
+ declare
+ use Simple_IO;
+ begin
+ Put_Line_Err ("error: token mismatch. ");
+ Put_Err (" need to print: ");
+ Put_Err (Image (Tok));
+ Put_Err (", but read ");
+ Put_Err (Image (Current_Token));
+ Put_Err (" from file.");
+ New_Line_Err;
+ end;
+ raise Internal_Error;
end Check_Token;
package Format_Disp_Ctxt is