psym_decl.c revision 1.4
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
19int global_var;
20int global_array = [1,2,3,4];
21int global_array = [
221
23,2,
243,
254,
26];
27//indent end
28
29//indent run -di0
30int global_var;
31int global_array = [1, 2, 3, 4];
32int global_array = [
33		    1
34		    ,2,
35		    3,
36		    4,
37];
38//indent end
39