lsym_while.c revision 1.6.2.1 1 /* $NetBSD: lsym_while.c,v 1.6.2.1 2025/08/02 05:58:13 perseant Exp $ */
2
3 /*
4 * Tests for the token 'lsym_while', which represents the keyword 'while' that
5 * starts a 'while' loop or finishes a 'do-while' loop.
6 */
7
8 //indent input
9 void
10 function(void)
11 {
12 while(cond)stmt();
13 do stmt();while(cond);
14 }
15 //indent end
16
17 //indent run
18 void
19 function(void)
20 {
21 while (cond)
22 stmt();
23 do
24 stmt();
25 while (cond);
26 }
27 //indent end
28
29
30 /*
31 * The keyword 'while' must only be indented if it follows a psym_do_stmt,
32 * otherwise it starts a new statement and must start a new line.
33 */
34 //indent input
35 void
36 function(void)
37 {
38 {} while (0);
39 }
40 //indent end
41
42 //indent run
43 void
44 function(void)
45 {
46 {
47 }
48 while (0)
49 ;
50 }
51 //indent end
52