unsigned ExitLabel; /* Exit label */
unsigned SwitchCodeLabel;/* Label for the switch code */
int HaveBreak = 0; /* True if the last statement had a break */
+ int RCurlyBrace; /* True if last token is right curly brace */
SwitchCtrl* OldSwitch; /* Pointer to old switch control data */
SwitchCtrl SwitchData; /* New switch data */
/* Parse the following statement, which will actually be a compound
* statement because of the curly brace at the current input position
*/
- HaveBreak = Statement (0);
+ HaveBreak = Statement (&RCurlyBrace);
/* Check if we had any labels */
if (CollCount (SwitchData.Nodes) == 0 && SwitchData.DefaultLabel == 0) {
/* Define the exit label */
g_defcodelabel (ExitLabel);
-
+
/* Exit the loop */
DelLoop ();
/* Free the case value tree */
FreeCaseNodeColl (SwitchData.Nodes);
+
+ /* If the case statement was (correctly) terminated by a closing curly
+ * brace, skip it now.
+ */
+ if (RCurlyBrace) {
+ NextToken ();
+ }
}