Home | History | Annotate | Line # | Download | only in indent
      1 /* $NetBSD: psym_do.c,v 1.5 2023/06/05 08:10:25 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  * See also:
      8  *	lsym_do.c
      9  *	psym_do_stmt.c
     10  */
     11 
     12 //indent input
     13 void function(void) {
     14 	do stmt(); while (0);
     15 	do {} while (0);
     16 }
     17 //indent end
     18 
     19 //indent run
     20 void
     21 function(void)
     22 {
     23 	do
     24 		stmt();
     25 	while (0);
     26 	do {
     27 	} while (0);
     28 }
     29 //indent end
     30 
     31 
     32 /*
     33  * The keyword 'do' is followed by a statement, as opposed to 'while', which
     34  * is followed by a parenthesized expression.
     35  */
     36 //indent input
     37 void
     38 function(void)
     39 {
     40 	do(var)--;while(var>0);
     41 }
     42 //indent end
     43 
     44 //indent run
     45 void
     46 function(void)
     47 {
     48 	do
     49 		(var)--;
     50 	while (var > 0);
     51 }
     52 //indent end
     53