err_inherit3.tab.c revision 1.1.1.1 1 /* $NetBSD: err_inherit3.tab.c,v 1.1.1.1 2015/01/03 22:58:25 christos Exp $ */
2
3 /* original parser id follows */
4 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
5 /* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */
6
7 #define YYBYACC 1
8 #define YYMAJOR 1
9 #define YYMINOR 9
10 #define YYCHECK "yyyymmdd"
11
12 #define YYEMPTY (-1)
13 #define yyclearin (yychar = YYEMPTY)
14 #define yyerrok (yyerrflag = 0)
15 #define YYRECOVERING() (yyerrflag != 0)
16 #define YYENOMEM (-2)
17 #define YYEOF 0
18 #undef YYBTYACC
19 #define YYBTYACC 0
20 #define YYDEBUGSTR YYPREFIX "debug"
21
22 #ifndef yyparse
23 #define yyparse err_inherit3_parse
24 #endif /* yyparse */
25
26 #ifndef yylex
27 #define yylex err_inherit3_lex
28 #endif /* yylex */
29
30 #ifndef yyerror
31 #define yyerror err_inherit3_error
32 #endif /* yyerror */
33
34 #ifndef yychar
35 #define yychar err_inherit3_char
36 #endif /* yychar */
37
38 #ifndef yyval
39 #define yyval err_inherit3_val
40 #endif /* yyval */
41
42 #ifndef yylval
43 #define yylval err_inherit3_lval
44 #endif /* yylval */
45
46 #ifndef yydebug
47 #define yydebug err_inherit3_debug
48 #endif /* yydebug */
49
50 #ifndef yynerrs
51 #define yynerrs err_inherit3_nerrs
52 #endif /* yynerrs */
53
54 #ifndef yyerrflag
55 #define yyerrflag err_inherit3_errflag
56 #endif /* yyerrflag */
57
58 #ifndef yylhs
59 #define yylhs err_inherit3_lhs
60 #endif /* yylhs */
61
62 #ifndef yylen
63 #define yylen err_inherit3_len
64 #endif /* yylen */
65
66 #ifndef yydefred
67 #define yydefred err_inherit3_defred
68 #endif /* yydefred */
69
70 #ifndef yystos
71 #define yystos err_inherit3_stos
72 #endif /* yystos */
73
74 #ifndef yydgoto
75 #define yydgoto err_inherit3_dgoto
76 #endif /* yydgoto */
77
78 #ifndef yysindex
79 #define yysindex err_inherit3_sindex
80 #endif /* yysindex */
81
82 #ifndef yyrindex
83 #define yyrindex err_inherit3_rindex
84 #endif /* yyrindex */
85
86 #ifndef yygindex
87 #define yygindex err_inherit3_gindex
88 #endif /* yygindex */
89
90 #ifndef yytable
91 #define yytable err_inherit3_table
92 #endif /* yytable */
93
94 #ifndef yycheck
95 #define yycheck err_inherit3_check
96 #endif /* yycheck */
97
98 #ifndef yyname
99 #define yyname err_inherit3_name
100 #endif /* yyname */
101
102 #ifndef yyrule
103 #define yyrule err_inherit3_rule
104 #endif /* yyrule */
105
106 #if YYBTYACC
107
108 #ifndef yycindex
109 #define yycindex err_inherit3_cindex
110 #endif /* yycindex */
111
112 #ifndef yyctable
113 #define yyctable err_inherit3_ctable
114 #endif /* yyctable */
115
116 #endif /* YYBTYACC */
117
118 #define YYPREFIX "err_inherit3_"
119
120 #define YYPURE 0
121
122 #line 2 "err_inherit3.y"
123 #include <stdlib.h>
124
125 typedef enum {cGLOBAL, cLOCAL} class;
126 typedef enum {tREAL, tINTEGER} type;
127 typedef char * name;
128
129 struct symbol { class c; type t; name id; };
130 typedef struct symbol symbol;
131
132 struct namelist { symbol *s; struct namelist *next; };
133 typedef struct namelist namelist;
134
135 extern symbol *mksymbol(type t, class c, name id);
136
137 #ifdef YYBISON
138 #define YYLEX_DECL() yylex(void)
139 #define YYERROR_DECL() yyerror(const char *s)
140 #endif
141 #line 39 "err_inherit3.y"
142 #ifdef YYSTYPE
143 #undef YYSTYPE_IS_DECLARED
144 #define YYSTYPE_IS_DECLARED 1
145 #endif
146 #ifndef YYSTYPE_IS_DECLARED
147 #define YYSTYPE_IS_DECLARED 1
148 typedef union
149 {
150 class cval;
151 type tval;
152 namelist * nlist;
153 name id;
154 } YYSTYPE;
155 #endif /* !YYSTYPE_IS_DECLARED */
156 #line 155 "err_inherit3.tab.c"
157
158 /* compatibility with bison */
159 #ifdef YYPARSE_PARAM
160 /* compatibility with FreeBSD */
161 # ifdef YYPARSE_PARAM_TYPE
162 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
163 # else
164 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
165 # endif
166 #else
167 # define YYPARSE_DECL() yyparse(void)
168 #endif
169
170 /* Parameters sent to lex. */
171 #ifdef YYLEX_PARAM
172 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
173 # define YYLEX yylex(YYLEX_PARAM)
174 #else
175 # define YYLEX_DECL() yylex(void)
176 # define YYLEX yylex()
177 #endif
178
179 /* Parameters sent to yyerror. */
180 #ifndef YYERROR_DECL
181 #define YYERROR_DECL() yyerror(const char *s)
182 #endif
183 #ifndef YYERROR_CALL
184 #define YYERROR_CALL(msg) yyerror(msg)
185 #endif
186
187 #ifndef YYDESTRUCT_DECL
188 #define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val)
189 #endif
190 #ifndef YYDESTRUCT_CALL
191 #define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val)
192 #endif
193
194 extern int YYPARSE_DECL();
195
196 #define GLOBAL 257
197 #define LOCAL 258
198 #define REAL 259
199 #define INTEGER 260
200 #define NAME 261
201 #define YYERRCODE 256
202 typedef short YYINT;
203 static const YYINT err_inherit3_lhs[] = { -1,
204 5, 6, 0, 7, 0, 3, 3, 4, 4, 8,
205 1, 1, 9, 2,
206 };
207 static const YYINT err_inherit3_len[] = { 2,
208 0, 0, 5, 0, 3, 1, 1, 1, 1, 0,
209 3, 1, 0, 3,
210 };
211 static const YYINT err_inherit3_defred[] = { 0,
212 6, 7, 8, 9, 0, 0, 4, 1, 13, 2,
213 5, 2, 0, 0, 12, 3, 0, 14, 0, 11,
214 };
215 static const YYINT err_inherit3_stos[] = { 0,
216 257, 258, 259, 260, 263, 266, 267, 267, 270, 268,
217 265, 272, 269, 269, 261, 264, 271, 264, 264, 261,
218 };
219 static const YYINT err_inherit3_dgoto[] = { 5,
220 16, 11, 6, 7, 10, 13, 9, 17, 12,
221 };
222 static const YYINT err_inherit3_sindex[] = { -257,
223 0, 0, 0, 0, 0, -254, 0, 0, 0, 0,
224 0, 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, 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, 0,
234 };
235 #endif
236 static const YYINT err_inherit3_gindex[] = { 0,
237 -10, 0, 0, 4, 0, -1, 0, 0, 0,
238 };
239 #define YYTABLESIZE 11
240 static const YYINT err_inherit3_table[] = { 1,
241 2, 3, 4, 18, 3, 4, 19, 15, 20, 8,
242 14,
243 };
244 static const YYINT err_inherit3_check[] = { 257,
245 258, 259, 260, 14, 259, 260, 17, 261, 261, 6,
246 12,
247 };
248 #if YYBTYACC
249 static const YYINT err_inherit3_ctable[] = { -1,
250 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
251 };
252 #endif
253 #define YYFINAL 5
254 #ifndef YYDEBUG
255 #define YYDEBUG 0
256 #endif
257 #define YYMAXTOKEN 261
258 #define YYUNDFTOKEN 273
259 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
260 #if YYDEBUG
261 static const char *const err_inherit3_name[] = {
262
263 "$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,
264 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error","GLOBAL","LOCAL","REAL","INTEGER",
270 "NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
271 "$$2","$$3","$$4","$$5","illegal-symbol",
272 };
273 static const char *const err_inherit3_rule[] = {
274 "$accept : declaration",
275 "$$1 :",
276 "$$2 :",
277 "declaration : class type $$1 $$2 namelist",
278 "$$3 :",
279 "declaration : type $$3 locnamelist",
280 "class : GLOBAL",
281 "class : LOCAL",
282 "type : REAL",
283 "type : INTEGER",
284 "$$4 :",
285 "namelist : $$4 namelist NAME",
286 "namelist : NAME",
287 "$$5 :",
288 "locnamelist : $$5 $$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 short *s_base;
354 short *s_mark;
355 short *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 short *yylexp = 0;
414
415 static short *yylexemes = 0;
416 #endif /* YYBTYACC */
417 #line 78 "err_inherit3.y"
418
419 extern int YYLEX_DECL();
420 extern void YYERROR_DECL();
421 #line 420 "err_inherit3.tab.c"
422
423 /* Release memory associated with symbol. */
424 #if ! defined YYDESTRUCT_IS_DECLARED
425 static void
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 440 "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 452 "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 464 "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 */
485 static int yygrowstack(YYSTACKDATA *data)
486 {
487 int i;
488 unsigned newsize;
489 short *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 = (short *)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)
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 *
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 = (short *) malloc(size * sizeof(short));
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
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
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
623 #if YYBTYACC
624 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
625 yyps->save = 0;
626 #endif /* YYBTYACC */
627 yynerrs = 0;
628 yyerrflag = 0;
629 yychar = YYEMPTY;
630 yystate = 0;
631
632 #if YYPURE
633 memset(&yystack, 0, sizeof(yystack));
634 #endif
635
636 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
637 yystack.s_mark = yystack.s_base;
638 yystack.l_mark = yystack.l_base;
639 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
640 yystack.p_mark = yystack.p_base;
641 #endif
642 yystate = 0;
643 *yystack.s_mark = 0;
644
645 yyloop:
646 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
647 if (yychar < 0)
648 {
649 #if YYBTYACC
650 do {
651 if (yylvp < yylve)
652 {
653 /* we're currently re-reading tokens */
654 yylval = *yylvp++;
655 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
656 yylloc = *yylpp++;
657 #endif
658 yychar = *yylexp++;
659 break;
660 }
661 if (yyps->save)
662 {
663 /* in trial mode; save scanner results for future parse attempts */
664 if (yylvp == yylvlim)
665 { /* Enlarge lexical value queue */
666 size_t p = (size_t) (yylvp - yylvals);
667 size_t s = (size_t) (yylvlim - yylvals);
668
669 s += YYLVQUEUEGROWTH;
670 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
671 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
672 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
673 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
674 #endif
675 yylvp = yylve = yylvals + p;
676 yylvlim = yylvals + s;
677 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
678 yylpp = yylpe = yylpsns + p;
679 yylplim = yylpsns + s;
680 #endif
681 yylexp = yylexemes + p;
682 }
683 *yylexp = (short) YYLEX;
684 *yylvp++ = yylval;
685 yylve++;
686 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
687 *yylpp++ = yylloc;
688 yylpe++;
689 #endif
690 yychar = *yylexp++;
691 break;
692 }
693 /* normal operation, no conflict encountered */
694 #endif /* YYBTYACC */
695 yychar = YYLEX;
696 #if YYBTYACC
697 } while (0);
698 #endif /* YYBTYACC */
699 if (yychar < 0) yychar = YYEOF;
700 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
701 #if YYDEBUG
702 if (yydebug)
703 {
704 yys = yyname[YYTRANSLATE(yychar)];
705 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
706 YYDEBUGSTR, yydepth, yystate, yychar, yys);
707 #ifdef YYSTYPE_TOSTRING
708 #if YYBTYACC
709 if (!yytrial)
710 #endif /* YYBTYACC */
711 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
712 #endif
713 fputc('\n', stderr);
714 }
715 #endif
716 }
717 #if YYBTYACC
718
719 /* Do we have a conflict? */
720 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
721 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
722 {
723 YYINT ctry;
724
725 if (yypath)
726 {
727 YYParseState *save;
728 #if YYDEBUG
729 if (yydebug)
730 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
731 YYDEBUGSTR, yydepth, yystate);
732 #endif
733 /* Switch to the next conflict context */
734 save = yypath;
735 yypath = save->save;
736 save->save = NULL;
737 ctry = save->ctry;
738 if (save->state != yystate) YYABORT;
739 yyFreeState(save);
740
741 }
742 else
743 {
744
745 /* Unresolved conflict - start/continue trial parse */
746 YYParseState *save;
747 #if YYDEBUG
748 if (yydebug)
749 {
750 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
751 if (yyps->save)
752 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
753 else
754 fputs("Starting trial parse.\n", stderr);
755 }
756 #endif
757 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
758 if (save == NULL) goto yyenomem;
759 save->save = yyps->save;
760 save->state = yystate;
761 save->errflag = yyerrflag;
762 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
763 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
764 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
765 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
766 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
767 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
768 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
769 #endif
770 ctry = yytable[yyn];
771 if (yyctable[ctry] == -1)
772 {
773 #if YYDEBUG
774 if (yydebug && yychar >= YYEOF)
775 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
776 #endif
777 ctry++;
778 }
779 save->ctry = ctry;
780 if (yyps->save == NULL)
781 {
782 /* If this is a first conflict in the stack, start saving lexemes */
783 if (!yylexemes)
784 {
785 yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
786 if (yylexemes == NULL) goto yyenomem;
787 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
788 if (yylvals == NULL) goto yyenomem;
789 yylvlim = yylvals + YYLVQUEUEGROWTH;
790 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
791 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
792 if (yylpsns == NULL) goto yyenomem;
793 yylplim = yylpsns + YYLVQUEUEGROWTH;
794 #endif
795 }
796 if (yylvp == yylve)
797 {
798 yylvp = yylve = yylvals;
799 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
800 yylpp = yylpe = yylpsns;
801 #endif
802 yylexp = yylexemes;
803 if (yychar >= YYEOF)
804 {
805 *yylve++ = yylval;
806 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
807 *yylpe++ = yylloc;
808 #endif
809 *yylexp = (short) yychar;
810 yychar = YYEMPTY;
811 }
812 }
813 }
814 if (yychar >= YYEOF)
815 {
816 yylvp--;
817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
818 yylpp--;
819 #endif
820 yylexp--;
821 yychar = YYEMPTY;
822 }
823 save->lexeme = (int) (yylvp - yylvals);
824 yyps->save = save;
825 }
826 if (yytable[yyn] == ctry)
827 {
828 #if YYDEBUG
829 if (yydebug)
830 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
831 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
832 #endif
833 if (yychar < 0)
834 {
835 yylvp++;
836 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
837 yylpp++;
838 #endif
839 yylexp++;
840 }
841 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
842 goto yyoverflow;
843 yystate = yyctable[ctry];
844 *++yystack.s_mark = (short) yystate;
845 *++yystack.l_mark = yylval;
846 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
847 *++yystack.p_mark = yylloc;
848 #endif
849 yychar = YYEMPTY;
850 if (yyerrflag > 0) --yyerrflag;
851 goto yyloop;
852 }
853 else
854 {
855 yyn = yyctable[ctry];
856 goto yyreduce;
857 }
858 } /* End of code dealing with conflicts */
859 #endif /* YYBTYACC */
860 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
861 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
862 {
863 #if YYDEBUG
864 if (yydebug)
865 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
866 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
867 #endif
868 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
869 yystate = yytable[yyn];
870 *++yystack.s_mark = yytable[yyn];
871 *++yystack.l_mark = yylval;
872 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
873 *++yystack.p_mark = yylloc;
874 #endif
875 yychar = YYEMPTY;
876 if (yyerrflag > 0) --yyerrflag;
877 goto yyloop;
878 }
879 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
880 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
881 {
882 yyn = yytable[yyn];
883 goto yyreduce;
884 }
885 if (yyerrflag != 0) goto yyinrecovery;
886 #if YYBTYACC
887
888 yynewerrflag = 1;
889 goto yyerrhandler;
890 goto yyerrlab;
891
892 yyerrlab:
893 yynewerrflag = 0;
894 yyerrhandler:
895 while (yyps->save)
896 {
897 int ctry;
898 YYParseState *save = yyps->save;
899 #if YYDEBUG
900 if (yydebug)
901 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
902 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
903 (int)(yylvp - yylvals - yyps->save->lexeme));
904 #endif
905 /* Memorize most forward-looking error state in case it's really an error. */
906 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
907 {
908 /* Free old saved error context state */
909 if (yyerrctx) yyFreeState(yyerrctx);
910 /* Create and fill out new saved error context state */
911 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
912 if (yyerrctx == NULL) goto yyenomem;
913 yyerrctx->save = yyps->save;
914 yyerrctx->state = yystate;
915 yyerrctx->errflag = yyerrflag;
916 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
917 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
918 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
919 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
920 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
921 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
922 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
923 #endif
924 yyerrctx->lexeme = (int) (yylvp - yylvals);
925 }
926 yylvp = yylvals + save->lexeme;
927 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
928 yylpp = yylpsns + save->lexeme;
929 #endif
930 yylexp = yylexemes + save->lexeme;
931 yychar = YYEMPTY;
932 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
933 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
934 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
935 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
936 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
937 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
938 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
939 #endif
940 ctry = ++save->ctry;
941 yystate = save->state;
942 /* We tried shift, try reduce now */
943 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
944 yyps->save = save->save;
945 save->save = NULL;
946 yyFreeState(save);
947
948 /* Nothing left on the stack -- error */
949 if (!yyps->save)
950 {
951 #if YYDEBUG
952 if (yydebug)
953 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
954 YYPREFIX, yydepth);
955 #endif
956 /* Restore state as it was in the most forward-advanced error */
957 yylvp = yylvals + yyerrctx->lexeme;
958 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
959 yylpp = yylpsns + yyerrctx->lexeme;
960 #endif
961 yylexp = yylexemes + yyerrctx->lexeme;
962 yychar = yylexp[-1];
963 yylval = yylvp[-1];
964 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
965 yylloc = yylpp[-1];
966 #endif
967 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
968 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
969 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
970 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
971 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
972 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
973 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
974 #endif
975 yystate = yyerrctx->state;
976 yyFreeState(yyerrctx);
977 yyerrctx = NULL;
978 }
979 yynewerrflag = 1;
980 }
981 if (yynewerrflag == 0) goto yyinrecovery;
982 #endif /* YYBTYACC */
983
984 YYERROR_CALL("syntax error");
985 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
986 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
987 #endif
988
989 #if !YYBTYACC
990 goto yyerrlab;
991 yyerrlab:
992 #endif
993 ++yynerrs;
994
995 yyinrecovery:
996 if (yyerrflag < 3)
997 {
998 yyerrflag = 3;
999 for (;;)
1000 {
1001 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1002 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1003 {
1004 #if YYDEBUG
1005 if (yydebug)
1006 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1007 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1008 #endif
1009 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1010 yystate = yytable[yyn];
1011 *++yystack.s_mark = yytable[yyn];
1012 *++yystack.l_mark = yylval;
1013 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1014 /* lookahead position is error end position */
1015 yyerror_loc_range[1] = yylloc;
1016 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1017 *++yystack.p_mark = yyloc;
1018 #endif
1019 goto yyloop;
1020 }
1021 else
1022 {
1023 #if YYDEBUG
1024 if (yydebug)
1025 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1026 YYDEBUGSTR, yydepth, *yystack.s_mark);
1027 #endif
1028 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1029 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1030 /* the current TOS position is the error start position */
1031 yyerror_loc_range[0] = *yystack.p_mark;
1032 #endif
1033 #if defined(YYDESTRUCT_CALL)
1034 #if YYBTYACC
1035 if (!yytrial)
1036 #endif /* YYBTYACC */
1037 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1038 YYDESTRUCT_CALL("error: discarding state",
1039 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1040 #else
1041 YYDESTRUCT_CALL("error: discarding state",
1042 yystos[*yystack.s_mark], yystack.l_mark);
1043 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1044 #endif /* defined(YYDESTRUCT_CALL) */
1045 --yystack.s_mark;
1046 --yystack.l_mark;
1047 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1048 --yystack.p_mark;
1049 #endif
1050 }
1051 }
1052 }
1053 else
1054 {
1055 if (yychar == YYEOF) goto yyabort;
1056 #if YYDEBUG
1057 if (yydebug)
1058 {
1059 yys = yyname[YYTRANSLATE(yychar)];
1060 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1061 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1062 }
1063 #endif
1064 #if defined(YYDESTRUCT_CALL)
1065 #if YYBTYACC
1066 if (!yytrial)
1067 #endif /* YYBTYACC */
1068 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1069 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1070 #else
1071 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1072 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1073 #endif /* defined(YYDESTRUCT_CALL) */
1074 yychar = YYEMPTY;
1075 goto yyloop;
1076 }
1077
1078 yyreduce:
1079 yym = yylen[yyn];
1080 #if YYDEBUG
1081 if (yydebug)
1082 {
1083 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1084 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1085 #ifdef YYSTYPE_TOSTRING
1086 #if YYBTYACC
1087 if (!yytrial)
1088 #endif /* YYBTYACC */
1089 if (yym > 0)
1090 {
1091 int i;
1092 fputc('<', stderr);
1093 for (i = yym; i > 0; i--)
1094 {
1095 if (i != yym) fputs(", ", stderr);
1096 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1097 yystack.l_mark[1-i]), stderr);
1098 }
1099 fputc('>', stderr);
1100 }
1101 #endif
1102 fputc('\n', stderr);
1103 }
1104 #endif
1105 if (yym > 0)
1106 yyval = yystack.l_mark[1-yym];
1107 else
1108 memset(&yyval, 0, sizeof yyval);
1109 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1110
1111 /* Perform position reduction */
1112 memset(&yyloc, 0, sizeof(yyloc));
1113 #if YYBTYACC
1114 if (!yytrial)
1115 #endif /* YYBTYACC */
1116 {
1117 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1118 /* just in case YYERROR is invoked within the action, save
1119 the start of the rhs as the error start position */
1120 yyerror_loc_range[0] = yystack.p_mark[1-yym];
1121 }
1122 #endif
1123
1124 switch (yyn)
1125 {
1126 case 1:
1127 #line 50 "err_inherit3.y"
1128 yyval.cval = yystack.l_mark[-1].cval;
1129 break;
1130 case 2:
1131 #line 50 "err_inherit3.y"
1132 yyval.tval = yystack.l_mark[-1].tval;
1133 break;
1134 case 3:
1135 #line 51 "err_inherit3.y"
1136 { yyval.nlist = yystack.l_mark[0].nlist; }
1137 break;
1138 case 4:
1139 #line 52 "err_inherit3.y"
1140 yyval.tval = yystack.l_mark[0].tval;
1141 break;
1142 case 5:
1143 #line 53 "err_inherit3.y"
1144 { yyval.nlist = yystack.l_mark[0].nlist; }
1145 break;
1146 case 6:
1147 #line 56 "err_inherit3.y"
1148 { yyval.cval = cGLOBAL; }
1149 break;
1150 case 7:
1151 #line 57 "err_inherit3.y"
1152 { yyval.cval = cLOCAL; }
1153 break;
1154 case 8:
1155 #line 60 "err_inherit3.y"
1156 { yyval.tval = tREAL; }
1157 break;
1158 case 9:
1159 #line 61 "err_inherit3.y"
1160 { yyval.tval = tINTEGER; }
1161 break;
1162 case 10:
1163 #line 64 "err_inherit3.y"
1164 yyval.cval = yystack.l_mark[-2];
1165 break;
1166 case 11:
1167 #line 65 "err_inherit3.y"
1168 { yyval.nlist->s = mksymbol(yystack.l_mark[-5].tval, yystack.l_mark[-5].cval, yystack.l_mark[0].id);
1169 yyval.nlist->next = yystack.l_mark[-1].nlist;
1170 }
1171 break;
1172 case 12:
1173 #line 69 "err_inherit3.y"
1174 { yyval.nlist->s = mksymbol(yystack.l_mark[-3], yystack.l_mark[-3], yystack.l_mark[0].id);
1175 yyval.nlist->next = NULL;
1176 }
1177 break;
1178 case 13:
1179 #line 74 "err_inherit3.y"
1180 yyval.cval = cLOCAL;
1181 break;
1182 case 14:
1183 #line 75 "err_inherit3.y"
1184 { yyval.nlist = yystack.l_mark[0].nlist; }
1185 break;
1186 #line 1185 "err_inherit3.tab.c"
1187 default:
1188 break;
1189 }
1190 yystack.s_mark -= yym;
1191 yystate = *yystack.s_mark;
1192 yystack.l_mark -= yym;
1193 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1194 yystack.p_mark -= yym;
1195 #endif
1196 yym = yylhs[yyn];
1197 if (yystate == 0 && yym == 0)
1198 {
1199 #if YYDEBUG
1200 if (yydebug)
1201 {
1202 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1203 #ifdef YYSTYPE_TOSTRING
1204 #if YYBTYACC
1205 if (!yytrial)
1206 #endif /* YYBTYACC */
1207 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1208 #endif
1209 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1210 }
1211 #endif
1212 yystate = YYFINAL;
1213 *++yystack.s_mark = YYFINAL;
1214 *++yystack.l_mark = yyval;
1215 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1216 *++yystack.p_mark = yyloc;
1217 #endif
1218 if (yychar < 0)
1219 {
1220 #if YYBTYACC
1221 do {
1222 if (yylvp < yylve)
1223 {
1224 /* we're currently re-reading tokens */
1225 yylval = *yylvp++;
1226 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1227 yylloc = *yylpp++;
1228 #endif
1229 yychar = *yylexp++;
1230 break;
1231 }
1232 if (yyps->save)
1233 {
1234 /* in trial mode; save scanner results for future parse attempts */
1235 if (yylvp == yylvlim)
1236 { /* Enlarge lexical value queue */
1237 size_t p = (size_t) (yylvp - yylvals);
1238 size_t s = (size_t) (yylvlim - yylvals);
1239
1240 s += YYLVQUEUEGROWTH;
1241 if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
1242 goto yyenomem;
1243 if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1244 goto yyenomem;
1245 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1246 if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1247 goto yyenomem;
1248 #endif
1249 yylvp = yylve = yylvals + p;
1250 yylvlim = yylvals + s;
1251 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1252 yylpp = yylpe = yylpsns + p;
1253 yylplim = yylpsns + s;
1254 #endif
1255 yylexp = yylexemes + p;
1256 }
1257 *yylexp = (short) YYLEX;
1258 *yylvp++ = yylval;
1259 yylve++;
1260 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1261 *yylpp++ = yylloc;
1262 yylpe++;
1263 #endif
1264 yychar = *yylexp++;
1265 break;
1266 }
1267 /* normal operation, no conflict encountered */
1268 #endif /* YYBTYACC */
1269 yychar = YYLEX;
1270 #if YYBTYACC
1271 } while (0);
1272 #endif /* YYBTYACC */
1273 if (yychar < 0) yychar = YYEOF;
1274 /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1275 #if YYDEBUG
1276 if (yydebug)
1277 {
1278 yys = yyname[YYTRANSLATE(yychar)];
1279 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1280 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1281 }
1282 #endif
1283 }
1284 if (yychar == YYEOF) goto yyaccept;
1285 goto yyloop;
1286 }
1287 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1288 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1289 yystate = yytable[yyn];
1290 else
1291 yystate = yydgoto[yym];
1292 #if YYDEBUG
1293 if (yydebug)
1294 {
1295 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1296 #ifdef YYSTYPE_TOSTRING
1297 #if YYBTYACC
1298 if (!yytrial)
1299 #endif /* YYBTYACC */
1300 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1301 #endif
1302 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1303 }
1304 #endif
1305 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1306 *++yystack.s_mark = (short) yystate;
1307 *++yystack.l_mark = yyval;
1308 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1309 *++yystack.p_mark = yyloc;
1310 #endif
1311 goto yyloop;
1312 #if YYBTYACC
1313
1314 /* Reduction declares that this path is valid. Set yypath and do a full parse */
1315 yyvalid:
1316 if (yypath) YYABORT;
1317 while (yyps->save)
1318 {
1319 YYParseState *save = yyps->save;
1320 yyps->save = save->save;
1321 save->save = yypath;
1322 yypath = save;
1323 }
1324 #if YYDEBUG
1325 if (yydebug)
1326 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1327 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1328 #endif
1329 if (yyerrctx)
1330 {
1331 yyFreeState(yyerrctx);
1332 yyerrctx = NULL;
1333 }
1334 yylvp = yylvals + yypath->lexeme;
1335 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1336 yylpp = yylpsns + yypath->lexeme;
1337 #endif
1338 yylexp = yylexemes + yypath->lexeme;
1339 yychar = YYEMPTY;
1340 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1341 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1342 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1343 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1344 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1345 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1346 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1347 #endif
1348 yystate = yypath->state;
1349 goto yyloop;
1350 #endif /* YYBTYACC */
1351
1352 yyoverflow:
1353 YYERROR_CALL("yacc stack overflow");
1354 #if YYBTYACC
1355 goto yyabort_nomem;
1356 yyenomem:
1357 YYERROR_CALL("memory exhausted");
1358 yyabort_nomem:
1359 #endif /* YYBTYACC */
1360 yyresult = 2;
1361 goto yyreturn;
1362
1363 yyabort:
1364 yyresult = 1;
1365 goto yyreturn;
1366
1367 yyaccept:
1368 #if YYBTYACC
1369 if (yyps->save) goto yyvalid;
1370 #endif /* YYBTYACC */
1371 yyresult = 0;
1372
1373 yyreturn:
1374 #if defined(YYDESTRUCT_CALL)
1375 if (yychar != YYEOF && yychar != YYEMPTY)
1376 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1377 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1378 #else
1379 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1380 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1381
1382 {
1383 YYSTYPE *pv;
1384 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1385 YYLTYPE *pp;
1386
1387 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1388 YYDESTRUCT_CALL("cleanup: discarding state",
1389 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1390 #else
1391 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1392 YYDESTRUCT_CALL("cleanup: discarding state",
1393 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1394 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1395 }
1396 #endif /* defined(YYDESTRUCT_CALL) */
1397
1398 #if YYBTYACC
1399 if (yyerrctx)
1400 {
1401 yyFreeState(yyerrctx);
1402 yyerrctx = NULL;
1403 }
1404 while (yyps)
1405 {
1406 YYParseState *save = yyps;
1407 yyps = save->save;
1408 save->save = NULL;
1409 yyFreeState(save);
1410 }
1411 while (yypath)
1412 {
1413 YYParseState *save = yypath;
1414 yypath = save->save;
1415 save->save = NULL;
1416 yyFreeState(save);
1417 }
1418 #endif /* YYBTYACC */
1419 yyfreestack(&yystack);
1420 return (yyresult);
1421 }
1422