This patch improves the synactic error recovery in the case where a ";" is used instead of "," in a case expression. The following test should get these errors:
case_exp_semi.ads:5:28: ";" should be "," package Case_Exp_Semi is X : Integer := 1; Y : Integer := (case X is when 1 => 1; when 2 => 2, when others => 3); end Case_Exp_Semi; Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Bob Duff <d...@adacore.com> * par-ch4.adb (P_Case_Expression): If a semicolon is followed by "when", assume that ";" was meant to be ",".
Index: par-ch4.adb =================================================================== --- par-ch4.adb (revision 247135) +++ par-ch4.adb (working copy) @@ -3199,6 +3199,20 @@ if Token = Tok_When then T_Comma; + -- A semicolon followed by "when" is probably meant to be a comma + + elsif Token = Tok_Semicolon then + Save_Scan_State (Save_State); + Scan; -- past the semicolon + + if Token /= Tok_When then + Restore_Scan_State (Save_State); + exit; + end if; + + Error_Msg_SP -- CODEFIX + ("|"";"" should be "","""); + -- If comma/WHEN, skip comma and we have another alternative elsif Token = Tok_Comma then