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