btyacc_destroy1.tab.c revision 1.1.1.4 1 /* $NetBSD: btyacc_destroy1.tab.c,v 1.1.1.4 2017/02/11 19:30:03 christos Exp $ */
2
3 /* original parser id follows */
4 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
5 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
6
7 #define YYBYACC 1
8 #define YYMAJOR 1
9 #define YYMINOR 9
10 #define YYCHECK "yyyymmdd"
11
12 #define YYEMPTY (-1)
13 #define yyclearin (yychar = YYEMPTY)
14 #define yyerrok (yyerrflag = 0)
15 #define YYRECOVERING() (yyerrflag != 0)
16 #define YYENOMEM (-2)
17 #define YYEOF 0
18 #undef YYBTYACC
19 #define YYBTYACC 1
20 #define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
21
22 #ifndef yyparse
23 #define yyparse destroy1_parse
24 #endif /* yyparse */
25
26 #ifndef yylex
27 #define yylex destroy1_lex
28 #endif /* yylex */
29
30 #ifndef yyerror
31 #define yyerror destroy1_error
32 #endif /* yyerror */
33
34 #ifndef yychar
35 #define yychar destroy1_char
36 #endif /* yychar */
37
38 #ifndef yyval
39 #define yyval destroy1_val
40 #endif /* yyval */
41
42 #ifndef yylval
43 #define yylval destroy1_lval
44 #endif /* yylval */
45
46 #ifndef yydebug
47 #define yydebug destroy1_debug
48 #endif /* yydebug */
49
50 #ifndef yynerrs
51 #define yynerrs destroy1_nerrs
52 #endif /* yynerrs */
53
54 #ifndef yyerrflag
55 #define yyerrflag destroy1_errflag
56 #endif /* yyerrflag */
57
58 #ifndef yylhs
59 #define yylhs destroy1_lhs
60 #endif /* yylhs */
61
62 #ifndef yylen
63 #define yylen destroy1_len
64 #endif /* yylen */
65
66 #ifndef yydefred
67 #define yydefred destroy1_defred
68 #endif /* yydefred */
69
70 #ifndef yystos
71 #define yystos destroy1_stos
72 #endif /* yystos */
73
74 #ifndef yydgoto
75 #define yydgoto destroy1_dgoto
76 #endif /* yydgoto */
77
78 #ifndef yysindex
79 #define yysindex destroy1_sindex
80 #endif /* yysindex */
81
82 #ifndef yyrindex
83 #define yyrindex destroy1_rindex
84 #endif /* yyrindex */
85
86 #ifndef yygindex
87 #define yygindex destroy1_gindex
88 #endif /* yygindex */
89
90 #ifndef yytable
91 #define yytable destroy1_table
92 #endif /* yytable */
93
94 #ifndef yycheck
95 #define yycheck destroy1_check
96 #endif /* yycheck */
97
98 #ifndef yyname
99 #define yyname destroy1_name
100 #endif /* yyname */
101
102 #ifndef yyrule
103 #define yyrule destroy1_rule
104 #endif /* yyrule */
105
106 #if YYBTYACC
107
108 #ifndef yycindex
109 #define yycindex destroy1_cindex
110 #endif /* yycindex */
111
112 #ifndef yyctable
113 #define yyctable destroy1_ctable
114 #endif /* yyctable */
115
116 #endif /* YYBTYACC */
117
118 #define YYPREFIX "destroy1_"
119
120 #define YYPURE 0
121
122 #line 4 "btyacc_destroy1.y"
123 #include <stdlib.h>
124
125 typedef enum {cGLOBAL, cLOCAL} class;
126 typedef enum {tREAL, tINTEGER} type;
127 typedef char * name;
128
129 struct symbol { class c; type t; name id; };
130 typedef struct symbol symbol;
131
132 struct namelist { symbol *s; struct namelist *next; };
133 typedef struct namelist namelist;
134
135 struct parser_param {
136 int *rtrn;
137 symbol ss;
138 };
139
140 extern symbol *mksymbol(type t, class c, name id);
141
142 #ifdef YYBISON
143 #define YYLEX_DECL() yylex(void)
144 #define YYERROR_DECL() yyerror(const char *s)
145 #endif
146 #ifdef YYSTYPE
147 #undef YYSTYPE_IS_DECLARED
148 #define YYSTYPE_IS_DECLARED 1
149 #endif
150 #ifndef YYSTYPE_IS_DECLARED
151 #define YYSTYPE_IS_DECLARED 1
152 #line 50 "btyacc_destroy1.y"
153 typedef union
154 {
155 class cval;
156 type tval;
157 namelist * nlist;
158 name id;
159 } YYSTYPE;
160 #endif /* !YYSTYPE_IS_DECLARED */
161 #line 160 "btyacc_destroy1.tab.c"
162
163 /* compatibility with bison */
164 #ifdef YYPARSE_PARAM
165 /* compatibility with FreeBSD */
166 # ifdef YYPARSE_PARAM_TYPE
167 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
168 # else
169 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
170 # endif
171 #else
172 # define YYPARSE_DECL() yyparse(struct parser_param *param, int flag)
173 #endif
174
175 /* Parameters sent to lex. */
176 #ifdef YYLEX_PARAM
177 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
178 # define YYLEX yylex(YYLEX_PARAM)
179 #else
180 # define YYLEX_DECL() yylex(void)
181 # define YYLEX yylex()
182 #endif
183
184 /* Parameters sent to yyerror. */
185 #ifndef YYERROR_DECL
186 #define YYERROR_DECL() yyerror(struct parser_param *param, int flag, const char *s)
187 #endif
188 #ifndef YYERROR_CALL
189 #define YYERROR_CALL(msg) yyerror(param, flag, msg)
190 #endif
191
192 #ifndef YYDESTRUCT_DECL
193 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, struct parser_param *param, int flag)
194 #endif
195 #ifndef YYDESTRUCT_CALL
196 #define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val, param, flag)
197 #endif
198
199 extern int YYPARSE_DECL();
200
201 #define GLOBAL 257
202 #define LOCAL 258
203 #define REAL 259
204 #define INTEGER 260
205 #define NAME 261
206 #define YYERRCODE 256
207 typedef short YYINT;
208 static const YYINT destroy1_lhs[] = { -1,
209 0, 0, 2, 2, 3, 3, 4, 4, 1,
210 };
211 static const YYINT destroy1_len[] = { 2,
212 8, 5, 1, 1, 1, 1, 2, 1, 6,
213 };
214 static const YYINT destroy1_defred[] = { 0,
215 3, 4, 5, 6, 0, 0, 0, 0, 8, 0,
216 0, 0, 0, 7, 0, 0, 0, 0, 0, 2,
217 0, 0, 0, 0, 9, 1,
218 };
219 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
220 static const YYINT destroy1_stos[] = { 0,
221 257, 258, 259, 260, 263, 265, 266, 266, 261, 264,
222 267, 267, 40, 261, 40, 40, 265, 258, 265, 41,
223 44, 44, 266, 266, 41, 41,
224 };
225 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
226 static const YYINT destroy1_dgoto[] = { 5,
227 10, 6, 7, 11,
228 };
229 static const YYINT destroy1_sindex[] = { -254,
230 0, 0, 0, 0, 0, -251, -248, -248, 0, -26,
231 -40, -39, -246, 0, -243, -246, -25, -24, -23, 0,
232 -251, -251, -22, -19, 0, 0,
233 };
234 static const YYINT destroy1_rindex[] = { 0,
235 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
236 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
237 0, 0, 0, 0, 0, 0,
238 };
239 #if YYBTYACC
240 static const YYINT destroy1_cindex[] = { 0,
241 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
243 0, 0, 0, 0, 0, 0,
244 };
245 #endif
246 static const YYINT destroy1_gindex[] = { 0,
247 0, -6, -4, 15,
248 };
249 #define YYTABLESIZE 222
250 static const YYINT destroy1_table[] = { 15,
251 16, 8, 1, 2, 3, 4, 17, 3, 4, 19,
252 1, 2, 9, 13, 18, 20, 23, 24, 25, 21,
253 22, 26, 12, 0, 0, 0, 0, 0, 0, 0,
254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
267 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
272 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
273 14, 14,
274 };
275 static const YYINT destroy1_check[] = { 40,
276 40, 6, 257, 258, 259, 260, 13, 259, 260, 16,
277 257, 258, 261, 40, 258, 41, 21, 22, 41, 44,
278 44, 41, 8, -1, -1, -1, -1, -1, -1, -1,
279 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
280 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
281 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
282 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
283 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
284 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
285 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
286 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
287 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
288 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
289 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
290 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
291 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
292 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
293 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
294 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
296 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
297 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
298 261, 261,
299 };
300 #if YYBTYACC
301 static const YYINT destroy1_ctable[] = { -1,
302 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
303 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
304 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
305 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
306 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
307 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
308 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
309 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
310 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
311 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
313 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
314 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
315 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
316 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
317 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
318 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
319 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
320 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
321 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
322 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
323 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
324 -1,
325 };
326 #endif
327 #define YYFINAL 5
328 #ifndef YYDEBUG
329 #define YYDEBUG 0
330 #endif
331 #define YYMAXTOKEN 261
332 #define YYUNDFTOKEN 268
333 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
334 #if YYDEBUG
335 static const char *const destroy1_name[] = {
336
337 "$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,
338 0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
339 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
340 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
341 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
342 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
343 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL",
344 "REAL","INTEGER","NAME","$accept","declaration","locnamelist","class","type",
345 "namelist","illegal-symbol",
346 };
347 static const char *const destroy1_rule[] = {
348 "$accept : declaration",
349 "declaration : class type namelist '(' class ',' type ')'",
350 "declaration : type locnamelist '(' class ')'",
351 "class : GLOBAL",
352 "class : LOCAL",
353 "type : REAL",
354 "type : INTEGER",
355 "namelist : namelist NAME",
356 "namelist : NAME",
357 "locnamelist : namelist '(' LOCAL ',' type ')'",
358
359 };
360 #endif
361
362 int yydebug;
363 int yynerrs;
364
365 int yyerrflag;
366 int yychar;
367 YYSTYPE yyval;
368 YYSTYPE yylval;
369 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
370 YYLTYPE yyloc; /* position returned by actions */
371 YYLTYPE yylloc; /* position from the lexer */
372 #endif
373
374 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
375 #ifndef YYLLOC_DEFAULT
376 #define YYLLOC_DEFAULT(loc, rhs, n) \
377 do \
378 { \
379 if (n == 0) \
380 { \
381 (loc).first_line = ((rhs)[-1]).last_line; \
382 (loc).first_column = ((rhs)[-1]).last_column; \
383 (loc).last_line = ((rhs)[-1]).last_line; \
384 (loc).last_column = ((rhs)[-1]).last_column; \
385 } \
386 else \
387 { \
388 (loc).first_line = ((rhs)[ 0 ]).first_line; \
389 (loc).first_column = ((rhs)[ 0 ]).first_column; \
390 (loc).last_line = ((rhs)[n-1]).last_line; \
391 (loc).last_column = ((rhs)[n-1]).last_column; \
392 } \
393 } while (0)
394 #endif /* YYLLOC_DEFAULT */
395 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
396 #if YYBTYACC
397
398 #ifndef YYLVQUEUEGROWTH
399 #define YYLVQUEUEGROWTH 32
400 #endif
401 #endif /* YYBTYACC */
402
403 /* define the initial stack-sizes */
404 #ifdef YYSTACKSIZE
405 #undef YYMAXDEPTH
406 #define YYMAXDEPTH YYSTACKSIZE
407 #else
408 #ifdef YYMAXDEPTH
409 #define YYSTACKSIZE YYMAXDEPTH
410 #else
411 #define YYSTACKSIZE 10000
412 #define YYMAXDEPTH 10000
413 #endif
414 #endif
415
416 #ifndef YYINITSTACKSIZE
417 #define YYINITSTACKSIZE 200
418 #endif
419
420 typedef struct {
421 unsigned stacksize;
422 YYINT *s_base;
423 YYINT *s_mark;
424 YYINT *s_last;
425 YYSTYPE *l_base;
426 YYSTYPE *l_mark;
427 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
428 YYLTYPE *p_base;
429 YYLTYPE *p_mark;
430 #endif
431 } YYSTACKDATA;
432 #if YYBTYACC
433
434 struct YYParseState_s
435 {
436 struct YYParseState_s *save; /* Previously saved parser state */
437 YYSTACKDATA yystack; /* saved parser stack */
438 int state; /* saved parser state */
439 int errflag; /* saved error recovery status */
440 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
441 YYINT ctry; /* saved index in yyctable[] for this conflict */
442 };
443 typedef struct YYParseState_s YYParseState;
444 #endif /* YYBTYACC */
445 /* variables for the parser stack */
446 static YYSTACKDATA yystack;
447 #if YYBTYACC
448
449 /* Current parser state */
450 static YYParseState *yyps = 0;
451
452 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
453 static YYParseState *yypath = 0;
454
455 /* Base of the lexical value queue */
456 static YYSTYPE *yylvals = 0;
457
458 /* Current position at lexical value queue */
459 static YYSTYPE *yylvp = 0;
460
461 /* End position of lexical value queue */
462 static YYSTYPE *yylve = 0;
463
464 /* The last allocated position at the lexical value queue */
465 static YYSTYPE *yylvlim = 0;
466
467 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
468 /* Base of the lexical position queue */
469 static YYLTYPE *yylpsns = 0;
470
471 /* Current position at lexical position queue */
472 static YYLTYPE *yylpp = 0;
473
474 /* End position of lexical position queue */
475 static YYLTYPE *yylpe = 0;
476
477 /* The last allocated position at the lexical position queue */
478 static YYLTYPE *yylplim = 0;
479 #endif
480
481 /* Current position at lexical token queue */
482 static YYINT *yylexp = 0;
483
484 static YYINT *yylexemes = 0;
485 #endif /* YYBTYACC */
486 #line 89 "btyacc_destroy1.y"
487
488 extern int YYLEX_DECL();
489 extern void YYERROR_DECL();
490 #line 489 "btyacc_destroy1.tab.c"
491
492 /* Release memory associated with symbol. */
493 #if ! defined YYDESTRUCT_IS_DECLARED
494 static void
495 YYDESTRUCT_DECL()
496 {
497 switch (psymb)
498 {
499 case 263:
500 #line 41 "btyacc_destroy1.y"
501 {
502 namelist *p = (*val).nlist;
503 while (p != NULL)
504 { namelist *pp = p;
505 p = p->next;
506 free(pp->s); free(pp);
507 }
508 }
509 break;
510 #line 509 "btyacc_destroy1.tab.c"
511 }
512 }
513 #define YYDESTRUCT_IS_DECLARED 1
514 #endif
515
516 /* For use in generated program */
517 #define yydepth (int)(yystack.s_mark - yystack.s_base)
518 #if YYBTYACC
519 #define yytrial (yyps->save)
520 #endif /* YYBTYACC */
521
522 #if YYDEBUG
523 #include <stdio.h> /* needed for printf */
524 #endif
525
526 #include <stdlib.h> /* needed for malloc, etc */
527 #include <string.h> /* needed for memset */
528
529 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
530 static int yygrowstack(YYSTACKDATA *data)
531 {
532 int i;
533 unsigned newsize;
534 YYINT *newss;
535 YYSTYPE *newvs;
536 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
537 YYLTYPE *newps;
538 #endif
539
540 if ((newsize = data->stacksize) == 0)
541 newsize = YYINITSTACKSIZE;
542 else if (newsize >= YYMAXDEPTH)
543 return YYENOMEM;
544 else if ((newsize *= 2) > YYMAXDEPTH)
545 newsize = YYMAXDEPTH;
546
547 i = (int) (data->s_mark - data->s_base);
548 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
549 if (newss == 0)
550 return YYENOMEM;
551
552 data->s_base = newss;
553 data->s_mark = newss + i;
554
555 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
556 if (newvs == 0)
557 return YYENOMEM;
558
559 data->l_base = newvs;
560 data->l_mark = newvs + i;
561
562 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
563 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
564 if (newps == 0)
565 return YYENOMEM;
566
567 data->p_base = newps;
568 data->p_mark = newps + i;
569 #endif
570
571 data->stacksize = newsize;
572 data->s_last = data->s_base + newsize - 1;
573
574 #if YYDEBUG
575 if (yydebug)
576 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
577 #endif
578 return 0;
579 }
580
581 #if YYPURE || defined(YY_NO_LEAKS)
582 static void yyfreestack(YYSTACKDATA *data)
583 {
584 free(data->s_base);
585 free(data->l_base);
586 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
587 free(data->p_base);
588 #endif
589 memset(data, 0, sizeof(*data));
590 }
591 #else
592 #define yyfreestack(data) /* nothing */
593 #endif /* YYPURE || defined(YY_NO_LEAKS) */
594 #if YYBTYACC
595
596 static YYParseState *
597 yyNewState(unsigned size)
598 {
599 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
600 if (p == NULL) return NULL;
601
602 p->yystack.stacksize = size;
603 if (size == 0)
604 {
605 p->yystack.s_base = NULL;
606 p->yystack.l_base = NULL;
607 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
608 p->yystack.p_base = NULL;
609 #endif
610 return p;
611 }
612 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
613 if (p->yystack.s_base == NULL) return NULL;
614 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
615 if (p->yystack.l_base == NULL) return NULL;
616 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
617 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
618 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
619 if (p->yystack.p_base == NULL) return NULL;
620 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
621 #endif
622
623 return p;
624 }
625
626 static void
627 yyFreeState(YYParseState *p)
628 {
629 yyfreestack(&p->yystack);
630 free(p);
631 }
632 #endif /* YYBTYACC */
633
634 #define YYABORT goto yyabort
635 #define YYREJECT goto yyabort
636 #define YYACCEPT goto yyaccept
637 #define YYERROR goto yyerrlab
638 #if YYBTYACC
639 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
640 #define YYVALID_NESTED do { if (yyps->save && \
641 yyps->save->save == 0) goto yyvalid; } while(0)
642 #endif /* YYBTYACC */
643
644 int
645 YYPARSE_DECL()
646 {
647 int yym, yyn, yystate, yyresult;
648 #if YYBTYACC
649 int yynewerrflag;
650 YYParseState *yyerrctx = NULL;
651 #endif /* YYBTYACC */
652 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
653 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
654 #endif
655 #if YYDEBUG
656 const char *yys;
657
658 if ((yys = getenv("YYDEBUG")) != 0)
659 {
660 yyn = *yys;
661 if (yyn >= '0' && yyn <= '9')
662 yydebug = yyn - '0';
663 }
664 if (yydebug)
665 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
666 #endif
667
668 #if YYBTYACC
669 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
670 yyps->save = 0;
671 #endif /* YYBTYACC */
672 yym = 0;
673 yyn = 0;
674 yynerrs = 0;
675 yyerrflag = 0;
676 yychar = YYEMPTY;
677 yystate = 0;
678
679 #if YYPURE
680 memset(&yystack, 0, sizeof(yystack));
681 #endif
682
683 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
684 yystack.s_mark = yystack.s_base;
685 yystack.l_mark = yystack.l_base;
686 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
687 yystack.p_mark = yystack.p_base;
688 #endif
689 yystate = 0;
690 *yystack.s_mark = 0;
691
692 yyloop:
693 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
694 if (yychar < 0)
695 {
696 #if YYBTYACC
697 do {
698 if (yylvp < yylve)
699 {
700 /* we're currently re-reading tokens */
701 yylval = *yylvp++;
702 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
703 yylloc = *yylpp++;
704 #endif
705 yychar = *yylexp++;
706 break;
707 }
708 if (yyps->save)
709 {
710 /* in trial mode; save scanner results for future parse attempts */
711 if (yylvp == yylvlim)
712 { /* Enlarge lexical value queue */
713 size_t p = (size_t) (yylvp - yylvals);
714 size_t s = (size_t) (yylvlim - yylvals);
715
716 s += YYLVQUEUEGROWTH;
717 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
718 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
719 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
720 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
721 #endif
722 yylvp = yylve = yylvals + p;
723 yylvlim = yylvals + s;
724 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
725 yylpp = yylpe = yylpsns + p;
726 yylplim = yylpsns + s;
727 #endif
728 yylexp = yylexemes + p;
729 }
730 *yylexp = (YYINT) YYLEX;
731 *yylvp++ = yylval;
732 yylve++;
733 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
734 *yylpp++ = yylloc;
735 yylpe++;
736 #endif
737 yychar = *yylexp++;
738 break;
739 }
740 /* normal operation, no conflict encountered */
741 #endif /* YYBTYACC */
742 yychar = YYLEX;
743 #if YYBTYACC
744 } while (0);
745 #endif /* YYBTYACC */
746 if (yychar < 0) yychar = YYEOF;
747 #if YYDEBUG
748 if (yydebug)
749 {
750 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
751 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
752 YYDEBUGSTR, yydepth, yystate, yychar, yys);
753 #ifdef YYSTYPE_TOSTRING
754 #if YYBTYACC
755 if (!yytrial)
756 #endif /* YYBTYACC */
757 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
758 #endif
759 fputc('\n', stderr);
760 }
761 #endif
762 }
763 #if YYBTYACC
764
765 /* Do we have a conflict? */
766 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
767 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
768 {
769 YYINT ctry;
770
771 if (yypath)
772 {
773 YYParseState *save;
774 #if YYDEBUG
775 if (yydebug)
776 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
777 YYDEBUGSTR, yydepth, yystate);
778 #endif
779 /* Switch to the next conflict context */
780 save = yypath;
781 yypath = save->save;
782 save->save = NULL;
783 ctry = save->ctry;
784 if (save->state != yystate) YYABORT;
785 yyFreeState(save);
786
787 }
788 else
789 {
790
791 /* Unresolved conflict - start/continue trial parse */
792 YYParseState *save;
793 #if YYDEBUG
794 if (yydebug)
795 {
796 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
797 if (yyps->save)
798 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
799 else
800 fputs("Starting trial parse.\n", stderr);
801 }
802 #endif
803 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
804 if (save == NULL) goto yyenomem;
805 save->save = yyps->save;
806 save->state = yystate;
807 save->errflag = yyerrflag;
808 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
809 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
810 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
811 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
812 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
813 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
814 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
815 #endif
816 ctry = yytable[yyn];
817 if (yyctable[ctry] == -1)
818 {
819 #if YYDEBUG
820 if (yydebug && yychar >= YYEOF)
821 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
822 #endif
823 ctry++;
824 }
825 save->ctry = ctry;
826 if (yyps->save == NULL)
827 {
828 /* If this is a first conflict in the stack, start saving lexemes */
829 if (!yylexemes)
830 {
831 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
832 if (yylexemes == NULL) goto yyenomem;
833 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
834 if (yylvals == NULL) goto yyenomem;
835 yylvlim = yylvals + YYLVQUEUEGROWTH;
836 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
837 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
838 if (yylpsns == NULL) goto yyenomem;
839 yylplim = yylpsns + YYLVQUEUEGROWTH;
840 #endif
841 }
842 if (yylvp == yylve)
843 {
844 yylvp = yylve = yylvals;
845 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
846 yylpp = yylpe = yylpsns;
847 #endif
848 yylexp = yylexemes;
849 if (yychar >= YYEOF)
850 {
851 *yylve++ = yylval;
852 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
853 *yylpe++ = yylloc;
854 #endif
855 *yylexp = (YYINT) yychar;
856 yychar = YYEMPTY;
857 }
858 }
859 }
860 if (yychar >= YYEOF)
861 {
862 yylvp--;
863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
864 yylpp--;
865 #endif
866 yylexp--;
867 yychar = YYEMPTY;
868 }
869 save->lexeme = (int) (yylvp - yylvals);
870 yyps->save = save;
871 }
872 if (yytable[yyn] == ctry)
873 {
874 #if YYDEBUG
875 if (yydebug)
876 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
877 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
878 #endif
879 if (yychar < 0)
880 {
881 yylvp++;
882 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
883 yylpp++;
884 #endif
885 yylexp++;
886 }
887 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
888 goto yyoverflow;
889 yystate = yyctable[ctry];
890 *++yystack.s_mark = (YYINT) yystate;
891 *++yystack.l_mark = yylval;
892 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
893 *++yystack.p_mark = yylloc;
894 #endif
895 yychar = YYEMPTY;
896 if (yyerrflag > 0) --yyerrflag;
897 goto yyloop;
898 }
899 else
900 {
901 yyn = yyctable[ctry];
902 goto yyreduce;
903 }
904 } /* End of code dealing with conflicts */
905 #endif /* YYBTYACC */
906 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
907 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
908 {
909 #if YYDEBUG
910 if (yydebug)
911 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
912 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
913 #endif
914 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
915 yystate = yytable[yyn];
916 *++yystack.s_mark = yytable[yyn];
917 *++yystack.l_mark = yylval;
918 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
919 *++yystack.p_mark = yylloc;
920 #endif
921 yychar = YYEMPTY;
922 if (yyerrflag > 0) --yyerrflag;
923 goto yyloop;
924 }
925 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
926 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
927 {
928 yyn = yytable[yyn];
929 goto yyreduce;
930 }
931 if (yyerrflag != 0) goto yyinrecovery;
932 #if YYBTYACC
933
934 yynewerrflag = 1;
935 goto yyerrhandler;
936 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
937
938 yyerrlab:
939 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
940 * before looking for error recovery */
941 yystack.s_mark -= yym;
942 yystate = *yystack.s_mark;
943 yystack.l_mark -= yym;
944 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
945 yystack.p_mark -= yym;
946 #endif
947
948 yynewerrflag = 0;
949 yyerrhandler:
950 while (yyps->save)
951 {
952 int ctry;
953 YYParseState *save = yyps->save;
954 #if YYDEBUG
955 if (yydebug)
956 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
957 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
958 (int)(yylvp - yylvals - yyps->save->lexeme));
959 #endif
960 /* Memorize most forward-looking error state in case it's really an error. */
961 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
962 {
963 /* Free old saved error context state */
964 if (yyerrctx) yyFreeState(yyerrctx);
965 /* Create and fill out new saved error context state */
966 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
967 if (yyerrctx == NULL) goto yyenomem;
968 yyerrctx->save = yyps->save;
969 yyerrctx->state = yystate;
970 yyerrctx->errflag = yyerrflag;
971 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
972 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
973 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
974 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
975 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
976 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
977 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
978 #endif
979 yyerrctx->lexeme = (int) (yylvp - yylvals);
980 }
981 yylvp = yylvals + save->lexeme;
982 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
983 yylpp = yylpsns + save->lexeme;
984 #endif
985 yylexp = yylexemes + save->lexeme;
986 yychar = YYEMPTY;
987 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
988 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
989 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
990 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
991 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
992 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
993 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
994 #endif
995 ctry = ++save->ctry;
996 yystate = save->state;
997 /* We tried shift, try reduce now */
998 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
999 yyps->save = save->save;
1000 save->save = NULL;
1001 yyFreeState(save);
1002
1003 /* Nothing left on the stack -- error */
1004 if (!yyps->save)
1005 {
1006 #if YYDEBUG
1007 if (yydebug)
1008 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1009 YYPREFIX, yydepth);
1010 #endif
1011 /* Restore state as it was in the most forward-advanced error */
1012 yylvp = yylvals + yyerrctx->lexeme;
1013 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1014 yylpp = yylpsns + yyerrctx->lexeme;
1015 #endif
1016 yylexp = yylexemes + yyerrctx->lexeme;
1017 yychar = yylexp[-1];
1018 yylval = yylvp[-1];
1019 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1020 yylloc = yylpp[-1];
1021 #endif
1022 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1023 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1024 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1025 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1026 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1027 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1028 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1029 #endif
1030 yystate = yyerrctx->state;
1031 yyFreeState(yyerrctx);
1032 yyerrctx = NULL;
1033 }
1034 yynewerrflag = 1;
1035 }
1036 if (yynewerrflag == 0) goto yyinrecovery;
1037 #endif /* YYBTYACC */
1038
1039 YYERROR_CALL("syntax error");
1040 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1041 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1042 #endif
1043
1044 #if !YYBTYACC
1045 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1046 yyerrlab:
1047 #endif
1048 ++yynerrs;
1049
1050 yyinrecovery:
1051 if (yyerrflag < 3)
1052 {
1053 yyerrflag = 3;
1054 for (;;)
1055 {
1056 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1057 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1058 {
1059 #if YYDEBUG
1060 if (yydebug)
1061 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1062 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1063 #endif
1064 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1065 yystate = yytable[yyn];
1066 *++yystack.s_mark = yytable[yyn];
1067 *++yystack.l_mark = yylval;
1068 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1069 /* lookahead position is error end position */
1070 yyerror_loc_range[1] = yylloc;
1071 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1072 *++yystack.p_mark = yyloc;
1073 #endif
1074 goto yyloop;
1075 }
1076 else
1077 {
1078 #if YYDEBUG
1079 if (yydebug)
1080 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1081 YYDEBUGSTR, yydepth, *yystack.s_mark);
1082 #endif
1083 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1084 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1085 /* the current TOS position is the error start position */
1086 yyerror_loc_range[0] = *yystack.p_mark;
1087 #endif
1088 #if defined(YYDESTRUCT_CALL)
1089 #if YYBTYACC
1090 if (!yytrial)
1091 #endif /* YYBTYACC */
1092 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1093 YYDESTRUCT_CALL("error: discarding state",
1094 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1095 #else
1096 YYDESTRUCT_CALL("error: discarding state",
1097 yystos[*yystack.s_mark], yystack.l_mark);
1098 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1099 #endif /* defined(YYDESTRUCT_CALL) */
1100 --yystack.s_mark;
1101 --yystack.l_mark;
1102 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1103 --yystack.p_mark;
1104 #endif
1105 }
1106 }
1107 }
1108 else
1109 {
1110 if (yychar == YYEOF) goto yyabort;
1111 #if YYDEBUG
1112 if (yydebug)
1113 {
1114 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1115 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1116 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1117 }
1118 #endif
1119 #if defined(YYDESTRUCT_CALL)
1120 #if YYBTYACC
1121 if (!yytrial)
1122 #endif /* YYBTYACC */
1123 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1124 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1125 #else
1126 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1127 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1128 #endif /* defined(YYDESTRUCT_CALL) */
1129 yychar = YYEMPTY;
1130 goto yyloop;
1131 }
1132
1133 yyreduce:
1134 yym = yylen[yyn];
1135 #if YYDEBUG
1136 if (yydebug)
1137 {
1138 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1139 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1140 #ifdef YYSTYPE_TOSTRING
1141 #if YYBTYACC
1142 if (!yytrial)
1143 #endif /* YYBTYACC */
1144 if (yym > 0)
1145 {
1146 int i;
1147 fputc('<', stderr);
1148 for (i = yym; i > 0; i--)
1149 {
1150 if (i != yym) fputs(", ", stderr);
1151 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1152 yystack.l_mark[1-i]), stderr);
1153 }
1154 fputc('>', stderr);
1155 }
1156 #endif
1157 fputc('\n', stderr);
1158 }
1159 #endif
1160 if (yym > 0)
1161 yyval = yystack.l_mark[1-yym];
1162 else
1163 memset(&yyval, 0, sizeof yyval);
1164 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1165
1166 /* Perform position reduction */
1167 memset(&yyloc, 0, sizeof(yyloc));
1168 #if YYBTYACC
1169 if (!yytrial)
1170 #endif /* YYBTYACC */
1171 {
1172 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1173 /* just in case YYERROR is invoked within the action, save
1174 the start of the rhs as the error start position */
1175 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1176 }
1177 #endif
1178
1179 switch (yyn)
1180 {
1181 case 1:
1182 if (!yytrial)
1183 #line 62 "btyacc_destroy1.y"
1184 { yyval.nlist = yystack.l_mark[-5].nlist; }
1185 break;
1186 case 2:
1187 if (!yytrial)
1188 #line 64 "btyacc_destroy1.y"
1189 { yyval.nlist = yystack.l_mark[-3].nlist; }
1190 break;
1191 case 3:
1192 if (!yytrial)
1193 #line 67 "btyacc_destroy1.y"
1194 { yyval.cval = cGLOBAL; }
1195 break;
1196 case 4:
1197 if (!yytrial)
1198 #line 68 "btyacc_destroy1.y"
1199 { yyval.cval = cLOCAL; }
1200 break;
1201 case 5:
1202 if (!yytrial)
1203 #line 71 "btyacc_destroy1.y"
1204 { yyval.tval = tREAL; }
1205 break;
1206 case 6:
1207 if (!yytrial)
1208 #line 72 "btyacc_destroy1.y"
1209 { yyval.tval = tINTEGER; }
1210 break;
1211 case 7:
1212 if (!yytrial)
1213 #line 76 "btyacc_destroy1.y"
1214 { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
1215 yyval.nlist->next = yystack.l_mark[-1].nlist;
1216 }
1217 break;
1218 case 8:
1219 if (!yytrial)
1220 #line 80 "btyacc_destroy1.y"
1221 { yyval.nlist->s = mksymbol(0, 0, yystack.l_mark[0].id);
1222 yyval.nlist->next = NULL;
1223 }
1224 break;
1225 case 9:
1226 if (!yytrial)
1227 #line 86 "btyacc_destroy1.y"
1228 { yyval.nlist = yystack.l_mark[-5].nlist; }
1229 break;
1230 #line 1229 "btyacc_destroy1.tab.c"
1231 default:
1232 break;
1233 }
1234 yystack.s_mark -= yym;
1235 yystate = *yystack.s_mark;
1236 yystack.l_mark -= yym;
1237 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1238 yystack.p_mark -= yym;
1239 #endif
1240 yym = yylhs[yyn];
1241 if (yystate == 0 && yym == 0)
1242 {
1243 #if YYDEBUG
1244 if (yydebug)
1245 {
1246 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1247 #ifdef YYSTYPE_TOSTRING
1248 #if YYBTYACC
1249 if (!yytrial)
1250 #endif /* YYBTYACC */
1251 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1252 #endif
1253 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1254 }
1255 #endif
1256 yystate = YYFINAL;
1257 *++yystack.s_mark = YYFINAL;
1258 *++yystack.l_mark = yyval;
1259 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1260 *++yystack.p_mark = yyloc;
1261 #endif
1262 if (yychar < 0)
1263 {
1264 #if YYBTYACC
1265 do {
1266 if (yylvp < yylve)
1267 {
1268 /* we're currently re-reading tokens */
1269 yylval = *yylvp++;
1270 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1271 yylloc = *yylpp++;
1272 #endif
1273 yychar = *yylexp++;
1274 break;
1275 }
1276 if (yyps->save)
1277 {
1278 /* in trial mode; save scanner results for future parse attempts */
1279 if (yylvp == yylvlim)
1280 { /* Enlarge lexical value queue */
1281 size_t p = (size_t) (yylvp - yylvals);
1282 size_t s = (size_t) (yylvlim - yylvals);
1283
1284 s += YYLVQUEUEGROWTH;
1285 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1286 goto yyenomem;
1287 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1288 goto yyenomem;
1289 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1290 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1291 goto yyenomem;
1292 #endif
1293 yylvp = yylve = yylvals + p;
1294 yylvlim = yylvals + s;
1295 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1296 yylpp = yylpe = yylpsns + p;
1297 yylplim = yylpsns + s;
1298 #endif
1299 yylexp = yylexemes + p;
1300 }
1301 *yylexp = (YYINT) YYLEX;
1302 *yylvp++ = yylval;
1303 yylve++;
1304 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1305 *yylpp++ = yylloc;
1306 yylpe++;
1307 #endif
1308 yychar = *yylexp++;
1309 break;
1310 }
1311 /* normal operation, no conflict encountered */
1312 #endif /* YYBTYACC */
1313 yychar = YYLEX;
1314 #if YYBTYACC
1315 } while (0);
1316 #endif /* YYBTYACC */
1317 if (yychar < 0) yychar = YYEOF;
1318 #if YYDEBUG
1319 if (yydebug)
1320 {
1321 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1322 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1323 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1324 }
1325 #endif
1326 }
1327 if (yychar == YYEOF) goto yyaccept;
1328 goto yyloop;
1329 }
1330 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1331 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1332 yystate = yytable[yyn];
1333 else
1334 yystate = yydgoto[yym];
1335 #if YYDEBUG
1336 if (yydebug)
1337 {
1338 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1339 #ifdef YYSTYPE_TOSTRING
1340 #if YYBTYACC
1341 if (!yytrial)
1342 #endif /* YYBTYACC */
1343 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1344 #endif
1345 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1346 }
1347 #endif
1348 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1349 *++yystack.s_mark = (YYINT) yystate;
1350 *++yystack.l_mark = yyval;
1351 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1352 *++yystack.p_mark = yyloc;
1353 #endif
1354 goto yyloop;
1355 #if YYBTYACC
1356
1357 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1358 yyvalid:
1359 if (yypath) YYABORT;
1360 while (yyps->save)
1361 {
1362 YYParseState *save = yyps->save;
1363 yyps->save = save->save;
1364 save->save = yypath;
1365 yypath = save;
1366 }
1367 #if YYDEBUG
1368 if (yydebug)
1369 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1370 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1371 #endif
1372 if (yyerrctx)
1373 {
1374 yyFreeState(yyerrctx);
1375 yyerrctx = NULL;
1376 }
1377 yylvp = yylvals + yypath->lexeme;
1378 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1379 yylpp = yylpsns + yypath->lexeme;
1380 #endif
1381 yylexp = yylexemes + yypath->lexeme;
1382 yychar = YYEMPTY;
1383 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1384 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1385 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1386 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1387 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1388 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1389 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1390 #endif
1391 yystate = yypath->state;
1392 goto yyloop;
1393 #endif /* YYBTYACC */
1394
1395 yyoverflow:
1396 YYERROR_CALL("yacc stack overflow");
1397 #if YYBTYACC
1398 goto yyabort_nomem;
1399 yyenomem:
1400 YYERROR_CALL("memory exhausted");
1401 yyabort_nomem:
1402 #endif /* YYBTYACC */
1403 yyresult = 2;
1404 goto yyreturn;
1405
1406 yyabort:
1407 yyresult = 1;
1408 goto yyreturn;
1409
1410 yyaccept:
1411 #if YYBTYACC
1412 if (yyps->save) goto yyvalid;
1413 #endif /* YYBTYACC */
1414 yyresult = 0;
1415
1416 yyreturn:
1417 #if defined(YYDESTRUCT_CALL)
1418 if (yychar != YYEOF && yychar != YYEMPTY)
1419 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1420 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1421 #else
1422 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1423 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1424
1425 {
1426 YYSTYPE *pv;
1427 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1428 YYLTYPE *pp;
1429
1430 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1431 YYDESTRUCT_CALL("cleanup: discarding state",
1432 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1433 #else
1434 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1435 YYDESTRUCT_CALL("cleanup: discarding state",
1436 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1437 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1438 }
1439 #endif /* defined(YYDESTRUCT_CALL) */
1440
1441 #if YYBTYACC
1442 if (yyerrctx)
1443 {
1444 yyFreeState(yyerrctx);
1445 yyerrctx = NULL;
1446 }
1447 while (yyps)
1448 {
1449 YYParseState *save = yyps;
1450 yyps = save->save;
1451 save->save = NULL;
1452 yyFreeState(save);
1453 }
1454 while (yypath)
1455 {
1456 YYParseState *save = yypath;
1457 yypath = save->save;
1458 save->save = NULL;
1459 yyFreeState(save);
1460 }
1461 #endif /* YYBTYACC */
1462 yyfreestack(&yystack);
1463 return (yyresult);
1464 }
1465