xref: /netbsd-src/tests/usr.bin/indent/psym_if_expr_stmt.c (revision ccd9df534e375a4366c5b55f23782053c7a98d82)
1 /* $NetBSD: psym_if_expr_stmt.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
2 
3 /*
4  * Tests for the parser symbol psym_if_expr_stmt, which represents the state
5  * after reading the keyword 'if', the controlling expression and the
6  * statement for the 'then' branch.
7  *
8  * At this point, the 'if' statement is not necessarily complete, it can be
9  * completed with the keyword 'else' followed by a statement.
10  *
11  * Any token other than 'else' completes the 'if' statement.
12  */
13 
14 //indent input
15 void
16 function(void)
17 {
18 	if (cond)
19 		stmt();
20 	if (cond)
21 		stmt();
22 	else			/* belongs to the second 'if' */
23 		stmt();
24 }
25 //indent end
26 
27 //indent run-equals-input
28