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