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