aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-11-16 20:23:52 +0100
committerTristan Gingold <tgingold@free.fr>2018-11-16 20:23:52 +0100
commit6beee7bc311f67f20297b32dba8c5f419faa5341 (patch)
tree6f92733641c4a785738a3f4e5b2ded41b7253bfd /src
parentbef801a0ac1f46f40e56b38c8860689d379b72ea (diff)
downloadghdl-6beee7bc311f67f20297b32dba8c5f419faa5341.tar.gz
ghdl-6beee7bc311f67f20297b32dba8c5f419faa5341.tar.bz2
ghdl-6beee7bc311f67f20297b32dba8c5f419faa5341.zip
parse: strenghten.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/parse.adb38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index b4f4f9094..04db4c777 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -3904,8 +3904,13 @@ package body Parse is
Res := Create_Iir (Iir_Kind_Group_Template_Declaration);
Set_Location (Res, Loc);
Set_Identifier (Res, Ident);
- Scan_Expect (Tok_Left_Paren);
+
+ -- Skip 'is'.
Scan;
+
+ -- Skip '('.
+ Expect_Scan (Tok_Left_Paren);
+
Build_Init (Last);
loop
Append (Last, Res, Parse_Entity_Class_Entry);
@@ -3914,18 +3919,25 @@ package body Parse is
Set_Location (El);
Set_Entity_Class (El, Tok_Box);
Append (Last, Res, El);
+
+ -- Skip '<>'.
Scan;
+
if Current_Token = Tok_Comma then
Error_Msg_Parse
("'<>' is allowed only for the last "
& "entity class entry");
end if;
end if;
- exit when Current_Token = Tok_Right_Paren;
- Expect (Tok_Comma);
+ exit when Current_Token /= Tok_Comma;
+
+ -- Skip ','.
Scan;
end loop;
- Scan_Expect (Tok_Semi_Colon);
+
+ -- Skip ')' ';'
+ Expect_Scan (Tok_Right_Paren);
+ Expect (Tok_Semi_Colon);
return Res;
end;
when Tok_Colon =>
@@ -3944,20 +3956,20 @@ package body Parse is
(Res, Parse_Name (Allow_Indexes => False));
-- Skip '('.
- Expect (Tok_Left_Paren);
- Scan;
+ Expect_Scan (Tok_Left_Paren);
+
List := Create_Iir_List;
loop
Append_Element (List, Parse_Name (Allow_Indexes => False));
- exit when Current_Token = Tok_Right_Paren;
+ exit when Current_Token /= Tok_Comma;
-- Skip ','.
- Expect (Tok_Comma);
Scan;
end loop;
- -- Skip ')'.
- Scan_Expect (Tok_Semi_Colon);
+ -- Skip ')' ';'.
+ Expect_Scan (Tok_Right_Paren);
+ Expect (Tok_Semi_Colon);
Set_Group_Constituent_List (Res, List_To_Flist (List));
return Res;
@@ -8560,8 +8572,12 @@ package body Parse is
exit when Current_Token /= Tok_Comma;
-- Skip ','.
- Expect (Tok_Comma);
Scan;
+
+ if Current_Token /= Tok_Identifier then
+ Expect (Tok_Identifier);
+ exit;
+ end if;
end loop;
return List_To_Flist (Res);