psym_do.c revision 1.4
1/* $NetBSD: psym_do.c,v 1.4 2022/04/24 10:36:37 rillig Exp $ */ 2 3/* 4 * Tests for the parser symbol psym_do, which represents the state after 5 * reading the token 'do', now waiting for the statement of the loop body. 6 */ 7 8//indent input 9void function(void) { 10 do stmt(); while (0); 11 do {} while (0); 12} 13//indent end 14 15//indent run 16void 17function(void) 18{ 19 do 20 stmt(); 21 while (0); 22 do { 23 } while (0); 24} 25//indent end 26 27 28/* 29 * The keyword 'do' is followed by a statement, as opposed to 'while', which 30 * is followed by a parenthesized expression. 31 */ 32//indent input 33void 34function(void) 35{ 36 do(var)--;while(var>0); 37} 38//indent end 39 40//indent run 41void 42function(void) 43{ 44 do 45 (var)--; 46 while (var > 0); 47} 48//indent end 49