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