xref: /netbsd-src/tests/usr.bin/indent/psym_decl.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /* $NetBSD: psym_decl.c,v 1.4 2022/04/24 10:36:37 rillig Exp $ */
2 
3 /*
4  * Tests for the parser symbol psym_decl, which represents a declaration.
5  *
6  * Since C99, declarations and statements can be mixed in blocks.
7  *
8  * A label can be followed by a statement but not by a declaration.
9  *
10  * Indent distinguishes global and local declarations.
11  *
12  * Declarations can be for functions or for variables.
13  */
14 
15 // TODO: prove that psym_decl can only ever occur at the top of the stack.
16 // TODO: delete decl_level if the above is proven.
17 
18 //indent input
19 int global_var;
20 int global_array = [1,2,3,4];
21 int global_array = [
22 1
23 ,2,
24 3,
25 4,
26 ];
27 //indent end
28 
29 //indent run -di0
30 int global_var;
31 int global_array = [1, 2, 3, 4];
32 int global_array = [
33 		    1
34 		    ,2,
35 		    3,
36 		    4,
37 ];
38 //indent end
39