Home | History | Annotate | Line # | Download | only in indent
      1 /* $NetBSD: psym_if_expr.c,v 1.5 2023/06/10 17:56:29 rillig Exp $ */
      2 
      3 /*
      4  * Tests for the parser symbol psym_if_expr, representing the parser state
      5  * after reading the keyword 'if' and the controlling expression, now waiting
      6  * for the statement of the 'then' branch.
      7  */
      8 
      9 //indent input
     10 void function(void) {
     11 	if(cond) stmt();
     12 }
     13 //indent end
     14 
     15 //indent run
     16 void
     17 function(void)
     18 {
     19 	if (cond)
     20 		stmt();
     21 }
     22 //indent end
     23 
     24 
     25 /*
     26  * Indent is forgiving about syntax errors such as an 'if' statement in which
     27  * the condition is not parenthesized.
     28  */
     29 //indent input
     30 {
     31 	if cond {
     32 	}
     33 	if cond && cond {
     34 	}
     35 }
     36 //indent end
     37 
     38 //indent run
     39 {
     40 	if cond {
     41 	}
     42 	if cond
     43 		&& cond {
     44 		}
     45 }
     46 //indent end
     47