summaryrefslogtreecommitdiffstats
path: root/src/kash/generated/nodes.h
blob: 324fcbe911616b3108475e671457db7d56a82b07 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
 * This file was generated by mknodes.sh
 */

#define NSEMI 0
#define NCMD 1
#define NPIPE 2
#define NREDIR 3
#define NBACKGND 4
#define NSUBSHELL 5
#define NAND 6
#define NOR 7
#define NIF 8
#define NWHILE 9
#define NUNTIL 10
#define NFOR 11
#define NCASE 12
#define NCLIST 13
#define NDEFUN 14
#define NARG 15
#define NTO 16
#define NCLOBBER 17
#define NFROM 18
#define NFROMTO 19
#define NAPPEND 20
#define NTOFD 21
#define NFROMFD 22
#define NHERE 23
#define NXHERE 24
#define NNOT 25



struct nbinary {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *ch1;
	union node *ch2;
};


struct ncmd {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	int backgnd;
	union node *args;
	union node *redirect;
};


struct npipe {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	int backgnd;
	struct nodelist *cmdlist;
};


struct nredir {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *n;
	union node *redirect;
};


struct nif {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *test;
	union node *ifpart;
	union node *elsepart;
};


struct nfor {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *args;
	union node *body;
	char *var;
};


struct ncase {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *expr;
	union node *cases;
};


struct nclist {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *next;
	union node *pattern;
	union node *body;
};


struct narg {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *next;
	char *text;
	struct nodelist *backquote;
};


struct nfile {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	int fd;
	union node *next;
	union node *fname;
};


struct ndup {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	int fd;
	union node *next;
	int dupfd;
	union node *vname;
};


struct nhere {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	int fd;
	union node *next;
	union node *doc;
};


struct nnot {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
	struct pstack_block *pblock;
#endif
	int type;
	union node *com;
};


union node {
#ifdef KASH_SEPARATE_PARSER_ALLOCATOR
# ifdef __GNUC__
	__extension__
# endif
	struct {
		struct pstack_block *pblock;
		int type;
	};
#else
	int type;
#endif
	struct nbinary nbinary;
	struct ncmd ncmd;
	struct npipe npipe;
	struct nredir nredir;
	struct nif nif;
	struct nfor nfor;
	struct ncase ncase;
	struct nclist nclist;
	struct narg narg;
	struct nfile nfile;
	struct ndup ndup;
	struct nhere nhere;
	struct nnot nnot;
};


struct nodelist {
	struct nodelist *next;
	union node *n;
};


union node *copyfunc(struct shinstance *, union node *);
void freefunc(struct shinstance *, union node *);