1 1.5 rillig /* $NetBSD: psym_if_expr.c,v 1.5 2023/06/10 17:56:29 rillig Exp $ */ 2 1.1 rillig 3 1.1 rillig /* 4 1.1 rillig * Tests for the parser symbol psym_if_expr, representing the parser state 5 1.1 rillig * after reading the keyword 'if' and the controlling expression, now waiting 6 1.1 rillig * for the statement of the 'then' branch. 7 1.1 rillig */ 8 1.1 rillig 9 1.4 rillig //indent input 10 1.3 rillig void function(void) { 11 1.3 rillig if(cond) stmt(); 12 1.3 rillig } 13 1.4 rillig //indent end 14 1.1 rillig 15 1.4 rillig //indent run 16 1.3 rillig void 17 1.3 rillig function(void) 18 1.3 rillig { 19 1.3 rillig if (cond) 20 1.3 rillig stmt(); 21 1.3 rillig } 22 1.4 rillig //indent end 23 1.5 rillig 24 1.5 rillig 25 1.5 rillig /* 26 1.5 rillig * Indent is forgiving about syntax errors such as an 'if' statement in which 27 1.5 rillig * the condition is not parenthesized. 28 1.5 rillig */ 29 1.5 rillig //indent input 30 1.5 rillig { 31 1.5 rillig if cond { 32 1.5 rillig } 33 1.5 rillig if cond && cond { 34 1.5 rillig } 35 1.5 rillig } 36 1.5 rillig //indent end 37 1.5 rillig 38 1.5 rillig //indent run 39 1.5 rillig { 40 1.5 rillig if cond { 41 1.5 rillig } 42 1.5 rillig if cond 43 1.5 rillig && cond { 44 1.5 rillig } 45 1.5 rillig } 46 1.5 rillig //indent end 47