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