btyacc_demo.tab.c revision 1.7 1 1.5 christos /* $NetBSD: btyacc_demo.tab.c,v 1.7 2026/01/18 16:41:29 christos Exp $ */
2 1.1 christos
3 1.1 christos /* original parser id follows */
4 1.1 christos /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
5 1.2 christos /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
6 1.1 christos
7 1.1 christos #define YYBYACC 1
8 1.5 christos #define YYMAJOR 2
9 1.5 christos #define YYMINOR 0
10 1.1 christos #define YYCHECK "yyyymmdd"
11 1.1 christos
12 1.1 christos #define YYEMPTY (-1)
13 1.1 christos #define yyclearin (yychar = YYEMPTY)
14 1.1 christos #define yyerrok (yyerrflag = 0)
15 1.1 christos #define YYRECOVERING() (yyerrflag != 0)
16 1.1 christos #define YYENOMEM (-2)
17 1.1 christos #define YYEOF 0
18 1.1 christos #undef YYBTYACC
19 1.1 christos #define YYBTYACC 1
20 1.1 christos #define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
21 1.1 christos
22 1.1 christos #ifndef yyparse
23 1.1 christos #define yyparse demo_parse
24 1.1 christos #endif /* yyparse */
25 1.1 christos
26 1.1 christos #ifndef yylex
27 1.1 christos #define yylex demo_lex
28 1.1 christos #endif /* yylex */
29 1.1 christos
30 1.1 christos #ifndef yyerror
31 1.1 christos #define yyerror demo_error
32 1.1 christos #endif /* yyerror */
33 1.1 christos
34 1.1 christos #ifndef yychar
35 1.1 christos #define yychar demo_char
36 1.1 christos #endif /* yychar */
37 1.1 christos
38 1.1 christos #ifndef yyval
39 1.1 christos #define yyval demo_val
40 1.1 christos #endif /* yyval */
41 1.1 christos
42 1.1 christos #ifndef yylval
43 1.1 christos #define yylval demo_lval
44 1.1 christos #endif /* yylval */
45 1.1 christos
46 1.1 christos #ifndef yydebug
47 1.1 christos #define yydebug demo_debug
48 1.1 christos #endif /* yydebug */
49 1.1 christos
50 1.1 christos #ifndef yynerrs
51 1.1 christos #define yynerrs demo_nerrs
52 1.1 christos #endif /* yynerrs */
53 1.1 christos
54 1.1 christos #ifndef yyerrflag
55 1.1 christos #define yyerrflag demo_errflag
56 1.1 christos #endif /* yyerrflag */
57 1.1 christos
58 1.1 christos #ifndef yylhs
59 1.1 christos #define yylhs demo_lhs
60 1.1 christos #endif /* yylhs */
61 1.1 christos
62 1.1 christos #ifndef yylen
63 1.1 christos #define yylen demo_len
64 1.1 christos #endif /* yylen */
65 1.1 christos
66 1.1 christos #ifndef yydefred
67 1.1 christos #define yydefred demo_defred
68 1.1 christos #endif /* yydefred */
69 1.1 christos
70 1.1 christos #ifndef yystos
71 1.1 christos #define yystos demo_stos
72 1.1 christos #endif /* yystos */
73 1.1 christos
74 1.1 christos #ifndef yydgoto
75 1.1 christos #define yydgoto demo_dgoto
76 1.1 christos #endif /* yydgoto */
77 1.1 christos
78 1.1 christos #ifndef yysindex
79 1.1 christos #define yysindex demo_sindex
80 1.1 christos #endif /* yysindex */
81 1.1 christos
82 1.1 christos #ifndef yyrindex
83 1.1 christos #define yyrindex demo_rindex
84 1.1 christos #endif /* yyrindex */
85 1.1 christos
86 1.1 christos #ifndef yygindex
87 1.1 christos #define yygindex demo_gindex
88 1.1 christos #endif /* yygindex */
89 1.1 christos
90 1.1 christos #ifndef yytable
91 1.1 christos #define yytable demo_table
92 1.1 christos #endif /* yytable */
93 1.1 christos
94 1.1 christos #ifndef yycheck
95 1.1 christos #define yycheck demo_check
96 1.1 christos #endif /* yycheck */
97 1.1 christos
98 1.1 christos #ifndef yyname
99 1.1 christos #define yyname demo_name
100 1.1 christos #endif /* yyname */
101 1.1 christos
102 1.1 christos #ifndef yyrule
103 1.1 christos #define yyrule demo_rule
104 1.1 christos #endif /* yyrule */
105 1.1 christos
106 1.1 christos #ifndef yyloc
107 1.1 christos #define yyloc demo_loc
108 1.1 christos #endif /* yyloc */
109 1.1 christos
110 1.1 christos #ifndef yylloc
111 1.1 christos #define yylloc demo_lloc
112 1.1 christos #endif /* yylloc */
113 1.1 christos
114 1.1 christos #if YYBTYACC
115 1.1 christos
116 1.1 christos #ifndef yycindex
117 1.1 christos #define yycindex demo_cindex
118 1.1 christos #endif /* yycindex */
119 1.1 christos
120 1.1 christos #ifndef yyctable
121 1.1 christos #define yyctable demo_ctable
122 1.1 christos #endif /* yyctable */
123 1.1 christos
124 1.1 christos #endif /* YYBTYACC */
125 1.1 christos
126 1.1 christos #define YYPREFIX "demo_"
127 1.1 christos
128 1.1 christos #define YYPURE 0
129 1.1 christos
130 1.1 christos #line 15 "btyacc_demo.y"
131 1.1 christos /* dummy types just for compile check */
132 1.1 christos typedef int Code;
133 1.1 christos typedef int Decl_List;
134 1.1 christos typedef int Expr;
135 1.1 christos typedef int Expr_List;
136 1.1 christos typedef int Scope;
137 1.1 christos typedef int Type;
138 1.1 christos enum Operator { ADD, SUB, MUL, MOD, DIV, DEREF };
139 1.1 christos
140 1.7 christos typedef unsigned char mybool;
141 1.1 christos typedef struct Decl {
142 1.1 christos Scope *scope;
143 1.1 christos Type *type;
144 1.7 christos mybool (*istype)(void);
145 1.1 christos } Decl;
146 1.1 christos
147 1.1 christos #include "btyacc_demo.tab.h"
148 1.1 christos #include <stdlib.h>
149 1.1 christos #include <stdio.h>
150 1.1 christos #ifdef YYSTYPE
151 1.1 christos #undef YYSTYPE_IS_DECLARED
152 1.1 christos #define YYSTYPE_IS_DECLARED 1
153 1.1 christos #endif
154 1.1 christos #ifndef YYSTYPE_IS_DECLARED
155 1.1 christos #define YYSTYPE_IS_DECLARED 1
156 1.2 christos #line 36 "btyacc_demo.y"
157 1.6 christos typedef union YYSTYPE {
158 1.1 christos Scope *scope;
159 1.1 christos Expr *expr;
160 1.1 christos Expr_List *elist;
161 1.1 christos Type *type;
162 1.1 christos Decl *decl;
163 1.1 christos Decl_List *dlist;
164 1.1 christos Code *code;
165 1.1 christos char *id;
166 1.1 christos } YYSTYPE;
167 1.1 christos #endif /* !YYSTYPE_IS_DECLARED */
168 1.1 christos #line 167 "btyacc_demo.tab.c"
169 1.1 christos
170 1.1 christos #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
171 1.1 christos /* Default: YYLTYPE is the text position type. */
172 1.1 christos typedef struct YYLTYPE
173 1.1 christos {
174 1.1 christos int first_line;
175 1.1 christos int first_column;
176 1.1 christos int last_line;
177 1.1 christos int last_column;
178 1.2 christos unsigned source;
179 1.1 christos } YYLTYPE;
180 1.1 christos #define YYLTYPE_IS_DECLARED 1
181 1.1 christos #endif
182 1.2 christos #define YYRHSLOC(rhs, k) ((rhs)[k])
183 1.1 christos
184 1.1 christos /* compatibility with bison */
185 1.1 christos #ifdef YYPARSE_PARAM
186 1.1 christos /* compatibility with FreeBSD */
187 1.1 christos # ifdef YYPARSE_PARAM_TYPE
188 1.1 christos # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
189 1.1 christos # else
190 1.1 christos # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
191 1.1 christos # endif
192 1.1 christos #else
193 1.1 christos # define YYPARSE_DECL() yyparse(void)
194 1.1 christos #endif
195 1.1 christos
196 1.1 christos /* Parameters sent to lex. */
197 1.1 christos #ifdef YYLEX_PARAM
198 1.1 christos # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
199 1.1 christos # define YYLEX yylex(YYLEX_PARAM)
200 1.1 christos #else
201 1.1 christos # define YYLEX_DECL() yylex(void)
202 1.1 christos # define YYLEX yylex()
203 1.1 christos #endif
204 1.1 christos
205 1.1 christos /* Parameters sent to yyerror. */
206 1.1 christos #ifndef YYERROR_DECL
207 1.2 christos #define YYERROR_DECL() yyerror(YYLTYPE *loc, const char *s)
208 1.1 christos #endif
209 1.1 christos #ifndef YYERROR_CALL
210 1.2 christos #define YYERROR_CALL(msg) yyerror(&yylloc, msg)
211 1.1 christos #endif
212 1.1 christos
213 1.1 christos #ifndef YYDESTRUCT_DECL
214 1.1 christos #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)
215 1.1 christos #endif
216 1.1 christos #ifndef YYDESTRUCT_CALL
217 1.1 christos #define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)
218 1.1 christos #endif
219 1.1 christos
220 1.1 christos extern int YYPARSE_DECL();
221 1.1 christos
222 1.1 christos #define PREFIX 257
223 1.1 christos #define POSTFIX 258
224 1.1 christos #define ID 259
225 1.1 christos #define CONSTANT 260
226 1.1 christos #define EXTERN 261
227 1.1 christos #define REGISTER 262
228 1.1 christos #define STATIC 263
229 1.1 christos #define CONST 264
230 1.1 christos #define VOLATILE 265
231 1.1 christos #define IF 266
232 1.1 christos #define THEN 267
233 1.1 christos #define ELSE 268
234 1.1 christos #define CLCL 269
235 1.1 christos #define YYERRCODE 256
236 1.6 christos typedef int YYINT;
237 1.1 christos static const YYINT demo_lhs[] = { -1,
238 1.2 christos 15, 15, 15, 12, 18, 0, 4, 19, 4, 2,
239 1.2 christos 20, 2, 10, 10, 13, 13, 11, 11, 11, 11,
240 1.2 christos 11, 14, 14, 21, 22, 3, 3, 8, 8, 23,
241 1.2 christos 24, 8, 8, 8, 8, 16, 16, 17, 17, 9,
242 1.2 christos 1, 1, 1, 1, 1, 1, 1, 1, 5, 5,
243 1.2 christos 25, 26, 5, 5, 27, 5, 6, 6, 7,
244 1.1 christos };
245 1.1 christos static const YYINT demo_len[] = { 2,
246 1.2 christos 0, 1, 3, 2, 0, 2, 0, 0, 3, 3,
247 1.2 christos 0, 4, 1, 3, 0, 2, 1, 1, 1, 1,
248 1.2 christos 1, 1, 1, 0, 0, 5, 1, 0, 1, 0,
249 1.2 christos 0, 5, 5, 5, 6, 0, 1, 4, 1, 2,
250 1.2 christos 4, 4, 4, 4, 4, 3, 1, 1, 1, 2,
251 1.2 christos 0, 0, 11, 8, 0, 2, 0, 3, 4,
252 1.1 christos };
253 1.1 christos static const YYINT demo_defred[] = { 5,
254 1.2 christos 0, 7, 0, 0, 19, 20, 21, 22, 23, 2,
255 1.2 christos 9, 0, 13, 18, 17, 0, 15, 30, 29, 0,
256 1.2 christos 0, 0, 0, 0, 31, 10, 24, 24, 24, 0,
257 1.2 christos 14, 3, 16, 25, 0, 25, 0, 0, 8, 12,
258 1.2 christos 0, 0, 0, 39, 0, 0, 0, 8, 47, 48,
259 1.2 christos 0, 57, 0, 32, 0, 0, 15, 30, 0, 30,
260 1.2 christos 30, 30, 30, 30, 34, 0, 0, 0, 46, 0,
261 1.2 christos 0, 0, 0, 0, 59, 0, 38, 0, 0, 43,
262 1.2 christos 45, 44, 0, 0, 49, 58, 0, 30, 50, 56,
263 1.2 christos 0, 0, 0, 51, 0, 0, 52, 0, 53,
264 1.1 christos };
265 1.2 christos #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
266 1.1 christos static const YYINT demo_stos[] = { 0,
267 1.1 christos 271, 289, 275, 290, 261, 262, 263, 264, 265, 269,
268 1.2 christos 273, 281, 282, 283, 285, 286, 42, 40, 259, 274,
269 1.2 christos 279, 290, 259, 284, 294, 59, 44, 40, 91, 291,
270 1.2 christos 282, 269, 285, 292, 295, 292, 292, 292, 123, 278,
271 1.2 christos 293, 279, 293, 280, 281, 287, 288, 42, 259, 260,
272 1.2 christos 272, 290, 279, 41, 279, 279, 41, 44, 290, 43,
273 1.2 christos 45, 42, 47, 37, 93, 277, 284, 294, 272, 294,
274 1.2 christos 294, 294, 294, 294, 125, 290, 280, 272, 272, 272,
275 1.2 christos 272, 272, 266, 272, 273, 276, 298, 40, 59, 278,
276 1.2 christos 294, 272, 41, 267, 296, 276, 268, 297, 276,
277 1.1 christos };
278 1.2 christos #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
279 1.1 christos static const YYINT demo_dgoto[] = { 1,
280 1.2 christos 84, 85, 20, 3, 86, 66, 40, 21, 44, 12,
281 1.2 christos 13, 14, 24, 15, 16, 46, 47, 2, 22, 30,
282 1.2 christos 34, 41, 25, 35, 95, 98, 87,
283 1.1 christos };
284 1.1 christos static const YYINT demo_sindex[] = { 0,
285 1.2 christos 0, 0, 0, -103, 0, 0, 0, 0, 0, 0,
286 1.2 christos 0, -31, 0, 0, 0, -238, 0, 0, 0, 4,
287 1.2 christos -36, -103, 0, -133, 0, 0, 0, 0, 0, -94,
288 1.2 christos 0, 0, 0, 0, -40, 0, -103, -33, 0, 0,
289 1.2 christos -40, -25, -40, 0, -31, 8, 15, 0, 0, 0,
290 1.2 christos -2, 0, -36, 0, -36, -36, 0, 0, -33, 0,
291 1.2 christos 0, 0, 0, 0, 0, -92, -133, -103, 0, -33,
292 1.2 christos -33, -33, -33, -33, 0, -8, 0, 23, 23, 0,
293 1.2 christos 0, 0, 11, 75, 0, 0, -94, 0, 0, 0,
294 1.2 christos -33, 96, -194, 0, -8, 0, 0, -8, 0,
295 1.1 christos };
296 1.1 christos static const YYINT demo_rindex[] = { 0,
297 1.2 christos 0, 0, 1, -181, 0, 0, 0, 0, 0, 0,
298 1.2 christos 0, 17, 0, 0, 0, 0, 0, 0, 0, 0,
299 1.2 christos -39, -181, 12, -34, 0, 0, 0, 0, 0, 0,
300 1.2 christos 0, 0, 0, 0, -5, 0, -11, 0, 0, 0,
301 1.2 christos -17, 0, 28, 0, -41, 0, 47, 0, 0, 0,
302 1.2 christos 0, 0, -13, 0, 18, 70, 0, 0, 0, 0,
303 1.2 christos 0, 0, 0, 0, 0, -19, -27, -181, 0, 0,
304 1.2 christos 0, 0, 0, 0, 0, -29, 0, 56, 64, 0,
305 1.2 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
306 1.2 christos 0, 0, 0, 0, -29, -30, 0, -29, 0,
307 1.1 christos };
308 1.1 christos #if YYBTYACC
309 1.1 christos static const YYINT demo_cindex[] = { 0,
310 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
311 1.2 christos 0, -22, 0, 0, 0, 0, 0, 0, 0, 0,
312 1.2 christos 0, 0, -179, 0, 0, 0, 0, 0, 0, 0,
313 1.2 christos 0, 0, 0, 0, 52, 0, 0, 0, 0, 0,
314 1.2 christos 58, 0, 62, 0, -21, 0, 0, 0, 0, 0,
315 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
316 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
317 1.2 christos 0, 0, 0, 0, 0, -146, 0, 0, 0, 0,
318 1.2 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
319 1.2 christos 0, 0, 0, 0, -143, -147, 0, -134, 0,
320 1.1 christos };
321 1.1 christos #endif
322 1.1 christos static const YYINT demo_gindex[] = { 0,
323 1.2 christos 9, 143, 0, 0, 50, 0, 63, 101, 83, 7,
324 1.2 christos 130, 0, 98, 2, 0, 0, 0, 0, 19, 0,
325 1.2 christos 10, 117, 66, 0, 0, 0, 0,
326 1.1 christos };
327 1.2 christos #define YYTABLESIZE 286
328 1.2 christos static const YYINT demo_table[] = { 28,
329 1.2 christos 6, 17, 28, 28, 27, 24, 24, 24, 48, 24,
330 1.2 christos 17, 54, 35, 35, 28, 54, 35, 0, 0, 27,
331 1.2 christos 23, 4, 8, 28, 24, 33, 28, 33, 39, 36,
332 1.2 christos 33, 35, 75, 48, 64, 28, 36, 37, 38, 62,
333 1.2 christos 60, 28, 61, 45, 63, 33, 51, 27, 57, 28,
334 1.2 christos 88, 4, 4, 4, 29, 4, 24, 52, 58, 64,
335 1.2 christos 28, 26, 26, 35, 62, 29, 59, 69, 33, 63,
336 1.2 christos 4, 28, 94, 28, 45, 28, 26, 1, 78, 79,
337 1.2 christos 80, 81, 82, 11, 76, 28, 28, 37, 24, 6,
338 1.2 christos 65, 0, 54, 55, 54, 35, 41, 0, 41, 92,
339 1.2 christos 41, 0, 4, 8, 42, 28, 42, 28, 42, 33,
340 1.2 christos 40, 64, 9, 40, 41, 9, 62, 60, 28, 61,
341 1.2 christos 12, 63, 42, 68, 9, 70, 71, 72, 73, 74,
342 1.2 christos 8, 9, 64, 89, 4, 42, 93, 62, 60, 28,
343 1.2 christos 61, 53, 63, 55, 96, 56, 11, 99, 41, 90,
344 1.2 christos 77, 31, 43, 91, 67, 0, 42, 5, 6, 7,
345 1.2 christos 8, 9, 0, 0, 0, 10, 0, 0, 0, 0,
346 1.2 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
347 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
348 1.1 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
349 1.2 christos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
350 1.2 christos 0, 0, 0, 0, 0, 0, 0, 0, 19, 8,
351 1.2 christos 8, 8, 8, 8, 24, 49, 50, 8, 54, 54,
352 1.2 christos 54, 54, 54, 54, 54, 54, 3, 3, 54, 8,
353 1.2 christos 8, 8, 8, 8, 8, 8, 8, 1, 0, 8,
354 1.2 christos 0, 50, 5, 6, 7, 8, 9, 83, 0, 8,
355 1.2 christos 10, 8, 8, 8, 8, 8, 0, 0, 0, 8,
356 1.2 christos 4, 0, 4, 4, 4, 4, 4, 8, 8, 8,
357 1.2 christos 8, 8, 0, 0, 0, 8,
358 1.1 christos };
359 1.2 christos static const YYINT demo_check[] = { 41,
360 1.2 christos 0, 42, 44, 40, 44, 40, 41, 42, 42, 44,
361 1.2 christos 42, 42, 40, 41, 40, 41, 44, 40, 40, 59,
362 1.2 christos 259, 3, 42, 41, 59, 24, 44, 41, 123, 41,
363 1.2 christos 44, 59, 125, 42, 37, 41, 27, 28, 29, 42,
364 1.2 christos 43, 59, 45, 37, 47, 59, 38, 44, 41, 91,
365 1.2 christos 40, 40, 41, 42, 91, 44, 91, 39, 44, 37,
366 1.2 christos 44, 44, 59, 91, 42, 91, 48, 59, 67, 47,
367 1.2 christos 59, 44, 267, 91, 68, 59, 59, 259, 70, 71,
368 1.2 christos 72, 73, 74, 123, 66, 91, 59, 41, 123, 269,
369 1.2 christos 93, 40, 123, 123, 125, 123, 41, 40, 43, 91,
370 1.2 christos 45, 40, 91, 123, 41, 123, 43, 91, 45, 123,
371 1.2 christos 41, 37, 259, 44, 59, 259, 42, 43, 91, 45,
372 1.2 christos 268, 47, 59, 58, 259, 60, 61, 62, 63, 64,
373 1.2 christos 264, 265, 37, 59, 123, 35, 41, 42, 43, 123,
374 1.2 christos 45, 41, 47, 43, 95, 45, 4, 98, 93, 87,
375 1.2 christos 68, 22, 36, 88, 57, -1, 93, 261, 262, 263,
376 1.2 christos 264, 265, -1, -1, -1, 269, -1, -1, -1, -1,
377 1.2 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
378 1.2 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
379 1.2 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
380 1.2 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
381 1.2 christos -1, -1, -1, -1, -1, -1, -1, -1, 259, 261,
382 1.2 christos 262, 263, 264, 265, 259, 259, 260, 269, 259, 260,
383 1.2 christos 261, 262, 263, 264, 265, 266, 259, 259, 269, 259,
384 1.2 christos 260, 261, 262, 263, 264, 265, 266, 259, -1, 269,
385 1.2 christos -1, 260, 261, 262, 263, 264, 265, 266, -1, 259,
386 1.2 christos 269, 261, 262, 263, 264, 265, -1, -1, -1, 269,
387 1.2 christos 259, -1, 261, 262, 263, 264, 265, 261, 262, 263,
388 1.2 christos 264, 265, -1, -1, -1, 269,
389 1.1 christos };
390 1.1 christos #if YYBTYACC
391 1.2 christos static const YYINT demo_ctable[] = { 18,
392 1.2 christos 28, -1, 19, 8, -1, 32, 4, -1, 49, 1,
393 1.2 christos -1, 97, 54, -1, -1, -1, -1, -1, -1, -1,
394 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
395 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
396 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
397 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
398 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
399 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
400 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
401 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
402 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
403 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
404 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
405 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
406 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
407 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
408 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
409 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
410 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
411 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
412 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
413 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
414 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
415 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
416 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
417 1.1 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
418 1.2 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
419 1.2 christos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
420 1.2 christos -1, -1, -1, -1, -1,
421 1.1 christos };
422 1.1 christos #endif
423 1.1 christos #define YYFINAL 1
424 1.1 christos #ifndef YYDEBUG
425 1.1 christos #define YYDEBUG 0
426 1.1 christos #endif
427 1.1 christos #define YYMAXTOKEN 269
428 1.2 christos #define YYUNDFTOKEN 299
429 1.1 christos #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
430 1.1 christos #if YYDEBUG
431 1.7 christos #ifndef NULL
432 1.7 christos #define NULL (void*)0
433 1.7 christos #endif
434 1.1 christos static const char *const demo_name[] = {
435 1.1 christos
436 1.7 christos "$end",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
437 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
438 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,"'%'",NULL,NULL,"'('","')'","'*'","'+'","','",
439 1.7 christos "'-'","'.'","'/'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"';'",
440 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
441 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
442 1.7 christos "'['",NULL,"']'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
443 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
444 1.7 christos NULL,"'{'",NULL,"'}'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
445 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
446 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
447 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
448 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
449 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
450 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
451 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
452 1.7 christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,"error","PREFIX","POSTFIX","ID","CONSTANT",
453 1.7 christos "EXTERN","REGISTER","STATIC","CONST","VOLATILE","IF","THEN","ELSE","CLCL",
454 1.7 christos "$accept","input","expr","decl","declarator_list","decl_list","statement",
455 1.1 christos "statement_list","block_statement","declarator","formal_arg","decl_specs",
456 1.1 christos "decl_spec","typename","cv_quals","cv_qual","opt_scope","formal_arg_list",
457 1.1 christos "nonempty_formal_arg_list","$$1","$$2","$$3","$$4","$$5","$$6","$$7","$$8",
458 1.2 christos "$$9","$$10","illegal-symbol",
459 1.1 christos };
460 1.1 christos static const char *const demo_rule[] = {
461 1.1 christos "$accept : input",
462 1.1 christos "opt_scope :",
463 1.1 christos "opt_scope : CLCL",
464 1.1 christos "opt_scope : opt_scope ID CLCL",
465 1.1 christos "typename : opt_scope ID",
466 1.1 christos "$$1 :",
467 1.1 christos "input : $$1 decl_list",
468 1.1 christos "decl_list :",
469 1.1 christos "$$2 :",
470 1.1 christos "decl_list : decl_list $$2 decl",
471 1.2 christos "decl : decl_specs declarator_list ';'",
472 1.1 christos "$$3 :",
473 1.2 christos "decl : decl_specs declarator $$3 block_statement",
474 1.1 christos "decl_specs : decl_spec",
475 1.1 christos "decl_specs : decl_specs $$2 decl_spec",
476 1.1 christos "cv_quals :",
477 1.1 christos "cv_quals : cv_quals cv_qual",
478 1.1 christos "decl_spec : cv_qual",
479 1.1 christos "decl_spec : typename",
480 1.1 christos "decl_spec : EXTERN",
481 1.1 christos "decl_spec : REGISTER",
482 1.1 christos "decl_spec : STATIC",
483 1.1 christos "cv_qual : CONST",
484 1.1 christos "cv_qual : VOLATILE",
485 1.2 christos "$$4 :",
486 1.1 christos "$$5 :",
487 1.2 christos "declarator_list : declarator_list ',' $$4 $$5 declarator",
488 1.1 christos "declarator_list : declarator",
489 1.1 christos "declarator :",
490 1.1 christos "declarator : ID",
491 1.2 christos "$$6 :",
492 1.1 christos "$$7 :",
493 1.2 christos "declarator : '(' $$6 $$7 declarator ')'",
494 1.2 christos "declarator : '*' cv_quals $$4 $$5 declarator",
495 1.2 christos "declarator : declarator '[' $$4 expr ']'",
496 1.2 christos "declarator : declarator '(' $$4 formal_arg_list ')' cv_quals",
497 1.1 christos "formal_arg_list :",
498 1.1 christos "formal_arg_list : nonempty_formal_arg_list",
499 1.2 christos "nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$6 formal_arg",
500 1.1 christos "nonempty_formal_arg_list : formal_arg",
501 1.2 christos "formal_arg : decl_specs declarator",
502 1.2 christos "expr : expr '+' $$6 expr",
503 1.2 christos "expr : expr '-' $$6 expr",
504 1.2 christos "expr : expr '*' $$6 expr",
505 1.2 christos "expr : expr '%' $$6 expr",
506 1.2 christos "expr : expr '/' $$6 expr",
507 1.1 christos "expr : '*' $$2 expr",
508 1.1 christos "expr : ID",
509 1.1 christos "expr : CONSTANT",
510 1.1 christos "statement : decl",
511 1.2 christos "statement : expr ';'",
512 1.2 christos "$$8 :",
513 1.1 christos "$$9 :",
514 1.2 christos "statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE $$9 statement",
515 1.2 christos "statement : IF '(' $$6 expr ')' THEN $$8 statement",
516 1.1 christos "$$10 :",
517 1.2 christos "statement : $$10 block_statement",
518 1.1 christos "statement_list :",
519 1.1 christos "statement_list : statement_list $$2 statement",
520 1.1 christos "block_statement : '{' $$2 statement_list '}'",
521 1.1 christos
522 1.1 christos };
523 1.1 christos #endif
524 1.1 christos
525 1.4 christos #if YYDEBUG
526 1.1 christos int yydebug;
527 1.4 christos #endif
528 1.1 christos
529 1.1 christos int yyerrflag;
530 1.1 christos int yychar;
531 1.1 christos YYSTYPE yyval;
532 1.1 christos YYSTYPE yylval;
533 1.4 christos int yynerrs;
534 1.4 christos
535 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
536 1.1 christos YYLTYPE yyloc; /* position returned by actions */
537 1.1 christos YYLTYPE yylloc; /* position from the lexer */
538 1.1 christos #endif
539 1.1 christos
540 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
541 1.1 christos #ifndef YYLLOC_DEFAULT
542 1.1 christos #define YYLLOC_DEFAULT(loc, rhs, n) \
543 1.1 christos do \
544 1.1 christos { \
545 1.1 christos if (n == 0) \
546 1.1 christos { \
547 1.4 christos (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
548 1.4 christos (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
549 1.4 christos (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
550 1.4 christos (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
551 1.1 christos } \
552 1.1 christos else \
553 1.1 christos { \
554 1.4 christos (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
555 1.4 christos (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
556 1.4 christos (loc).last_line = YYRHSLOC(rhs, n).last_line; \
557 1.4 christos (loc).last_column = YYRHSLOC(rhs, n).last_column; \
558 1.1 christos } \
559 1.1 christos } while (0)
560 1.1 christos #endif /* YYLLOC_DEFAULT */
561 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
562 1.1 christos #if YYBTYACC
563 1.1 christos
564 1.1 christos #ifndef YYLVQUEUEGROWTH
565 1.1 christos #define YYLVQUEUEGROWTH 32
566 1.1 christos #endif
567 1.1 christos #endif /* YYBTYACC */
568 1.1 christos
569 1.1 christos /* define the initial stack-sizes */
570 1.1 christos #ifdef YYSTACKSIZE
571 1.1 christos #undef YYMAXDEPTH
572 1.1 christos #define YYMAXDEPTH YYSTACKSIZE
573 1.1 christos #else
574 1.1 christos #ifdef YYMAXDEPTH
575 1.1 christos #define YYSTACKSIZE YYMAXDEPTH
576 1.1 christos #else
577 1.1 christos #define YYSTACKSIZE 10000
578 1.1 christos #define YYMAXDEPTH 10000
579 1.1 christos #endif
580 1.1 christos #endif
581 1.1 christos
582 1.1 christos #ifndef YYINITSTACKSIZE
583 1.1 christos #define YYINITSTACKSIZE 200
584 1.1 christos #endif
585 1.1 christos
586 1.1 christos typedef struct {
587 1.1 christos unsigned stacksize;
588 1.2 christos YYINT *s_base;
589 1.2 christos YYINT *s_mark;
590 1.2 christos YYINT *s_last;
591 1.1 christos YYSTYPE *l_base;
592 1.1 christos YYSTYPE *l_mark;
593 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
594 1.1 christos YYLTYPE *p_base;
595 1.1 christos YYLTYPE *p_mark;
596 1.1 christos #endif
597 1.1 christos } YYSTACKDATA;
598 1.1 christos #if YYBTYACC
599 1.1 christos
600 1.1 christos struct YYParseState_s
601 1.1 christos {
602 1.1 christos struct YYParseState_s *save; /* Previously saved parser state */
603 1.1 christos YYSTACKDATA yystack; /* saved parser stack */
604 1.1 christos int state; /* saved parser state */
605 1.1 christos int errflag; /* saved error recovery status */
606 1.1 christos int lexeme; /* saved index of the conflict lexeme in the lexical queue */
607 1.1 christos YYINT ctry; /* saved index in yyctable[] for this conflict */
608 1.1 christos };
609 1.1 christos typedef struct YYParseState_s YYParseState;
610 1.1 christos #endif /* YYBTYACC */
611 1.1 christos /* variables for the parser stack */
612 1.1 christos static YYSTACKDATA yystack;
613 1.1 christos #if YYBTYACC
614 1.1 christos
615 1.1 christos /* Current parser state */
616 1.7 christos static YYParseState *yyps = NULL;
617 1.1 christos
618 1.1 christos /* yypath != NULL: do the full parse, starting at *yypath parser state. */
619 1.7 christos static YYParseState *yypath = NULL;
620 1.1 christos
621 1.1 christos /* Base of the lexical value queue */
622 1.7 christos static YYSTYPE *yylvals = NULL;
623 1.1 christos
624 1.1 christos /* Current position at lexical value queue */
625 1.7 christos static YYSTYPE *yylvp = NULL;
626 1.1 christos
627 1.1 christos /* End position of lexical value queue */
628 1.7 christos static YYSTYPE *yylve = NULL;
629 1.1 christos
630 1.1 christos /* The last allocated position at the lexical value queue */
631 1.7 christos static YYSTYPE *yylvlim = NULL;
632 1.1 christos
633 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
634 1.1 christos /* Base of the lexical position queue */
635 1.7 christos static YYLTYPE *yylpsns = NULL;
636 1.1 christos
637 1.1 christos /* Current position at lexical position queue */
638 1.7 christos static YYLTYPE *yylpp = NULL;
639 1.1 christos
640 1.1 christos /* End position of lexical position queue */
641 1.7 christos static YYLTYPE *yylpe = NULL;
642 1.1 christos
643 1.1 christos /* The last allocated position at the lexical position queue */
644 1.7 christos static YYLTYPE *yylplim = NULL;
645 1.1 christos #endif
646 1.1 christos
647 1.1 christos /* Current position at lexical token queue */
648 1.7 christos static YYINT *yylexp = NULL;
649 1.1 christos
650 1.7 christos static YYINT *yylexemes = NULL;
651 1.1 christos #endif /* YYBTYACC */
652 1.1 christos #line 200 "btyacc_demo.y"
653 1.1 christos
654 1.1 christos extern int YYLEX_DECL();
655 1.1 christos extern void YYERROR_DECL();
656 1.1 christos
657 1.1 christos extern Scope *global_scope;
658 1.1 christos
659 1.1 christos extern Decl * lookup(Scope *scope, char *id);
660 1.1 christos extern Scope * new_scope(Scope *outer_scope);
661 1.1 christos extern Scope * start_fn_def(Scope *scope, Decl *fn_decl);
662 1.1 christos extern void finish_fn_def(Decl *fn_decl, Code *block);
663 1.1 christos extern Type * type_combine(Type *specs, Type *spec);
664 1.1 christos extern Type * bare_extern(void);
665 1.1 christos extern Type * bare_register(void);
666 1.1 christos extern Type * bare_static(void);
667 1.1 christos extern Type * bare_const(void);
668 1.1 christos extern Type * bare_volatile(void);
669 1.1 christos extern Decl * declare(Scope *scope, char *id, Type *type);
670 1.1 christos extern Decl * make_pointer(Decl *decl, Type *type);
671 1.1 christos extern Decl * make_array(Type *type, Expr *expr);
672 1.1 christos extern Decl * build_function(Decl *decl, Decl_List *dlist, Type *type);
673 1.1 christos extern Decl_List * append_dlist(Decl_List *dlist, Decl *decl);
674 1.1 christos extern Decl_List * build_dlist(Decl *decl);
675 1.1 christos extern Expr * build_expr(Expr *left, enum Operator op, Expr *right);
676 1.1 christos extern Expr * var_expr(Scope *scope, char *id);
677 1.1 christos extern Code * build_expr_code(Expr *expr);
678 1.1 christos extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt);
679 1.1 christos extern Code * code_append(Code *stmt_list, Code *stmt);
680 1.7 christos #line 679 "btyacc_demo.tab.c"
681 1.1 christos
682 1.1 christos /* Release memory associated with symbol. */
683 1.1 christos #if ! defined YYDESTRUCT_IS_DECLARED
684 1.1 christos static void
685 1.1 christos YYDESTRUCT_DECL()
686 1.1 christos {
687 1.1 christos switch (psymb)
688 1.1 christos {
689 1.1 christos case 43:
690 1.1 christos #line 83 "btyacc_demo.y"
691 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
692 1.1 christos msg,
693 1.1 christos (*loc).first_line, (*loc).first_column,
694 1.1 christos (*loc).last_line, (*loc).last_column);
695 1.1 christos /* in this example, we don't know what to do here */ }
696 1.7 christos #line 695 "btyacc_demo.tab.c"
697 1.1 christos break;
698 1.1 christos case 45:
699 1.1 christos #line 83 "btyacc_demo.y"
700 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
701 1.1 christos msg,
702 1.1 christos (*loc).first_line, (*loc).first_column,
703 1.1 christos (*loc).last_line, (*loc).last_column);
704 1.1 christos /* in this example, we don't know what to do here */ }
705 1.7 christos #line 704 "btyacc_demo.tab.c"
706 1.1 christos break;
707 1.1 christos case 42:
708 1.1 christos #line 83 "btyacc_demo.y"
709 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
710 1.1 christos msg,
711 1.1 christos (*loc).first_line, (*loc).first_column,
712 1.1 christos (*loc).last_line, (*loc).last_column);
713 1.1 christos /* in this example, we don't know what to do here */ }
714 1.7 christos #line 713 "btyacc_demo.tab.c"
715 1.1 christos break;
716 1.1 christos case 47:
717 1.1 christos #line 83 "btyacc_demo.y"
718 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
719 1.1 christos msg,
720 1.1 christos (*loc).first_line, (*loc).first_column,
721 1.1 christos (*loc).last_line, (*loc).last_column);
722 1.1 christos /* in this example, we don't know what to do here */ }
723 1.7 christos #line 722 "btyacc_demo.tab.c"
724 1.1 christos break;
725 1.1 christos case 37:
726 1.1 christos #line 83 "btyacc_demo.y"
727 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
728 1.1 christos msg,
729 1.1 christos (*loc).first_line, (*loc).first_column,
730 1.1 christos (*loc).last_line, (*loc).last_column);
731 1.1 christos /* in this example, we don't know what to do here */ }
732 1.7 christos #line 731 "btyacc_demo.tab.c"
733 1.1 christos break;
734 1.1 christos case 257:
735 1.1 christos #line 83 "btyacc_demo.y"
736 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
737 1.1 christos msg,
738 1.1 christos (*loc).first_line, (*loc).first_column,
739 1.1 christos (*loc).last_line, (*loc).last_column);
740 1.1 christos /* in this example, we don't know what to do here */ }
741 1.7 christos #line 740 "btyacc_demo.tab.c"
742 1.1 christos break;
743 1.1 christos case 258:
744 1.1 christos #line 83 "btyacc_demo.y"
745 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
746 1.1 christos msg,
747 1.1 christos (*loc).first_line, (*loc).first_column,
748 1.1 christos (*loc).last_line, (*loc).last_column);
749 1.1 christos /* in this example, we don't know what to do here */ }
750 1.7 christos #line 749 "btyacc_demo.tab.c"
751 1.1 christos break;
752 1.1 christos case 40:
753 1.1 christos #line 83 "btyacc_demo.y"
754 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
755 1.1 christos msg,
756 1.1 christos (*loc).first_line, (*loc).first_column,
757 1.1 christos (*loc).last_line, (*loc).last_column);
758 1.1 christos /* in this example, we don't know what to do here */ }
759 1.7 christos #line 758 "btyacc_demo.tab.c"
760 1.1 christos break;
761 1.1 christos case 91:
762 1.1 christos #line 83 "btyacc_demo.y"
763 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
764 1.1 christos msg,
765 1.1 christos (*loc).first_line, (*loc).first_column,
766 1.1 christos (*loc).last_line, (*loc).last_column);
767 1.1 christos /* in this example, we don't know what to do here */ }
768 1.7 christos #line 767 "btyacc_demo.tab.c"
769 1.1 christos break;
770 1.1 christos case 46:
771 1.1 christos #line 83 "btyacc_demo.y"
772 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
773 1.1 christos msg,
774 1.1 christos (*loc).first_line, (*loc).first_column,
775 1.1 christos (*loc).last_line, (*loc).last_column);
776 1.1 christos /* in this example, we don't know what to do here */ }
777 1.7 christos #line 776 "btyacc_demo.tab.c"
778 1.1 christos break;
779 1.1 christos case 259:
780 1.1 christos #line 78 "btyacc_demo.y"
781 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
782 1.1 christos msg,
783 1.1 christos (*loc).first_line, (*loc).first_column,
784 1.1 christos (*loc).last_line, (*loc).last_column);
785 1.1 christos free((*val).id); }
786 1.7 christos #line 785 "btyacc_demo.tab.c"
787 1.1 christos break;
788 1.1 christos case 260:
789 1.1 christos #line 78 "btyacc_demo.y"
790 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
791 1.1 christos msg,
792 1.1 christos (*loc).first_line, (*loc).first_column,
793 1.1 christos (*loc).last_line, (*loc).last_column);
794 1.1 christos free((*val).expr); }
795 1.7 christos #line 794 "btyacc_demo.tab.c"
796 1.1 christos break;
797 1.1 christos case 261:
798 1.1 christos #line 83 "btyacc_demo.y"
799 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
800 1.1 christos msg,
801 1.1 christos (*loc).first_line, (*loc).first_column,
802 1.1 christos (*loc).last_line, (*loc).last_column);
803 1.1 christos /* in this example, we don't know what to do here */ }
804 1.7 christos #line 803 "btyacc_demo.tab.c"
805 1.1 christos break;
806 1.1 christos case 262:
807 1.1 christos #line 83 "btyacc_demo.y"
808 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
809 1.1 christos msg,
810 1.1 christos (*loc).first_line, (*loc).first_column,
811 1.1 christos (*loc).last_line, (*loc).last_column);
812 1.1 christos /* in this example, we don't know what to do here */ }
813 1.7 christos #line 812 "btyacc_demo.tab.c"
814 1.1 christos break;
815 1.1 christos case 263:
816 1.1 christos #line 83 "btyacc_demo.y"
817 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
818 1.1 christos msg,
819 1.1 christos (*loc).first_line, (*loc).first_column,
820 1.1 christos (*loc).last_line, (*loc).last_column);
821 1.1 christos /* in this example, we don't know what to do here */ }
822 1.7 christos #line 821 "btyacc_demo.tab.c"
823 1.1 christos break;
824 1.1 christos case 264:
825 1.1 christos #line 83 "btyacc_demo.y"
826 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
827 1.1 christos msg,
828 1.1 christos (*loc).first_line, (*loc).first_column,
829 1.1 christos (*loc).last_line, (*loc).last_column);
830 1.1 christos /* in this example, we don't know what to do here */ }
831 1.7 christos #line 830 "btyacc_demo.tab.c"
832 1.1 christos break;
833 1.1 christos case 265:
834 1.1 christos #line 83 "btyacc_demo.y"
835 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
836 1.1 christos msg,
837 1.1 christos (*loc).first_line, (*loc).first_column,
838 1.1 christos (*loc).last_line, (*loc).last_column);
839 1.1 christos /* in this example, we don't know what to do here */ }
840 1.7 christos #line 839 "btyacc_demo.tab.c"
841 1.1 christos break;
842 1.1 christos case 266:
843 1.1 christos #line 83 "btyacc_demo.y"
844 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
845 1.1 christos msg,
846 1.1 christos (*loc).first_line, (*loc).first_column,
847 1.1 christos (*loc).last_line, (*loc).last_column);
848 1.1 christos /* in this example, we don't know what to do here */ }
849 1.7 christos #line 848 "btyacc_demo.tab.c"
850 1.1 christos break;
851 1.1 christos case 267:
852 1.1 christos #line 83 "btyacc_demo.y"
853 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
854 1.1 christos msg,
855 1.1 christos (*loc).first_line, (*loc).first_column,
856 1.1 christos (*loc).last_line, (*loc).last_column);
857 1.1 christos /* in this example, we don't know what to do here */ }
858 1.7 christos #line 857 "btyacc_demo.tab.c"
859 1.1 christos break;
860 1.1 christos case 268:
861 1.1 christos #line 83 "btyacc_demo.y"
862 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
863 1.1 christos msg,
864 1.1 christos (*loc).first_line, (*loc).first_column,
865 1.1 christos (*loc).last_line, (*loc).last_column);
866 1.1 christos /* in this example, we don't know what to do here */ }
867 1.7 christos #line 866 "btyacc_demo.tab.c"
868 1.1 christos break;
869 1.1 christos case 269:
870 1.1 christos #line 83 "btyacc_demo.y"
871 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
872 1.1 christos msg,
873 1.1 christos (*loc).first_line, (*loc).first_column,
874 1.1 christos (*loc).last_line, (*loc).last_column);
875 1.1 christos /* in this example, we don't know what to do here */ }
876 1.7 christos #line 875 "btyacc_demo.tab.c"
877 1.1 christos break;
878 1.1 christos case 59:
879 1.1 christos #line 83 "btyacc_demo.y"
880 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
881 1.1 christos msg,
882 1.1 christos (*loc).first_line, (*loc).first_column,
883 1.1 christos (*loc).last_line, (*loc).last_column);
884 1.1 christos /* in this example, we don't know what to do here */ }
885 1.7 christos #line 884 "btyacc_demo.tab.c"
886 1.1 christos break;
887 1.1 christos case 44:
888 1.1 christos #line 83 "btyacc_demo.y"
889 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
890 1.1 christos msg,
891 1.1 christos (*loc).first_line, (*loc).first_column,
892 1.1 christos (*loc).last_line, (*loc).last_column);
893 1.1 christos /* in this example, we don't know what to do here */ }
894 1.7 christos #line 893 "btyacc_demo.tab.c"
895 1.1 christos break;
896 1.1 christos case 41:
897 1.1 christos #line 83 "btyacc_demo.y"
898 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
899 1.1 christos msg,
900 1.1 christos (*loc).first_line, (*loc).first_column,
901 1.1 christos (*loc).last_line, (*loc).last_column);
902 1.1 christos /* in this example, we don't know what to do here */ }
903 1.7 christos #line 902 "btyacc_demo.tab.c"
904 1.1 christos break;
905 1.1 christos case 93:
906 1.1 christos #line 83 "btyacc_demo.y"
907 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
908 1.1 christos msg,
909 1.1 christos (*loc).first_line, (*loc).first_column,
910 1.1 christos (*loc).last_line, (*loc).last_column);
911 1.1 christos /* in this example, we don't know what to do here */ }
912 1.7 christos #line 911 "btyacc_demo.tab.c"
913 1.1 christos break;
914 1.1 christos case 123:
915 1.1 christos #line 83 "btyacc_demo.y"
916 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
917 1.1 christos msg,
918 1.1 christos (*loc).first_line, (*loc).first_column,
919 1.1 christos (*loc).last_line, (*loc).last_column);
920 1.1 christos /* in this example, we don't know what to do here */ }
921 1.7 christos #line 920 "btyacc_demo.tab.c"
922 1.1 christos break;
923 1.1 christos case 125:
924 1.1 christos #line 83 "btyacc_demo.y"
925 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
926 1.1 christos msg,
927 1.1 christos (*loc).first_line, (*loc).first_column,
928 1.1 christos (*loc).last_line, (*loc).last_column);
929 1.1 christos /* in this example, we don't know what to do here */ }
930 1.7 christos #line 929 "btyacc_demo.tab.c"
931 1.1 christos break;
932 1.1 christos case 270:
933 1.1 christos #line 83 "btyacc_demo.y"
934 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
935 1.1 christos msg,
936 1.1 christos (*loc).first_line, (*loc).first_column,
937 1.1 christos (*loc).last_line, (*loc).last_column);
938 1.1 christos /* in this example, we don't know what to do here */ }
939 1.7 christos #line 938 "btyacc_demo.tab.c"
940 1.1 christos break;
941 1.1 christos case 271:
942 1.1 christos #line 83 "btyacc_demo.y"
943 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
944 1.1 christos msg,
945 1.1 christos (*loc).first_line, (*loc).first_column,
946 1.1 christos (*loc).last_line, (*loc).last_column);
947 1.1 christos /* in this example, we don't know what to do here */ }
948 1.7 christos #line 947 "btyacc_demo.tab.c"
949 1.1 christos break;
950 1.1 christos case 272:
951 1.1 christos #line 78 "btyacc_demo.y"
952 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
953 1.1 christos msg,
954 1.1 christos (*loc).first_line, (*loc).first_column,
955 1.1 christos (*loc).last_line, (*loc).last_column);
956 1.1 christos free((*val).expr); }
957 1.7 christos #line 956 "btyacc_demo.tab.c"
958 1.1 christos break;
959 1.1 christos case 273:
960 1.1 christos #line 67 "btyacc_demo.y"
961 1.1 christos { /* 'msg' is a 'char *' indicating the context of destructor invocation*/
962 1.1 christos printf("%s accessed by symbol \"decl\" (case s.b. 273) @ position[%d,%d..%d,%d]\n",
963 1.1 christos msg,
964 1.1 christos (*loc).first_line, (*loc).first_column,
965 1.1 christos (*loc).last_line, (*loc).last_column);
966 1.1 christos free((*val).decl->scope); free((*val).decl->type); }
967 1.7 christos #line 966 "btyacc_demo.tab.c"
968 1.1 christos break;
969 1.1 christos case 274:
970 1.1 christos #line 83 "btyacc_demo.y"
971 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
972 1.1 christos msg,
973 1.1 christos (*loc).first_line, (*loc).first_column,
974 1.1 christos (*loc).last_line, (*loc).last_column);
975 1.1 christos /* in this example, we don't know what to do here */ }
976 1.7 christos #line 975 "btyacc_demo.tab.c"
977 1.1 christos break;
978 1.1 christos case 275:
979 1.1 christos #line 83 "btyacc_demo.y"
980 1.1 christos { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
981 1.1 christos msg,
982 1.1 christos (*loc).first_line, (*loc).first_column,
983 1.1 christos (*loc).last_line, (*loc).last_column);
984 1.1 christos /* in this example, we don't know what to do here */ }
985 1.7 christos #line 984 "btyacc_demo.tab.c"
986 1.1 christos break;
987 1.1 christos case 276:
988 1.1 christos #line 78 "btyacc_demo.y"
989 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
990 1.1 christos msg,
991 1.1 christos (*loc).first_line, (*loc).first_column,
992 1.1 christos (*loc).last_line, (*loc).last_column);
993 1.1 christos free((*val).code); }
994 1.7 christos #line 993 "btyacc_demo.tab.c"
995 1.1 christos break;
996 1.1 christos case 277:
997 1.1 christos #line 78 "btyacc_demo.y"
998 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
999 1.1 christos msg,
1000 1.1 christos (*loc).first_line, (*loc).first_column,
1001 1.1 christos (*loc).last_line, (*loc).last_column);
1002 1.1 christos free((*val).code); }
1003 1.7 christos #line 1002 "btyacc_demo.tab.c"
1004 1.1 christos break;
1005 1.1 christos case 278:
1006 1.1 christos #line 78 "btyacc_demo.y"
1007 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1008 1.1 christos msg,
1009 1.1 christos (*loc).first_line, (*loc).first_column,
1010 1.1 christos (*loc).last_line, (*loc).last_column);
1011 1.1 christos free((*val).code); }
1012 1.7 christos #line 1011 "btyacc_demo.tab.c"
1013 1.1 christos break;
1014 1.1 christos case 279:
1015 1.1 christos #line 73 "btyacc_demo.y"
1016 1.1 christos { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
1017 1.1 christos msg,
1018 1.1 christos (*loc).first_line, (*loc).first_column,
1019 1.1 christos (*loc).last_line, (*loc).last_column);
1020 1.1 christos free((*val).decl); }
1021 1.7 christos #line 1020 "btyacc_demo.tab.c"
1022 1.1 christos break;
1023 1.1 christos case 280:
1024 1.1 christos #line 73 "btyacc_demo.y"
1025 1.1 christos { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
1026 1.1 christos msg,
1027 1.1 christos (*loc).first_line, (*loc).first_column,
1028 1.1 christos (*loc).last_line, (*loc).last_column);
1029 1.1 christos free((*val).decl); }
1030 1.7 christos #line 1029 "btyacc_demo.tab.c"
1031 1.1 christos break;
1032 1.1 christos case 281:
1033 1.1 christos #line 78 "btyacc_demo.y"
1034 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1035 1.1 christos msg,
1036 1.1 christos (*loc).first_line, (*loc).first_column,
1037 1.1 christos (*loc).last_line, (*loc).last_column);
1038 1.1 christos free((*val).type); }
1039 1.7 christos #line 1038 "btyacc_demo.tab.c"
1040 1.1 christos break;
1041 1.1 christos case 282:
1042 1.1 christos #line 78 "btyacc_demo.y"
1043 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1044 1.1 christos msg,
1045 1.1 christos (*loc).first_line, (*loc).first_column,
1046 1.1 christos (*loc).last_line, (*loc).last_column);
1047 1.1 christos free((*val).type); }
1048 1.7 christos #line 1047 "btyacc_demo.tab.c"
1049 1.1 christos break;
1050 1.1 christos case 283:
1051 1.1 christos #line 78 "btyacc_demo.y"
1052 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1053 1.1 christos msg,
1054 1.1 christos (*loc).first_line, (*loc).first_column,
1055 1.1 christos (*loc).last_line, (*loc).last_column);
1056 1.1 christos free((*val).type); }
1057 1.7 christos #line 1056 "btyacc_demo.tab.c"
1058 1.1 christos break;
1059 1.1 christos case 284:
1060 1.1 christos #line 78 "btyacc_demo.y"
1061 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1062 1.1 christos msg,
1063 1.1 christos (*loc).first_line, (*loc).first_column,
1064 1.1 christos (*loc).last_line, (*loc).last_column);
1065 1.1 christos free((*val).type); }
1066 1.7 christos #line 1065 "btyacc_demo.tab.c"
1067 1.1 christos break;
1068 1.1 christos case 285:
1069 1.1 christos #line 78 "btyacc_demo.y"
1070 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1071 1.1 christos msg,
1072 1.1 christos (*loc).first_line, (*loc).first_column,
1073 1.1 christos (*loc).last_line, (*loc).last_column);
1074 1.1 christos free((*val).type); }
1075 1.7 christos #line 1074 "btyacc_demo.tab.c"
1076 1.1 christos break;
1077 1.1 christos case 286:
1078 1.1 christos #line 78 "btyacc_demo.y"
1079 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1080 1.1 christos msg,
1081 1.1 christos (*loc).first_line, (*loc).first_column,
1082 1.1 christos (*loc).last_line, (*loc).last_column);
1083 1.1 christos free((*val).scope); }
1084 1.7 christos #line 1083 "btyacc_demo.tab.c"
1085 1.1 christos break;
1086 1.1 christos case 287:
1087 1.1 christos #line 78 "btyacc_demo.y"
1088 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1089 1.1 christos msg,
1090 1.1 christos (*loc).first_line, (*loc).first_column,
1091 1.1 christos (*loc).last_line, (*loc).last_column);
1092 1.1 christos free((*val).dlist); }
1093 1.7 christos #line 1092 "btyacc_demo.tab.c"
1094 1.1 christos break;
1095 1.1 christos case 288:
1096 1.1 christos #line 78 "btyacc_demo.y"
1097 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1098 1.1 christos msg,
1099 1.1 christos (*loc).first_line, (*loc).first_column,
1100 1.1 christos (*loc).last_line, (*loc).last_column);
1101 1.1 christos free((*val).dlist); }
1102 1.7 christos #line 1101 "btyacc_demo.tab.c"
1103 1.1 christos break;
1104 1.1 christos case 289:
1105 1.1 christos #line 78 "btyacc_demo.y"
1106 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1107 1.1 christos msg,
1108 1.1 christos (*loc).first_line, (*loc).first_column,
1109 1.1 christos (*loc).last_line, (*loc).last_column);
1110 1.1 christos free((*val).scope); }
1111 1.7 christos #line 1110 "btyacc_demo.tab.c"
1112 1.1 christos break;
1113 1.1 christos case 290:
1114 1.1 christos #line 78 "btyacc_demo.y"
1115 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1116 1.1 christos msg,
1117 1.1 christos (*loc).first_line, (*loc).first_column,
1118 1.1 christos (*loc).last_line, (*loc).last_column);
1119 1.1 christos free((*val).scope); }
1120 1.7 christos #line 1119 "btyacc_demo.tab.c"
1121 1.1 christos break;
1122 1.1 christos case 291:
1123 1.1 christos #line 78 "btyacc_demo.y"
1124 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1125 1.1 christos msg,
1126 1.1 christos (*loc).first_line, (*loc).first_column,
1127 1.1 christos (*loc).last_line, (*loc).last_column);
1128 1.2 christos free((*val).scope); }
1129 1.7 christos #line 1128 "btyacc_demo.tab.c"
1130 1.1 christos break;
1131 1.1 christos case 292:
1132 1.1 christos #line 78 "btyacc_demo.y"
1133 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1134 1.1 christos msg,
1135 1.1 christos (*loc).first_line, (*loc).first_column,
1136 1.1 christos (*loc).last_line, (*loc).last_column);
1137 1.1 christos free((*val).scope); }
1138 1.7 christos #line 1137 "btyacc_demo.tab.c"
1139 1.1 christos break;
1140 1.1 christos case 293:
1141 1.1 christos #line 78 "btyacc_demo.y"
1142 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1143 1.1 christos msg,
1144 1.1 christos (*loc).first_line, (*loc).first_column,
1145 1.1 christos (*loc).last_line, (*loc).last_column);
1146 1.2 christos free((*val).type); }
1147 1.7 christos #line 1146 "btyacc_demo.tab.c"
1148 1.1 christos break;
1149 1.1 christos case 294:
1150 1.1 christos #line 78 "btyacc_demo.y"
1151 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1152 1.1 christos msg,
1153 1.1 christos (*loc).first_line, (*loc).first_column,
1154 1.1 christos (*loc).last_line, (*loc).last_column);
1155 1.2 christos free((*val).scope); }
1156 1.7 christos #line 1155 "btyacc_demo.tab.c"
1157 1.1 christos break;
1158 1.1 christos case 295:
1159 1.1 christos #line 78 "btyacc_demo.y"
1160 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1161 1.1 christos msg,
1162 1.1 christos (*loc).first_line, (*loc).first_column,
1163 1.1 christos (*loc).last_line, (*loc).last_column);
1164 1.2 christos free((*val).type); }
1165 1.7 christos #line 1164 "btyacc_demo.tab.c"
1166 1.1 christos break;
1167 1.1 christos case 296:
1168 1.1 christos #line 78 "btyacc_demo.y"
1169 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1170 1.1 christos msg,
1171 1.1 christos (*loc).first_line, (*loc).first_column,
1172 1.1 christos (*loc).last_line, (*loc).last_column);
1173 1.2 christos free((*val).scope); }
1174 1.7 christos #line 1173 "btyacc_demo.tab.c"
1175 1.1 christos break;
1176 1.1 christos case 297:
1177 1.1 christos #line 78 "btyacc_demo.y"
1178 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1179 1.1 christos msg,
1180 1.1 christos (*loc).first_line, (*loc).first_column,
1181 1.1 christos (*loc).last_line, (*loc).last_column);
1182 1.1 christos free((*val).scope); }
1183 1.7 christos #line 1182 "btyacc_demo.tab.c"
1184 1.1 christos break;
1185 1.1 christos case 298:
1186 1.1 christos #line 78 "btyacc_demo.y"
1187 1.1 christos { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
1188 1.1 christos msg,
1189 1.1 christos (*loc).first_line, (*loc).first_column,
1190 1.1 christos (*loc).last_line, (*loc).last_column);
1191 1.1 christos free((*val).scope); }
1192 1.7 christos #line 1191 "btyacc_demo.tab.c"
1193 1.1 christos break;
1194 1.1 christos }
1195 1.1 christos }
1196 1.1 christos #define YYDESTRUCT_IS_DECLARED 1
1197 1.1 christos #endif
1198 1.1 christos
1199 1.1 christos /* For use in generated program */
1200 1.1 christos #define yydepth (int)(yystack.s_mark - yystack.s_base)
1201 1.1 christos #if YYBTYACC
1202 1.1 christos #define yytrial (yyps->save)
1203 1.1 christos #endif /* YYBTYACC */
1204 1.1 christos
1205 1.1 christos #if YYDEBUG
1206 1.2 christos #include <stdio.h> /* needed for printf */
1207 1.1 christos #endif
1208 1.1 christos
1209 1.2 christos #include <stdlib.h> /* needed for malloc, etc */
1210 1.2 christos #include <string.h> /* needed for memset */
1211 1.1 christos
1212 1.1 christos /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1213 1.1 christos static int yygrowstack(YYSTACKDATA *data)
1214 1.1 christos {
1215 1.1 christos int i;
1216 1.1 christos unsigned newsize;
1217 1.2 christos YYINT *newss;
1218 1.1 christos YYSTYPE *newvs;
1219 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1220 1.1 christos YYLTYPE *newps;
1221 1.1 christos #endif
1222 1.1 christos
1223 1.1 christos if ((newsize = data->stacksize) == 0)
1224 1.1 christos newsize = YYINITSTACKSIZE;
1225 1.1 christos else if (newsize >= YYMAXDEPTH)
1226 1.1 christos return YYENOMEM;
1227 1.1 christos else if ((newsize *= 2) > YYMAXDEPTH)
1228 1.1 christos newsize = YYMAXDEPTH;
1229 1.1 christos
1230 1.1 christos i = (int) (data->s_mark - data->s_base);
1231 1.2 christos newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
1232 1.7 christos if (newss == NULL)
1233 1.1 christos return YYENOMEM;
1234 1.1 christos
1235 1.1 christos data->s_base = newss;
1236 1.1 christos data->s_mark = newss + i;
1237 1.1 christos
1238 1.1 christos newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1239 1.7 christos if (newvs == NULL)
1240 1.1 christos return YYENOMEM;
1241 1.1 christos
1242 1.1 christos data->l_base = newvs;
1243 1.1 christos data->l_mark = newvs + i;
1244 1.1 christos
1245 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1246 1.1 christos newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
1247 1.7 christos if (newps == NULL)
1248 1.1 christos return YYENOMEM;
1249 1.1 christos
1250 1.1 christos data->p_base = newps;
1251 1.1 christos data->p_mark = newps + i;
1252 1.1 christos #endif
1253 1.1 christos
1254 1.1 christos data->stacksize = newsize;
1255 1.1 christos data->s_last = data->s_base + newsize - 1;
1256 1.1 christos
1257 1.1 christos #if YYDEBUG
1258 1.1 christos if (yydebug)
1259 1.1 christos fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
1260 1.1 christos #endif
1261 1.1 christos return 0;
1262 1.1 christos }
1263 1.1 christos
1264 1.1 christos #if YYPURE || defined(YY_NO_LEAKS)
1265 1.1 christos static void yyfreestack(YYSTACKDATA *data)
1266 1.1 christos {
1267 1.1 christos free(data->s_base);
1268 1.1 christos free(data->l_base);
1269 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1270 1.1 christos free(data->p_base);
1271 1.1 christos #endif
1272 1.1 christos memset(data, 0, sizeof(*data));
1273 1.1 christos }
1274 1.1 christos #else
1275 1.1 christos #define yyfreestack(data) /* nothing */
1276 1.1 christos #endif /* YYPURE || defined(YY_NO_LEAKS) */
1277 1.1 christos #if YYBTYACC
1278 1.1 christos
1279 1.1 christos static YYParseState *
1280 1.1 christos yyNewState(unsigned size)
1281 1.1 christos {
1282 1.1 christos YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
1283 1.1 christos if (p == NULL) return NULL;
1284 1.1 christos
1285 1.1 christos p->yystack.stacksize = size;
1286 1.1 christos if (size == 0)
1287 1.1 christos {
1288 1.1 christos p->yystack.s_base = NULL;
1289 1.1 christos p->yystack.l_base = NULL;
1290 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1291 1.1 christos p->yystack.p_base = NULL;
1292 1.1 christos #endif
1293 1.1 christos return p;
1294 1.1 christos }
1295 1.2 christos p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
1296 1.1 christos if (p->yystack.s_base == NULL) return NULL;
1297 1.1 christos p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
1298 1.1 christos if (p->yystack.l_base == NULL) return NULL;
1299 1.1 christos memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
1300 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1301 1.1 christos p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
1302 1.1 christos if (p->yystack.p_base == NULL) return NULL;
1303 1.1 christos memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
1304 1.1 christos #endif
1305 1.1 christos
1306 1.1 christos return p;
1307 1.1 christos }
1308 1.1 christos
1309 1.1 christos static void
1310 1.1 christos yyFreeState(YYParseState *p)
1311 1.1 christos {
1312 1.1 christos yyfreestack(&p->yystack);
1313 1.1 christos free(p);
1314 1.1 christos }
1315 1.1 christos #endif /* YYBTYACC */
1316 1.1 christos
1317 1.1 christos #define YYABORT goto yyabort
1318 1.1 christos #define YYREJECT goto yyabort
1319 1.1 christos #define YYACCEPT goto yyaccept
1320 1.1 christos #define YYERROR goto yyerrlab
1321 1.1 christos #if YYBTYACC
1322 1.1 christos #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
1323 1.1 christos #define YYVALID_NESTED do { if (yyps->save && \
1324 1.1 christos yyps->save->save == 0) goto yyvalid; } while(0)
1325 1.1 christos #endif /* YYBTYACC */
1326 1.1 christos
1327 1.1 christos int
1328 1.1 christos YYPARSE_DECL()
1329 1.1 christos {
1330 1.1 christos int yym, yyn, yystate, yyresult;
1331 1.1 christos #if YYBTYACC
1332 1.1 christos int yynewerrflag;
1333 1.1 christos YYParseState *yyerrctx = NULL;
1334 1.1 christos #endif /* YYBTYACC */
1335 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1336 1.4 christos YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
1337 1.1 christos #endif
1338 1.1 christos #if YYDEBUG
1339 1.1 christos const char *yys;
1340 1.1 christos
1341 1.7 christos if ((yys = getenv("YYDEBUG")) != NULL)
1342 1.1 christos {
1343 1.1 christos yyn = *yys;
1344 1.1 christos if (yyn >= '0' && yyn <= '9')
1345 1.1 christos yydebug = yyn - '0';
1346 1.1 christos }
1347 1.1 christos if (yydebug)
1348 1.1 christos fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
1349 1.1 christos #endif
1350 1.3 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1351 1.3 christos memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
1352 1.3 christos #endif
1353 1.1 christos
1354 1.1 christos #if YYBTYACC
1355 1.7 christos yyps = yyNewState(0); if (yyps == NULL) goto yyenomem;
1356 1.7 christos yyps->save = NULL;
1357 1.1 christos #endif /* YYBTYACC */
1358 1.2 christos yym = 0;
1359 1.6 christos /* yyn is set below */
1360 1.1 christos yynerrs = 0;
1361 1.1 christos yyerrflag = 0;
1362 1.1 christos yychar = YYEMPTY;
1363 1.1 christos yystate = 0;
1364 1.1 christos
1365 1.1 christos #if YYPURE
1366 1.1 christos memset(&yystack, 0, sizeof(yystack));
1367 1.1 christos #endif
1368 1.1 christos
1369 1.1 christos if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1370 1.1 christos yystack.s_mark = yystack.s_base;
1371 1.1 christos yystack.l_mark = yystack.l_base;
1372 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1373 1.1 christos yystack.p_mark = yystack.p_base;
1374 1.1 christos #endif
1375 1.1 christos yystate = 0;
1376 1.1 christos *yystack.s_mark = 0;
1377 1.1 christos
1378 1.1 christos yyloop:
1379 1.1 christos if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1380 1.1 christos if (yychar < 0)
1381 1.1 christos {
1382 1.1 christos #if YYBTYACC
1383 1.1 christos do {
1384 1.1 christos if (yylvp < yylve)
1385 1.1 christos {
1386 1.1 christos /* we're currently re-reading tokens */
1387 1.1 christos yylval = *yylvp++;
1388 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1389 1.1 christos yylloc = *yylpp++;
1390 1.1 christos #endif
1391 1.1 christos yychar = *yylexp++;
1392 1.1 christos break;
1393 1.1 christos }
1394 1.1 christos if (yyps->save)
1395 1.1 christos {
1396 1.1 christos /* in trial mode; save scanner results for future parse attempts */
1397 1.1 christos if (yylvp == yylvlim)
1398 1.1 christos { /* Enlarge lexical value queue */
1399 1.1 christos size_t p = (size_t) (yylvp - yylvals);
1400 1.1 christos size_t s = (size_t) (yylvlim - yylvals);
1401 1.1 christos
1402 1.1 christos s += YYLVQUEUEGROWTH;
1403 1.4 christos if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
1404 1.4 christos if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1405 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1406 1.4 christos if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1407 1.1 christos #endif
1408 1.1 christos yylvp = yylve = yylvals + p;
1409 1.1 christos yylvlim = yylvals + s;
1410 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1411 1.1 christos yylpp = yylpe = yylpsns + p;
1412 1.1 christos yylplim = yylpsns + s;
1413 1.1 christos #endif
1414 1.1 christos yylexp = yylexemes + p;
1415 1.1 christos }
1416 1.2 christos *yylexp = (YYINT) YYLEX;
1417 1.1 christos *yylvp++ = yylval;
1418 1.1 christos yylve++;
1419 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1420 1.1 christos *yylpp++ = yylloc;
1421 1.1 christos yylpe++;
1422 1.1 christos #endif
1423 1.1 christos yychar = *yylexp++;
1424 1.1 christos break;
1425 1.1 christos }
1426 1.1 christos /* normal operation, no conflict encountered */
1427 1.1 christos #endif /* YYBTYACC */
1428 1.1 christos yychar = YYLEX;
1429 1.1 christos #if YYBTYACC
1430 1.1 christos } while (0);
1431 1.1 christos #endif /* YYBTYACC */
1432 1.1 christos if (yychar < 0) yychar = YYEOF;
1433 1.1 christos #if YYDEBUG
1434 1.1 christos if (yydebug)
1435 1.1 christos {
1436 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1437 1.1 christos fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
1438 1.1 christos YYDEBUGSTR, yydepth, yystate, yychar, yys);
1439 1.1 christos #ifdef YYSTYPE_TOSTRING
1440 1.1 christos #if YYBTYACC
1441 1.1 christos if (!yytrial)
1442 1.1 christos #endif /* YYBTYACC */
1443 1.1 christos fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
1444 1.1 christos #endif
1445 1.1 christos fputc('\n', stderr);
1446 1.1 christos }
1447 1.1 christos #endif
1448 1.1 christos }
1449 1.1 christos #if YYBTYACC
1450 1.1 christos
1451 1.1 christos /* Do we have a conflict? */
1452 1.1 christos if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1453 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1454 1.1 christos {
1455 1.1 christos YYINT ctry;
1456 1.1 christos
1457 1.1 christos if (yypath)
1458 1.1 christos {
1459 1.1 christos YYParseState *save;
1460 1.1 christos #if YYDEBUG
1461 1.1 christos if (yydebug)
1462 1.1 christos fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
1463 1.1 christos YYDEBUGSTR, yydepth, yystate);
1464 1.1 christos #endif
1465 1.1 christos /* Switch to the next conflict context */
1466 1.1 christos save = yypath;
1467 1.1 christos yypath = save->save;
1468 1.1 christos save->save = NULL;
1469 1.1 christos ctry = save->ctry;
1470 1.1 christos if (save->state != yystate) YYABORT;
1471 1.1 christos yyFreeState(save);
1472 1.1 christos
1473 1.1 christos }
1474 1.1 christos else
1475 1.1 christos {
1476 1.1 christos
1477 1.1 christos /* Unresolved conflict - start/continue trial parse */
1478 1.1 christos YYParseState *save;
1479 1.1 christos #if YYDEBUG
1480 1.1 christos if (yydebug)
1481 1.1 christos {
1482 1.1 christos fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
1483 1.1 christos if (yyps->save)
1484 1.1 christos fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
1485 1.1 christos else
1486 1.1 christos fputs("Starting trial parse.\n", stderr);
1487 1.1 christos }
1488 1.1 christos #endif
1489 1.1 christos save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1490 1.1 christos if (save == NULL) goto yyenomem;
1491 1.1 christos save->save = yyps->save;
1492 1.1 christos save->state = yystate;
1493 1.1 christos save->errflag = yyerrflag;
1494 1.1 christos save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1495 1.2 christos memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1496 1.1 christos save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1497 1.1 christos memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1498 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1499 1.1 christos save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1500 1.1 christos memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1501 1.1 christos #endif
1502 1.1 christos ctry = yytable[yyn];
1503 1.1 christos if (yyctable[ctry] == -1)
1504 1.1 christos {
1505 1.1 christos #if YYDEBUG
1506 1.1 christos if (yydebug && yychar >= YYEOF)
1507 1.1 christos fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1508 1.1 christos #endif
1509 1.1 christos ctry++;
1510 1.1 christos }
1511 1.1 christos save->ctry = ctry;
1512 1.1 christos if (yyps->save == NULL)
1513 1.1 christos {
1514 1.1 christos /* If this is a first conflict in the stack, start saving lexemes */
1515 1.1 christos if (!yylexemes)
1516 1.1 christos {
1517 1.4 christos yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
1518 1.1 christos if (yylexemes == NULL) goto yyenomem;
1519 1.1 christos yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
1520 1.1 christos if (yylvals == NULL) goto yyenomem;
1521 1.1 christos yylvlim = yylvals + YYLVQUEUEGROWTH;
1522 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1523 1.1 christos yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
1524 1.1 christos if (yylpsns == NULL) goto yyenomem;
1525 1.1 christos yylplim = yylpsns + YYLVQUEUEGROWTH;
1526 1.1 christos #endif
1527 1.1 christos }
1528 1.1 christos if (yylvp == yylve)
1529 1.1 christos {
1530 1.1 christos yylvp = yylve = yylvals;
1531 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1532 1.1 christos yylpp = yylpe = yylpsns;
1533 1.1 christos #endif
1534 1.1 christos yylexp = yylexemes;
1535 1.1 christos if (yychar >= YYEOF)
1536 1.1 christos {
1537 1.1 christos *yylve++ = yylval;
1538 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1539 1.1 christos *yylpe++ = yylloc;
1540 1.1 christos #endif
1541 1.2 christos *yylexp = (YYINT) yychar;
1542 1.1 christos yychar = YYEMPTY;
1543 1.1 christos }
1544 1.1 christos }
1545 1.1 christos }
1546 1.1 christos if (yychar >= YYEOF)
1547 1.1 christos {
1548 1.1 christos yylvp--;
1549 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1550 1.1 christos yylpp--;
1551 1.1 christos #endif
1552 1.1 christos yylexp--;
1553 1.1 christos yychar = YYEMPTY;
1554 1.1 christos }
1555 1.1 christos save->lexeme = (int) (yylvp - yylvals);
1556 1.1 christos yyps->save = save;
1557 1.1 christos }
1558 1.1 christos if (yytable[yyn] == ctry)
1559 1.1 christos {
1560 1.1 christos #if YYDEBUG
1561 1.1 christos if (yydebug)
1562 1.1 christos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1563 1.1 christos YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1564 1.1 christos #endif
1565 1.1 christos if (yychar < 0)
1566 1.1 christos {
1567 1.1 christos yylvp++;
1568 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1569 1.1 christos yylpp++;
1570 1.1 christos #endif
1571 1.1 christos yylexp++;
1572 1.1 christos }
1573 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1574 1.1 christos goto yyoverflow;
1575 1.1 christos yystate = yyctable[ctry];
1576 1.2 christos *++yystack.s_mark = (YYINT) yystate;
1577 1.1 christos *++yystack.l_mark = yylval;
1578 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1579 1.1 christos *++yystack.p_mark = yylloc;
1580 1.1 christos #endif
1581 1.1 christos yychar = YYEMPTY;
1582 1.1 christos if (yyerrflag > 0) --yyerrflag;
1583 1.1 christos goto yyloop;
1584 1.1 christos }
1585 1.1 christos else
1586 1.1 christos {
1587 1.1 christos yyn = yyctable[ctry];
1588 1.1 christos goto yyreduce;
1589 1.1 christos }
1590 1.1 christos } /* End of code dealing with conflicts */
1591 1.1 christos #endif /* YYBTYACC */
1592 1.1 christos if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1593 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1594 1.1 christos {
1595 1.1 christos #if YYDEBUG
1596 1.1 christos if (yydebug)
1597 1.1 christos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1598 1.1 christos YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1599 1.1 christos #endif
1600 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1601 1.1 christos yystate = yytable[yyn];
1602 1.1 christos *++yystack.s_mark = yytable[yyn];
1603 1.1 christos *++yystack.l_mark = yylval;
1604 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1605 1.1 christos *++yystack.p_mark = yylloc;
1606 1.1 christos #endif
1607 1.1 christos yychar = YYEMPTY;
1608 1.1 christos if (yyerrflag > 0) --yyerrflag;
1609 1.1 christos goto yyloop;
1610 1.1 christos }
1611 1.1 christos if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1612 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1613 1.1 christos {
1614 1.1 christos yyn = yytable[yyn];
1615 1.1 christos goto yyreduce;
1616 1.1 christos }
1617 1.1 christos if (yyerrflag != 0) goto yyinrecovery;
1618 1.1 christos #if YYBTYACC
1619 1.1 christos
1620 1.1 christos yynewerrflag = 1;
1621 1.1 christos goto yyerrhandler;
1622 1.2 christos goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1623 1.1 christos
1624 1.1 christos yyerrlab:
1625 1.2 christos /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1626 1.2 christos * before looking for error recovery */
1627 1.2 christos yystack.s_mark -= yym;
1628 1.2 christos yystate = *yystack.s_mark;
1629 1.2 christos yystack.l_mark -= yym;
1630 1.2 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1631 1.2 christos yystack.p_mark -= yym;
1632 1.2 christos #endif
1633 1.2 christos
1634 1.1 christos yynewerrflag = 0;
1635 1.1 christos yyerrhandler:
1636 1.1 christos while (yyps->save)
1637 1.1 christos {
1638 1.1 christos int ctry;
1639 1.1 christos YYParseState *save = yyps->save;
1640 1.1 christos #if YYDEBUG
1641 1.1 christos if (yydebug)
1642 1.1 christos fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1643 1.1 christos YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1644 1.1 christos (int)(yylvp - yylvals - yyps->save->lexeme));
1645 1.1 christos #endif
1646 1.1 christos /* Memorize most forward-looking error state in case it's really an error. */
1647 1.1 christos if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1648 1.1 christos {
1649 1.1 christos /* Free old saved error context state */
1650 1.1 christos if (yyerrctx) yyFreeState(yyerrctx);
1651 1.1 christos /* Create and fill out new saved error context state */
1652 1.1 christos yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1653 1.1 christos if (yyerrctx == NULL) goto yyenomem;
1654 1.1 christos yyerrctx->save = yyps->save;
1655 1.1 christos yyerrctx->state = yystate;
1656 1.1 christos yyerrctx->errflag = yyerrflag;
1657 1.1 christos yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1658 1.2 christos memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1659 1.1 christos yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1660 1.1 christos memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1661 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1662 1.1 christos yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1663 1.1 christos memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1664 1.1 christos #endif
1665 1.1 christos yyerrctx->lexeme = (int) (yylvp - yylvals);
1666 1.1 christos }
1667 1.1 christos yylvp = yylvals + save->lexeme;
1668 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1669 1.1 christos yylpp = yylpsns + save->lexeme;
1670 1.1 christos #endif
1671 1.1 christos yylexp = yylexemes + save->lexeme;
1672 1.1 christos yychar = YYEMPTY;
1673 1.1 christos yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1674 1.2 christos memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1675 1.1 christos yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1676 1.1 christos memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1677 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1678 1.1 christos yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1679 1.1 christos memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1680 1.1 christos #endif
1681 1.1 christos ctry = ++save->ctry;
1682 1.1 christos yystate = save->state;
1683 1.1 christos /* We tried shift, try reduce now */
1684 1.1 christos if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1685 1.1 christos yyps->save = save->save;
1686 1.1 christos save->save = NULL;
1687 1.1 christos yyFreeState(save);
1688 1.1 christos
1689 1.1 christos /* Nothing left on the stack -- error */
1690 1.1 christos if (!yyps->save)
1691 1.1 christos {
1692 1.1 christos #if YYDEBUG
1693 1.1 christos if (yydebug)
1694 1.1 christos fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1695 1.1 christos YYPREFIX, yydepth);
1696 1.1 christos #endif
1697 1.1 christos /* Restore state as it was in the most forward-advanced error */
1698 1.1 christos yylvp = yylvals + yyerrctx->lexeme;
1699 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1700 1.1 christos yylpp = yylpsns + yyerrctx->lexeme;
1701 1.1 christos #endif
1702 1.1 christos yylexp = yylexemes + yyerrctx->lexeme;
1703 1.1 christos yychar = yylexp[-1];
1704 1.1 christos yylval = yylvp[-1];
1705 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1706 1.1 christos yylloc = yylpp[-1];
1707 1.1 christos #endif
1708 1.1 christos yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1709 1.2 christos memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1710 1.1 christos yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1711 1.1 christos memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1712 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1713 1.1 christos yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1714 1.1 christos memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1715 1.1 christos #endif
1716 1.1 christos yystate = yyerrctx->state;
1717 1.1 christos yyFreeState(yyerrctx);
1718 1.1 christos yyerrctx = NULL;
1719 1.1 christos }
1720 1.1 christos yynewerrflag = 1;
1721 1.1 christos }
1722 1.1 christos if (yynewerrflag == 0) goto yyinrecovery;
1723 1.1 christos #endif /* YYBTYACC */
1724 1.1 christos
1725 1.1 christos YYERROR_CALL("syntax error");
1726 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1727 1.4 christos yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
1728 1.1 christos #endif
1729 1.1 christos
1730 1.1 christos #if !YYBTYACC
1731 1.2 christos goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1732 1.1 christos yyerrlab:
1733 1.1 christos #endif
1734 1.1 christos ++yynerrs;
1735 1.1 christos
1736 1.1 christos yyinrecovery:
1737 1.1 christos if (yyerrflag < 3)
1738 1.1 christos {
1739 1.1 christos yyerrflag = 3;
1740 1.1 christos for (;;)
1741 1.1 christos {
1742 1.1 christos if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1743 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1744 1.1 christos {
1745 1.1 christos #if YYDEBUG
1746 1.1 christos if (yydebug)
1747 1.1 christos fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1748 1.1 christos YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1749 1.1 christos #endif
1750 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1751 1.1 christos yystate = yytable[yyn];
1752 1.1 christos *++yystack.s_mark = yytable[yyn];
1753 1.1 christos *++yystack.l_mark = yylval;
1754 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1755 1.1 christos /* lookahead position is error end position */
1756 1.4 christos yyerror_loc_range[2] = yylloc;
1757 1.1 christos YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1758 1.1 christos *++yystack.p_mark = yyloc;
1759 1.1 christos #endif
1760 1.1 christos goto yyloop;
1761 1.1 christos }
1762 1.1 christos else
1763 1.1 christos {
1764 1.1 christos #if YYDEBUG
1765 1.1 christos if (yydebug)
1766 1.1 christos fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1767 1.1 christos YYDEBUGSTR, yydepth, *yystack.s_mark);
1768 1.1 christos #endif
1769 1.1 christos if (yystack.s_mark <= yystack.s_base) goto yyabort;
1770 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1771 1.1 christos /* the current TOS position is the error start position */
1772 1.4 christos yyerror_loc_range[1] = *yystack.p_mark;
1773 1.1 christos #endif
1774 1.1 christos #if defined(YYDESTRUCT_CALL)
1775 1.1 christos #if YYBTYACC
1776 1.1 christos if (!yytrial)
1777 1.1 christos #endif /* YYBTYACC */
1778 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1779 1.1 christos YYDESTRUCT_CALL("error: discarding state",
1780 1.1 christos yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1781 1.1 christos #else
1782 1.1 christos YYDESTRUCT_CALL("error: discarding state",
1783 1.1 christos yystos[*yystack.s_mark], yystack.l_mark);
1784 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1785 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */
1786 1.1 christos --yystack.s_mark;
1787 1.1 christos --yystack.l_mark;
1788 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1789 1.1 christos --yystack.p_mark;
1790 1.1 christos #endif
1791 1.1 christos }
1792 1.1 christos }
1793 1.1 christos }
1794 1.1 christos else
1795 1.1 christos {
1796 1.1 christos if (yychar == YYEOF) goto yyabort;
1797 1.1 christos #if YYDEBUG
1798 1.1 christos if (yydebug)
1799 1.1 christos {
1800 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1801 1.1 christos fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1802 1.1 christos YYDEBUGSTR, yydepth, yystate, yychar, yys);
1803 1.1 christos }
1804 1.1 christos #endif
1805 1.1 christos #if defined(YYDESTRUCT_CALL)
1806 1.1 christos #if YYBTYACC
1807 1.1 christos if (!yytrial)
1808 1.1 christos #endif /* YYBTYACC */
1809 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1810 1.1 christos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1811 1.1 christos #else
1812 1.1 christos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1813 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1814 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */
1815 1.1 christos yychar = YYEMPTY;
1816 1.1 christos goto yyloop;
1817 1.1 christos }
1818 1.1 christos
1819 1.1 christos yyreduce:
1820 1.1 christos yym = yylen[yyn];
1821 1.1 christos #if YYDEBUG
1822 1.1 christos if (yydebug)
1823 1.1 christos {
1824 1.1 christos fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1825 1.1 christos YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1826 1.1 christos #ifdef YYSTYPE_TOSTRING
1827 1.1 christos #if YYBTYACC
1828 1.1 christos if (!yytrial)
1829 1.1 christos #endif /* YYBTYACC */
1830 1.1 christos if (yym > 0)
1831 1.1 christos {
1832 1.1 christos int i;
1833 1.1 christos fputc('<', stderr);
1834 1.1 christos for (i = yym; i > 0; i--)
1835 1.1 christos {
1836 1.1 christos if (i != yym) fputs(", ", stderr);
1837 1.1 christos fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1838 1.1 christos yystack.l_mark[1-i]), stderr);
1839 1.1 christos }
1840 1.1 christos fputc('>', stderr);
1841 1.1 christos }
1842 1.1 christos #endif
1843 1.1 christos fputc('\n', stderr);
1844 1.1 christos }
1845 1.1 christos #endif
1846 1.1 christos if (yym > 0)
1847 1.1 christos yyval = yystack.l_mark[1-yym];
1848 1.1 christos else
1849 1.1 christos memset(&yyval, 0, sizeof yyval);
1850 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1851 1.1 christos
1852 1.1 christos /* Perform position reduction */
1853 1.1 christos memset(&yyloc, 0, sizeof(yyloc));
1854 1.1 christos #if YYBTYACC
1855 1.1 christos if (!yytrial)
1856 1.1 christos #endif /* YYBTYACC */
1857 1.1 christos {
1858 1.4 christos YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1859 1.1 christos /* just in case YYERROR is invoked within the action, save
1860 1.1 christos the start of the rhs as the error start position */
1861 1.4 christos yyerror_loc_range[1] = yystack.p_mark[1-yym];
1862 1.1 christos }
1863 1.1 christos #endif
1864 1.1 christos
1865 1.1 christos switch (yyn)
1866 1.1 christos {
1867 1.1 christos case 1:
1868 1.1 christos #line 93 "btyacc_demo.y"
1869 1.1 christos { yyval.scope = yystack.l_mark[0].scope; }
1870 1.7 christos #line 1869 "btyacc_demo.tab.c"
1871 1.1 christos break;
1872 1.1 christos case 2:
1873 1.1 christos #line 94 "btyacc_demo.y"
1874 1.1 christos { yyval.scope = global_scope; }
1875 1.7 christos #line 1874 "btyacc_demo.tab.c"
1876 1.1 christos break;
1877 1.1 christos case 3:
1878 1.1 christos #line 95 "btyacc_demo.y"
1879 1.1 christos { Decl *d = lookup(yystack.l_mark[-2].scope, yystack.l_mark[-1].id);
1880 1.1 christos if (!d || !d->scope) YYERROR;
1881 1.1 christos yyval.scope = d->scope; }
1882 1.7 christos #line 1881 "btyacc_demo.tab.c"
1883 1.1 christos break;
1884 1.1 christos case 4:
1885 1.1 christos #line 101 "btyacc_demo.y"
1886 1.1 christos { Decl *d = lookup(yystack.l_mark[-1].scope, yystack.l_mark[0].id);
1887 1.1 christos if (d == NULL || d->istype() == 0) YYERROR;
1888 1.1 christos yyval.type = d->type; }
1889 1.7 christos #line 1888 "btyacc_demo.tab.c"
1890 1.1 christos break;
1891 1.1 christos case 5:
1892 1.1 christos #line 106 "btyacc_demo.y"
1893 1.7 christos yyval.scope = global_scope = new_scope(NULL);
1894 1.7 christos #line 1893 "btyacc_demo.tab.c"
1895 1.1 christos break;
1896 1.1 christos case 8:
1897 1.1 christos #line 107 "btyacc_demo.y"
1898 1.1 christos yyval.scope = yystack.l_mark[-1].scope;
1899 1.7 christos #line 1898 "btyacc_demo.tab.c"
1900 1.1 christos break;
1901 1.1 christos case 10:
1902 1.1 christos #line 109 "btyacc_demo.y"
1903 1.2 christos {YYVALID;}
1904 1.7 christos #line 1903 "btyacc_demo.tab.c"
1905 1.1 christos break;
1906 1.1 christos case 11:
1907 1.2 christos #line 110 "btyacc_demo.y"
1908 1.2 christos yyval.scope = start_fn_def(yystack.l_mark[-2].scope, yystack.l_mark[0].decl);
1909 1.7 christos #line 1908 "btyacc_demo.tab.c"
1910 1.1 christos break;
1911 1.1 christos case 12:
1912 1.1 christos if (!yytrial)
1913 1.1 christos #line 111 "btyacc_demo.y"
1914 1.1 christos { /* demonstrate use of @$ & @N, although this is just the
1915 1.1 christos default computation and so is not necessary */
1916 1.2 christos yyloc.first_line = yystack.p_mark[-3].first_line;
1917 1.2 christos yyloc.first_column = yystack.p_mark[-3].first_column;
1918 1.1 christos yyloc.last_line = yystack.p_mark[0].last_line;
1919 1.1 christos yyloc.last_column = yystack.p_mark[0].last_column;
1920 1.1 christos finish_fn_def(yystack.l_mark[-2].decl, yystack.l_mark[0].code); }
1921 1.7 christos #line 1920 "btyacc_demo.tab.c"
1922 1.1 christos break;
1923 1.2 christos case 13:
1924 1.1 christos #line 121 "btyacc_demo.y"
1925 1.1 christos { yyval.type = yystack.l_mark[0].type; }
1926 1.7 christos #line 1925 "btyacc_demo.tab.c"
1927 1.1 christos break;
1928 1.2 christos case 14:
1929 1.1 christos #line 122 "btyacc_demo.y"
1930 1.1 christos { yyval.type = type_combine(yystack.l_mark[-2].type, yystack.l_mark[0].type); }
1931 1.7 christos #line 1930 "btyacc_demo.tab.c"
1932 1.1 christos break;
1933 1.2 christos case 15:
1934 1.1 christos #line 125 "btyacc_demo.y"
1935 1.7 christos { yyval.type = NULL; }
1936 1.7 christos #line 1935 "btyacc_demo.tab.c"
1937 1.1 christos break;
1938 1.2 christos case 16:
1939 1.1 christos #line 126 "btyacc_demo.y"
1940 1.1 christos { yyval.type = type_combine(yystack.l_mark[-1].type, yystack.l_mark[0].type); }
1941 1.7 christos #line 1940 "btyacc_demo.tab.c"
1942 1.1 christos break;
1943 1.2 christos case 17:
1944 1.1 christos #line 130 "btyacc_demo.y"
1945 1.1 christos { yyval.type = yystack.l_mark[0].type; }
1946 1.7 christos #line 1945 "btyacc_demo.tab.c"
1947 1.1 christos break;
1948 1.2 christos case 18:
1949 1.1 christos #line 131 "btyacc_demo.y"
1950 1.1 christos { yyval.type = yystack.l_mark[0].type; }
1951 1.7 christos #line 1950 "btyacc_demo.tab.c"
1952 1.1 christos break;
1953 1.2 christos case 19:
1954 1.1 christos #line 132 "btyacc_demo.y"
1955 1.1 christos { yyval.type = bare_extern(); }
1956 1.7 christos #line 1955 "btyacc_demo.tab.c"
1957 1.1 christos break;
1958 1.2 christos case 20:
1959 1.1 christos #line 133 "btyacc_demo.y"
1960 1.1 christos { yyval.type = bare_register(); }
1961 1.7 christos #line 1960 "btyacc_demo.tab.c"
1962 1.1 christos break;
1963 1.2 christos case 21:
1964 1.1 christos #line 134 "btyacc_demo.y"
1965 1.1 christos { yyval.type = bare_static(); }
1966 1.7 christos #line 1965 "btyacc_demo.tab.c"
1967 1.1 christos break;
1968 1.2 christos case 22:
1969 1.1 christos #line 138 "btyacc_demo.y"
1970 1.1 christos { yyval.type = bare_const(); }
1971 1.7 christos #line 1970 "btyacc_demo.tab.c"
1972 1.1 christos break;
1973 1.2 christos case 23:
1974 1.1 christos #line 139 "btyacc_demo.y"
1975 1.1 christos { yyval.type = bare_volatile(); }
1976 1.7 christos #line 1975 "btyacc_demo.tab.c"
1977 1.1 christos break;
1978 1.2 christos case 24:
1979 1.1 christos #line 143 "btyacc_demo.y"
1980 1.1 christos yyval.scope = yystack.l_mark[-3].scope;
1981 1.7 christos #line 1980 "btyacc_demo.tab.c"
1982 1.1 christos break;
1983 1.2 christos case 25:
1984 1.1 christos #line 143 "btyacc_demo.y"
1985 1.1 christos yyval.type = yystack.l_mark[-3].type;
1986 1.7 christos #line 1985 "btyacc_demo.tab.c"
1987 1.1 christos break;
1988 1.2 christos case 28:
1989 1.1 christos #line 148 "btyacc_demo.y"
1990 1.1 christos { if (!yystack.l_mark[0].type) YYERROR; } if (!yytrial)
1991 1.1 christos #line 149 "btyacc_demo.y"
1992 1.7 christos { yyval.decl = declare(yystack.l_mark[-1].scope, NULL, yystack.l_mark[0].type); }
1993 1.7 christos #line 1992 "btyacc_demo.tab.c"
1994 1.1 christos break;
1995 1.2 christos case 29:
1996 1.1 christos if (!yytrial)
1997 1.1 christos #line 150 "btyacc_demo.y"
1998 1.1 christos { yyval.decl = declare(yystack.l_mark[-2].scope, yystack.l_mark[0].id, yystack.l_mark[-1].type); }
1999 1.7 christos #line 1998 "btyacc_demo.tab.c"
2000 1.1 christos break;
2001 1.2 christos case 30:
2002 1.1 christos #line 151 "btyacc_demo.y"
2003 1.1 christos yyval.scope = yystack.l_mark[-2].scope;
2004 1.7 christos #line 2003 "btyacc_demo.tab.c"
2005 1.1 christos break;
2006 1.2 christos case 31:
2007 1.1 christos #line 151 "btyacc_demo.y"
2008 1.1 christos yyval.type = yystack.l_mark[-2].type;
2009 1.7 christos #line 2008 "btyacc_demo.tab.c"
2010 1.1 christos break;
2011 1.2 christos case 32:
2012 1.1 christos if (!yytrial)
2013 1.1 christos #line 151 "btyacc_demo.y"
2014 1.1 christos { yyval.decl = yystack.l_mark[-1].decl; }
2015 1.7 christos #line 2014 "btyacc_demo.tab.c"
2016 1.1 christos break;
2017 1.2 christos case 33:
2018 1.1 christos if (!yytrial)
2019 1.1 christos #line 153 "btyacc_demo.y"
2020 1.1 christos { yyval.decl = make_pointer(yystack.l_mark[0].decl, yystack.l_mark[-3].type); }
2021 1.7 christos #line 2020 "btyacc_demo.tab.c"
2022 1.1 christos break;
2023 1.2 christos case 34:
2024 1.1 christos if (!yytrial)
2025 1.1 christos #line 155 "btyacc_demo.y"
2026 1.1 christos { yyval.decl = make_array(yystack.l_mark[-4].decl->type, yystack.l_mark[-1].expr); }
2027 1.7 christos #line 2026 "btyacc_demo.tab.c"
2028 1.1 christos break;
2029 1.2 christos case 35:
2030 1.1 christos if (!yytrial)
2031 1.1 christos #line 157 "btyacc_demo.y"
2032 1.1 christos { yyval.decl = build_function(yystack.l_mark[-5].decl, yystack.l_mark[-2].dlist, yystack.l_mark[0].type); }
2033 1.7 christos #line 2032 "btyacc_demo.tab.c"
2034 1.1 christos break;
2035 1.2 christos case 36:
2036 1.1 christos if (!yytrial)
2037 1.1 christos #line 160 "btyacc_demo.y"
2038 1.7 christos { yyval.dlist = NULL; }
2039 1.7 christos #line 2038 "btyacc_demo.tab.c"
2040 1.1 christos break;
2041 1.2 christos case 37:
2042 1.1 christos if (!yytrial)
2043 1.1 christos #line 161 "btyacc_demo.y"
2044 1.1 christos { yyval.dlist = yystack.l_mark[0].dlist; }
2045 1.7 christos #line 2044 "btyacc_demo.tab.c"
2046 1.1 christos break;
2047 1.2 christos case 38:
2048 1.1 christos if (!yytrial)
2049 1.1 christos #line 164 "btyacc_demo.y"
2050 1.1 christos { yyval.dlist = append_dlist(yystack.l_mark[-3].dlist, yystack.l_mark[0].decl); }
2051 1.7 christos #line 2050 "btyacc_demo.tab.c"
2052 1.1 christos break;
2053 1.2 christos case 39:
2054 1.1 christos if (!yytrial)
2055 1.1 christos #line 165 "btyacc_demo.y"
2056 1.1 christos { yyval.dlist = build_dlist(yystack.l_mark[0].decl); }
2057 1.7 christos #line 2056 "btyacc_demo.tab.c"
2058 1.1 christos break;
2059 1.2 christos case 40:
2060 1.1 christos if (!yytrial)
2061 1.1 christos #line 168 "btyacc_demo.y"
2062 1.1 christos { yyval.decl = yystack.l_mark[0].decl; }
2063 1.7 christos #line 2062 "btyacc_demo.tab.c"
2064 1.1 christos break;
2065 1.2 christos case 41:
2066 1.1 christos if (!yytrial)
2067 1.1 christos #line 172 "btyacc_demo.y"
2068 1.1 christos { yyval.expr = build_expr(yystack.l_mark[-3].expr, ADD, yystack.l_mark[0].expr); }
2069 1.7 christos #line 2068 "btyacc_demo.tab.c"
2070 1.1 christos break;
2071 1.2 christos case 42:
2072 1.1 christos if (!yytrial)
2073 1.1 christos #line 173 "btyacc_demo.y"
2074 1.1 christos { yyval.expr = build_expr(yystack.l_mark[-3].expr, SUB, yystack.l_mark[0].expr); }
2075 1.7 christos #line 2074 "btyacc_demo.tab.c"
2076 1.1 christos break;
2077 1.2 christos case 43:
2078 1.1 christos if (!yytrial)
2079 1.1 christos #line 174 "btyacc_demo.y"
2080 1.1 christos { yyval.expr = build_expr(yystack.l_mark[-3].expr, MUL, yystack.l_mark[0].expr); }
2081 1.7 christos #line 2080 "btyacc_demo.tab.c"
2082 1.1 christos break;
2083 1.2 christos case 44:
2084 1.1 christos if (!yytrial)
2085 1.1 christos #line 175 "btyacc_demo.y"
2086 1.1 christos { yyval.expr = build_expr(yystack.l_mark[-3].expr, MOD, yystack.l_mark[0].expr); }
2087 1.7 christos #line 2086 "btyacc_demo.tab.c"
2088 1.1 christos break;
2089 1.2 christos case 45:
2090 1.1 christos if (!yytrial)
2091 1.1 christos #line 176 "btyacc_demo.y"
2092 1.1 christos { yyval.expr = build_expr(yystack.l_mark[-3].expr, DIV, yystack.l_mark[0].expr); }
2093 1.7 christos #line 2092 "btyacc_demo.tab.c"
2094 1.1 christos break;
2095 1.2 christos case 46:
2096 1.1 christos if (!yytrial)
2097 1.1 christos #line 177 "btyacc_demo.y"
2098 1.7 christos { yyval.expr = build_expr(NULL, DEREF, yystack.l_mark[0].expr); }
2099 1.7 christos #line 2098 "btyacc_demo.tab.c"
2100 1.1 christos break;
2101 1.2 christos case 47:
2102 1.1 christos if (!yytrial)
2103 1.1 christos #line 178 "btyacc_demo.y"
2104 1.1 christos { yyval.expr = var_expr(yystack.l_mark[-1].scope, yystack.l_mark[0].id); }
2105 1.7 christos #line 2104 "btyacc_demo.tab.c"
2106 1.1 christos break;
2107 1.2 christos case 48:
2108 1.1 christos if (!yytrial)
2109 1.1 christos #line 179 "btyacc_demo.y"
2110 1.1 christos { yyval.expr = yystack.l_mark[0].expr; }
2111 1.7 christos #line 2110 "btyacc_demo.tab.c"
2112 1.1 christos break;
2113 1.2 christos case 49:
2114 1.1 christos if (!yytrial)
2115 1.1 christos #line 183 "btyacc_demo.y"
2116 1.7 christos { yyval.code = NULL; }
2117 1.7 christos #line 2116 "btyacc_demo.tab.c"
2118 1.1 christos break;
2119 1.2 christos case 50:
2120 1.1 christos #line 184 "btyacc_demo.y"
2121 1.1 christos {YYVALID;} if (!yytrial)
2122 1.1 christos #line 184 "btyacc_demo.y"
2123 1.1 christos { yyval.code = build_expr_code(yystack.l_mark[-1].expr); }
2124 1.7 christos #line 2123 "btyacc_demo.tab.c"
2125 1.1 christos break;
2126 1.2 christos case 51:
2127 1.1 christos #line 185 "btyacc_demo.y"
2128 1.1 christos yyval.scope = yystack.l_mark[-6].scope;
2129 1.7 christos #line 2128 "btyacc_demo.tab.c"
2130 1.1 christos break;
2131 1.2 christos case 52:
2132 1.1 christos #line 185 "btyacc_demo.y"
2133 1.1 christos yyval.scope = yystack.l_mark[-9].scope;
2134 1.7 christos #line 2133 "btyacc_demo.tab.c"
2135 1.1 christos break;
2136 1.2 christos case 53:
2137 1.1 christos #line 185 "btyacc_demo.y"
2138 1.1 christos {YYVALID;} if (!yytrial)
2139 1.1 christos #line 186 "btyacc_demo.y"
2140 1.1 christos { yyval.code = build_if(yystack.l_mark[-7].expr, yystack.l_mark[-3].code, yystack.l_mark[0].code); }
2141 1.7 christos #line 2140 "btyacc_demo.tab.c"
2142 1.1 christos break;
2143 1.2 christos case 54:
2144 1.1 christos #line 187 "btyacc_demo.y"
2145 1.1 christos {YYVALID;} if (!yytrial)
2146 1.1 christos #line 188 "btyacc_demo.y"
2147 1.7 christos { yyval.code = build_if(yystack.l_mark[-4].expr, yystack.l_mark[0].code, NULL); }
2148 1.7 christos #line 2147 "btyacc_demo.tab.c"
2149 1.1 christos break;
2150 1.2 christos case 55:
2151 1.1 christos #line 189 "btyacc_demo.y"
2152 1.1 christos yyval.scope = new_scope(yystack.l_mark[0].scope);
2153 1.7 christos #line 2152 "btyacc_demo.tab.c"
2154 1.1 christos break;
2155 1.2 christos case 56:
2156 1.1 christos #line 189 "btyacc_demo.y"
2157 1.1 christos {YYVALID;} if (!yytrial)
2158 1.1 christos #line 189 "btyacc_demo.y"
2159 1.1 christos { yyval.code = yystack.l_mark[0].code; }
2160 1.7 christos #line 2159 "btyacc_demo.tab.c"
2161 1.1 christos break;
2162 1.2 christos case 57:
2163 1.1 christos if (!yytrial)
2164 1.1 christos #line 192 "btyacc_demo.y"
2165 1.7 christos { yyval.code = NULL; }
2166 1.7 christos #line 2165 "btyacc_demo.tab.c"
2167 1.1 christos break;
2168 1.2 christos case 58:
2169 1.1 christos if (!yytrial)
2170 1.1 christos #line 193 "btyacc_demo.y"
2171 1.1 christos { yyval.code = code_append(yystack.l_mark[-2].code, yystack.l_mark[0].code); }
2172 1.7 christos #line 2171 "btyacc_demo.tab.c"
2173 1.1 christos break;
2174 1.2 christos case 59:
2175 1.1 christos if (!yytrial)
2176 1.1 christos #line 197 "btyacc_demo.y"
2177 1.1 christos { yyval.code = yystack.l_mark[-1].code; }
2178 1.7 christos #line 2177 "btyacc_demo.tab.c"
2179 1.1 christos break;
2180 1.7 christos #line 2179 "btyacc_demo.tab.c"
2181 1.1 christos default:
2182 1.1 christos break;
2183 1.1 christos }
2184 1.1 christos yystack.s_mark -= yym;
2185 1.1 christos yystate = *yystack.s_mark;
2186 1.1 christos yystack.l_mark -= yym;
2187 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2188 1.1 christos yystack.p_mark -= yym;
2189 1.1 christos #endif
2190 1.1 christos yym = yylhs[yyn];
2191 1.1 christos if (yystate == 0 && yym == 0)
2192 1.1 christos {
2193 1.1 christos #if YYDEBUG
2194 1.1 christos if (yydebug)
2195 1.1 christos {
2196 1.1 christos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2197 1.1 christos #ifdef YYSTYPE_TOSTRING
2198 1.1 christos #if YYBTYACC
2199 1.1 christos if (!yytrial)
2200 1.1 christos #endif /* YYBTYACC */
2201 1.1 christos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
2202 1.1 christos #endif
2203 1.1 christos fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
2204 1.1 christos }
2205 1.1 christos #endif
2206 1.1 christos yystate = YYFINAL;
2207 1.1 christos *++yystack.s_mark = YYFINAL;
2208 1.1 christos *++yystack.l_mark = yyval;
2209 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2210 1.1 christos *++yystack.p_mark = yyloc;
2211 1.1 christos #endif
2212 1.1 christos if (yychar < 0)
2213 1.1 christos {
2214 1.1 christos #if YYBTYACC
2215 1.1 christos do {
2216 1.1 christos if (yylvp < yylve)
2217 1.1 christos {
2218 1.1 christos /* we're currently re-reading tokens */
2219 1.1 christos yylval = *yylvp++;
2220 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2221 1.1 christos yylloc = *yylpp++;
2222 1.1 christos #endif
2223 1.1 christos yychar = *yylexp++;
2224 1.1 christos break;
2225 1.1 christos }
2226 1.1 christos if (yyps->save)
2227 1.1 christos {
2228 1.1 christos /* in trial mode; save scanner results for future parse attempts */
2229 1.1 christos if (yylvp == yylvlim)
2230 1.1 christos { /* Enlarge lexical value queue */
2231 1.1 christos size_t p = (size_t) (yylvp - yylvals);
2232 1.1 christos size_t s = (size_t) (yylvlim - yylvals);
2233 1.1 christos
2234 1.1 christos s += YYLVQUEUEGROWTH;
2235 1.4 christos if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
2236 1.1 christos goto yyenomem;
2237 1.4 christos if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2238 1.1 christos goto yyenomem;
2239 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2240 1.4 christos if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
2241 1.1 christos goto yyenomem;
2242 1.1 christos #endif
2243 1.1 christos yylvp = yylve = yylvals + p;
2244 1.1 christos yylvlim = yylvals + s;
2245 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2246 1.1 christos yylpp = yylpe = yylpsns + p;
2247 1.1 christos yylplim = yylpsns + s;
2248 1.1 christos #endif
2249 1.1 christos yylexp = yylexemes + p;
2250 1.1 christos }
2251 1.2 christos *yylexp = (YYINT) YYLEX;
2252 1.1 christos *yylvp++ = yylval;
2253 1.1 christos yylve++;
2254 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2255 1.1 christos *yylpp++ = yylloc;
2256 1.1 christos yylpe++;
2257 1.1 christos #endif
2258 1.1 christos yychar = *yylexp++;
2259 1.1 christos break;
2260 1.1 christos }
2261 1.1 christos /* normal operation, no conflict encountered */
2262 1.1 christos #endif /* YYBTYACC */
2263 1.1 christos yychar = YYLEX;
2264 1.1 christos #if YYBTYACC
2265 1.1 christos } while (0);
2266 1.1 christos #endif /* YYBTYACC */
2267 1.1 christos if (yychar < 0) yychar = YYEOF;
2268 1.1 christos #if YYDEBUG
2269 1.1 christos if (yydebug)
2270 1.1 christos {
2271 1.2 christos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
2272 1.2 christos fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
2273 1.1 christos YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
2274 1.1 christos }
2275 1.1 christos #endif
2276 1.1 christos }
2277 1.1 christos if (yychar == YYEOF) goto yyaccept;
2278 1.1 christos goto yyloop;
2279 1.1 christos }
2280 1.1 christos if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
2281 1.1 christos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
2282 1.1 christos yystate = yytable[yyn];
2283 1.1 christos else
2284 1.1 christos yystate = yydgoto[yym];
2285 1.1 christos #if YYDEBUG
2286 1.1 christos if (yydebug)
2287 1.1 christos {
2288 1.1 christos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2289 1.1 christos #ifdef YYSTYPE_TOSTRING
2290 1.1 christos #if YYBTYACC
2291 1.1 christos if (!yytrial)
2292 1.1 christos #endif /* YYBTYACC */
2293 1.1 christos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
2294 1.1 christos #endif
2295 1.1 christos fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
2296 1.1 christos }
2297 1.1 christos #endif
2298 1.1 christos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
2299 1.2 christos *++yystack.s_mark = (YYINT) yystate;
2300 1.1 christos *++yystack.l_mark = yyval;
2301 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2302 1.1 christos *++yystack.p_mark = yyloc;
2303 1.1 christos #endif
2304 1.1 christos goto yyloop;
2305 1.1 christos #if YYBTYACC
2306 1.1 christos
2307 1.1 christos /* Reduction declares that this path is valid. Set yypath and do a full parse */
2308 1.1 christos yyvalid:
2309 1.1 christos if (yypath) YYABORT;
2310 1.1 christos while (yyps->save)
2311 1.1 christos {
2312 1.1 christos YYParseState *save = yyps->save;
2313 1.1 christos yyps->save = save->save;
2314 1.1 christos save->save = yypath;
2315 1.1 christos yypath = save;
2316 1.1 christos }
2317 1.1 christos #if YYDEBUG
2318 1.1 christos if (yydebug)
2319 1.1 christos fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
2320 1.1 christos YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
2321 1.1 christos #endif
2322 1.1 christos if (yyerrctx)
2323 1.1 christos {
2324 1.1 christos yyFreeState(yyerrctx);
2325 1.1 christos yyerrctx = NULL;
2326 1.1 christos }
2327 1.1 christos yylvp = yylvals + yypath->lexeme;
2328 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2329 1.1 christos yylpp = yylpsns + yypath->lexeme;
2330 1.1 christos #endif
2331 1.1 christos yylexp = yylexemes + yypath->lexeme;
2332 1.1 christos yychar = YYEMPTY;
2333 1.1 christos yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2334 1.2 christos memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
2335 1.1 christos yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2336 1.1 christos memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2337 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2338 1.1 christos yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2339 1.1 christos memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2340 1.1 christos #endif
2341 1.1 christos yystate = yypath->state;
2342 1.1 christos goto yyloop;
2343 1.1 christos #endif /* YYBTYACC */
2344 1.1 christos
2345 1.1 christos yyoverflow:
2346 1.1 christos YYERROR_CALL("yacc stack overflow");
2347 1.1 christos #if YYBTYACC
2348 1.1 christos goto yyabort_nomem;
2349 1.1 christos yyenomem:
2350 1.1 christos YYERROR_CALL("memory exhausted");
2351 1.1 christos yyabort_nomem:
2352 1.1 christos #endif /* YYBTYACC */
2353 1.1 christos yyresult = 2;
2354 1.1 christos goto yyreturn;
2355 1.1 christos
2356 1.1 christos yyabort:
2357 1.1 christos yyresult = 1;
2358 1.1 christos goto yyreturn;
2359 1.1 christos
2360 1.1 christos yyaccept:
2361 1.1 christos #if YYBTYACC
2362 1.1 christos if (yyps->save) goto yyvalid;
2363 1.1 christos #endif /* YYBTYACC */
2364 1.1 christos yyresult = 0;
2365 1.1 christos
2366 1.1 christos yyreturn:
2367 1.1 christos #if defined(YYDESTRUCT_CALL)
2368 1.1 christos if (yychar != YYEOF && yychar != YYEMPTY)
2369 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2370 1.1 christos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
2371 1.1 christos #else
2372 1.1 christos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
2373 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2374 1.1 christos
2375 1.1 christos {
2376 1.1 christos YYSTYPE *pv;
2377 1.1 christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2378 1.1 christos YYLTYPE *pp;
2379 1.1 christos
2380 1.1 christos for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
2381 1.1 christos YYDESTRUCT_CALL("cleanup: discarding state",
2382 1.1 christos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
2383 1.1 christos #else
2384 1.1 christos for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
2385 1.1 christos YYDESTRUCT_CALL("cleanup: discarding state",
2386 1.1 christos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
2387 1.1 christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2388 1.1 christos }
2389 1.1 christos #endif /* defined(YYDESTRUCT_CALL) */
2390 1.1 christos
2391 1.1 christos #if YYBTYACC
2392 1.1 christos if (yyerrctx)
2393 1.1 christos {
2394 1.1 christos yyFreeState(yyerrctx);
2395 1.1 christos yyerrctx = NULL;
2396 1.1 christos }
2397 1.1 christos while (yyps)
2398 1.1 christos {
2399 1.1 christos YYParseState *save = yyps;
2400 1.1 christos yyps = save->save;
2401 1.1 christos save->save = NULL;
2402 1.1 christos yyFreeState(save);
2403 1.1 christos }
2404 1.1 christos while (yypath)
2405 1.1 christos {
2406 1.1 christos YYParseState *save = yypath;
2407 1.1 christos yypath = save->save;
2408 1.1 christos save->save = NULL;
2409 1.1 christos yyFreeState(save);
2410 1.1 christos }
2411 1.1 christos #endif /* YYBTYACC */
2412 1.1 christos yyfreestack(&yystack);
2413 1.1 christos return (yyresult);
2414 1.1 christos }
2415