aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-11-23 19:33:22 +0100
committerTristan Gingold <tgingold@free.fr>2018-11-23 19:33:22 +0100
commit1830a66709ad88f74832c6e92fc68f8e75d00089 (patch)
treef3af665387a68aab9e60fdfc3213936cd31f6ec8
parentff31a2e65dd43811570f550dfe25437e7f70023a (diff)
downloadghdl-1830a66709ad88f74832c6e92fc68f8e75d00089.tar.gz
ghdl-1830a66709ad88f74832c6e92fc68f8e75d00089.tar.bz2
ghdl-1830a66709ad88f74832c6e92fc68f8e75d00089.zip
parser: strenghten.
-rw-r--r--src/vhdl/parse.adb35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index d07d6b892..61b563498 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -1786,12 +1786,8 @@ package body Parse is
end case;
end loop;
- if Current_Token /= Tok_Right_Paren then
- Error_Msg_Parse ("')' expected at end of interface list");
- end if;
-
-- Skip ')'
- Scan;
+ Expect_Scan (Tok_Right_Paren, "')' expected at end of interface list");
return Res;
end Parse_Interface_List;
@@ -2642,10 +2638,9 @@ package body Parse is
Set_Identifier (El, Id);
Set_Resolution_Indication (El, Parse_Resolution_Indication);
Sub_Chain_Append (First, Last, El);
- exit when Current_Token = Tok_Right_Paren;
+ exit when Current_Token /= Tok_Comma;
-- Eat ','
- Expect (Tok_Comma);
Scan;
if Current_Token /= Tok_Identifier then
@@ -2667,8 +2662,7 @@ package body Parse is
end if;
-- Eat ')'
- Expect (Tok_Right_Paren);
- Scan;
+ Expect_Scan (Tok_Right_Paren);
return Def;
else
@@ -8869,11 +8863,19 @@ package body Parse is
-- The identifier was a label from an instantiation list.
List := Create_Iir_List;
Append_Element (List, El);
- loop
- Scan_Expect (Tok_Identifier);
- Append_Element (List, Current_Text);
+ while Current_Token = Tok_Comma loop
+ -- Skip ','.
Scan;
- exit when Current_Token /= Tok_Comma;
+
+ if Current_Token = Tok_Identifier then
+ Append_Element (List, Current_Text);
+
+ -- Skip identifier.
+ Scan;
+ else
+ Expect (Tok_Identifier);
+ exit;
+ end if;
end loop;
Flist := List_To_Flist (List);
return Parse_Component_Configuration (Loc, Flist);
@@ -9362,10 +9364,7 @@ package body Parse is
First := Ref;
Last := Ref;
- loop
- exit when Current_Token = Tok_Semi_Colon;
- Expect (Tok_Comma);
-
+ while Current_Token = Tok_Comma loop
-- Skip ','.
Scan;
@@ -9377,6 +9376,8 @@ package body Parse is
Last := Ref;
end loop;
+ Expect (Tok_Semi_Colon);
+
return First;
end Parse_Context_Reference;