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