1 1.5 rillig /* $NetBSD: psym_do_stmt.c,v 1.5 2025/01/07 03:55:00 rillig Exp $ */ 2 1.1 rillig 3 1.1 rillig /* 4 1.1 rillig * Tests for the parser symbol psym_do_stmt, which represents the state after 5 1.1 rillig * reading the keyword 'do' and the loop body, now waiting for the keyword 6 1.1 rillig * 'while' and the controlling expression. 7 1.1 rillig */ 8 1.1 rillig 9 1.3 rillig //indent input 10 1.4 rillig void function(void) { 11 1.4 rillig do stmt(); while (0); 12 1.4 rillig do { stmt(); } while (0); 13 1.4 rillig do /* comment */ stmt(); while (0); 14 1.4 rillig } 15 1.3 rillig //indent end 16 1.1 rillig 17 1.4 rillig //indent run 18 1.4 rillig void 19 1.4 rillig function(void) 20 1.4 rillig { 21 1.4 rillig do 22 1.4 rillig stmt(); 23 1.4 rillig while (0); 24 1.4 rillig do { 25 1.4 rillig stmt(); 26 1.4 rillig } while (0); 27 1.4 rillig do /* comment */ 28 1.4 rillig stmt(); 29 1.4 rillig while (0); 30 1.4 rillig } 31 1.4 rillig //indent end 32 1.5 rillig 33 1.5 rillig 34 1.5 rillig //indent input 35 1.5 rillig { 36 1.5 rillig if (cond) do stmt; while (cond); stmt; 37 1.5 rillig } 38 1.5 rillig //indent end 39 1.5 rillig 40 1.5 rillig //indent run 41 1.5 rillig { 42 1.5 rillig if (cond) 43 1.5 rillig do 44 1.5 rillig stmt; 45 1.5 rillig while (cond); 46 1.5 rillig //$ Ensure that this statement is indented the same as the 'if' above. 47 1.5 rillig stmt; 48 1.5 rillig } 49 1.5 rillig //indent end 50