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