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