diff options
author | Brian Padalino <bpadalino@gmail.com> | 2021-09-23 01:44:59 -0400 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2021-09-24 07:29:46 +0200 |
commit | dfd094273e636fb275a7416a1c470d0b136e9362 (patch) | |
tree | c3381b2f291dd0edb6da5f2b77c049b265257241 /src/vhdl/vhdl-parse.adb | |
parent | a076bcb8121ea03b626447f5dace625415697600 (diff) | |
download | ghdl-dfd094273e636fb275a7416a1c470d0b136e9362.tar.gz ghdl-dfd094273e636fb275a7416a1c470d0b136e9362.tar.bz2 ghdl-dfd094273e636fb275a7416a1c470d0b136e9362.zip |
Add parsing of case? statement and simple test.
Also add the Matching flag to the Iir_Kind_Case_Statement.
Diffstat (limited to 'src/vhdl/vhdl-parse.adb')
-rw-r--r-- | src/vhdl/vhdl-parse.adb | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 0dbb227e9..7605da5f8 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -7624,15 +7624,15 @@ package body Vhdl.Parse is -- precond: CASE -- postcond: ';' -- - -- [ LRM93 8.8 ] + -- [ LRM08 10.9 ] -- case_statement ::= -- [ CASE_label : ] - -- CASE expression IS + -- CASE [?] expression IS -- case_statement_alternative -- { case_statement_alternative } - -- END CASE [ CASE_label ] ; + -- END CASE [?] [ CASE_label ] ; -- - -- [ LRM93 8.8 ] + -- [ LRM08 10.9] -- case_statement_alternative ::= WHEN choices => sequence_of_statements function Parse_Case_Statement (Label : Name_Id) return Iir is @@ -7648,6 +7648,17 @@ package body Vhdl.Parse is -- Skip 'case'. Scan; + if Flags.Vhdl_Std >= Vhdl_08 then + -- Check ? for matching case + if Current_Token = Tok_Question_Mark then + -- Skip ? + Scan; + -- Mark the case as matching case statement + Set_Matching_Flag (Stmt, True); + end if; + end if; + + -- Parse the Expression Set_Expression (Stmt, Parse_Case_Expression); -- Skip 'is'. @@ -7683,6 +7694,11 @@ package body Vhdl.Parse is Expect_Scan (Tok_End); Expect_Scan (Tok_Case); + if Get_Matching_Flag (Stmt) then + -- Matching case statement must match the ? + Expect_Scan (Tok_Question_Mark); + end if ; + if Flags.Vhdl_Std >= Vhdl_93 then Check_End_Name (Stmt); end if; |