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