Home | History | Annotate | Line # | Download | only in indent
psym_while_expr.c revision 1.3
      1 /* $NetBSD: psym_while_expr.c,v 1.3 2022/04/22 21:21:20 rillig Exp $ */
      2 
      3 /*
      4  * Tests for the parser symbol psym_while_expr, which represents the keyword
      5  * 'while' followed by the controlling expression, now waiting for the
      6  * statement of the loop body.
      7  */
      8 
      9 #indent input
     10 // TODO: add input
     11 #indent end
     12 
     13 #indent run-equals-input
     14 
     15 
     16 #indent input
     17 void
     18 function(void)
     19 {
     20 	while(cond){}
     21 
     22 	do{}while(cond);
     23 
     24 	if(cmd)while(cond);
     25 
     26 	{}while(cond);
     27 }
     28 #indent end
     29 
     30 #indent run
     31 void
     32 function(void)
     33 {
     34 	while (cond) {
     35 	}
     36 
     37 	do {
     38 	} while (cond);
     39 
     40 	if (cmd)
     41 	/* $ XXX: Where does the code say that ';' stays on the same line? */
     42 		while (cond);
     43 
     44 	{
     45 	/* $ FIXME: the '}' must be on a line of its own. */
     46 	} while (cond);
     47 }
     48 #indent end
     49