1 /* $NetBSD: psym_switch_expr.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */ 2 3 /* 4 * Tests for the parser symbol psym_switch_expr, which represents the keyword 5 * 'switch' followed by the controlling expression, now waiting for a 6 * statement (usually a block) containing the 'case' labels. 7 */ 8 9 //indent input 10 // TODO: add input 11 //indent end 12 13 //indent run-equals-input 14 15 16 /* 17 * In all practical cases, a 'switch (expr)' is followed by a block, but the 18 * C syntax allows an arbitrary statement. Unless such a statement has a 19 * label, it is unreachable. 20 */ 21 //indent input 22 void 23 function(void) 24 { 25 switch (expr) 26 if (cond) { 27 case 1: return; 28 case 2: break; 29 } 30 } 31 //indent end 32 33 //indent run 34 void 35 function(void) 36 { 37 switch (expr) 38 if (cond) { 39 case 1: 40 return; 41 case 2: 42 break; 43 } 44 } 45 //indent end 46