summaryrefslogtreecommitdiff
path: root/tests/usr.bin/indent/psym_if_expr.c
blob: fc2f06da1c8250b3bfd9bf4b56c17fe648b38e9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* $NetBSD: psym_if_expr.c,v 1.5 2023/06/10 17:56:29 rillig Exp $ */

/*
 * Tests for the parser symbol psym_if_expr, representing the parser state
 * after reading the keyword 'if' and the controlling expression, now waiting
 * for the statement of the 'then' branch.
 */

//indent input
void function(void) {
	if(cond) stmt();
}
//indent end

//indent run
void
function(void)
{
	if (cond)
		stmt();
}
//indent end


/*
 * Indent is forgiving about syntax errors such as an 'if' statement in which
 * the condition is not parenthesized.
 */
//indent input
{
	if cond {
	}
	if cond && cond {
	}
}
//indent end

//indent run
{
	if cond {
	}
	if cond
		&& cond {
		}
}
//indent end