xref: /freebsd/contrib/byacc/test/btyacc/rename_debug.c (revision ae41709ab46305df80f7f35bb478a3c8ebf22ebb)
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 #line 20 "rename_debug.c"
20 #include "rename_debug.i"
21 #include "rename_debug.h"
22 typedef int YYINT;
23 static const YYINT yylhs[] = {                           -1,
24     0,
25 };
26 static const YYINT yylen[] = {                            2,
27     1,
28 };
29 static const YYINT yydefred[] = {                         0,
30     1,    0,
31 };
32 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
33 static const YYINT yystos[] = {                           0,
34   256,  258,
35 };
36 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
37 static const YYINT yydgoto[] = {                          2,
38 };
39 static const YYINT yysindex[] = {                      -256,
40     0,    0,
41 };
42 static const YYINT yyrindex[] = {                         0,
43     0,    0,
44 };
45 #if YYBTYACC
46 static const YYINT yycindex[] = {                         0,
47     0,    0,
48 };
49 #endif
50 static const YYINT yygindex[] = {                         0,
51 };
52 #define YYTABLESIZE 0
53 static const YYINT yytable[] = {                          1,
54 };
55 static const YYINT yycheck[] = {                        256,
56 };
57 #if YYBTYACC
58 static const YYINT yyctable[] = {                        -1,
59 };
60 #endif
61 #define YYFINAL 2
62 #ifndef YYDEBUG
63 #define YYDEBUG 1
64 #endif
65 #define YYMAXTOKEN 256
66 #define YYUNDFTOKEN 259
67 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
68 #if YYDEBUG
69 static const char *const yyname[] = {
70 
71 "$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,
72 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
73 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
74 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
75 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
76 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
77 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
78 };
79 static const char *const yyrule[] = {
80 "$accept : S",
81 "S : error",
82 
83 };
84 #endif
85 
86 #if YYDEBUG
87 int      yydebug;
88 #endif
89 
90 int      yyerrflag;
91 int      yychar;
92 YYSTYPE  yyval;
93 YYSTYPE  yylval;
94 int      yynerrs;
95 
96 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
97 YYLTYPE  yyloc; /* position returned by actions */
98 YYLTYPE  yylloc; /* position from the lexer */
99 #endif
100 
101 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
102 #ifndef YYLLOC_DEFAULT
103 #define YYLLOC_DEFAULT(loc, rhs, n) \
104 do \
105 { \
106     if (n == 0) \
107     { \
108         (loc).first_line   = YYRHSLOC(rhs, 0).last_line; \
109         (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
110         (loc).last_line    = YYRHSLOC(rhs, 0).last_line; \
111         (loc).last_column  = YYRHSLOC(rhs, 0).last_column; \
112     } \
113     else \
114     { \
115         (loc).first_line   = YYRHSLOC(rhs, 1).first_line; \
116         (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
117         (loc).last_line    = YYRHSLOC(rhs, n).last_line; \
118         (loc).last_column  = YYRHSLOC(rhs, n).last_column; \
119     } \
120 } while (0)
121 #endif /* YYLLOC_DEFAULT */
122 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
123 #if YYBTYACC
124 
125 #ifndef YYLVQUEUEGROWTH
126 #define YYLVQUEUEGROWTH 32
127 #endif
128 #endif /* YYBTYACC */
129 
130 /* define the initial stack-sizes */
131 #ifdef YYSTACKSIZE
132 #undef YYMAXDEPTH
133 #define YYMAXDEPTH  YYSTACKSIZE
134 #else
135 #ifdef YYMAXDEPTH
136 #define YYSTACKSIZE YYMAXDEPTH
137 #else
138 #define YYSTACKSIZE 10000
139 #define YYMAXDEPTH  10000
140 #endif
141 #endif
142 
143 #ifndef YYINITSTACKSIZE
144 #define YYINITSTACKSIZE 200
145 #endif
146 
147 typedef struct {
148     unsigned stacksize;
149     YYINT    *s_base;
150     YYINT    *s_mark;
151     YYINT    *s_last;
152     YYSTYPE  *l_base;
153     YYSTYPE  *l_mark;
154 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
155     YYLTYPE  *p_base;
156     YYLTYPE  *p_mark;
157 #endif
158 } YYSTACKDATA;
159 #if YYBTYACC
160 
161 struct YYParseState_s
162 {
163     struct YYParseState_s *save;    /* Previously saved parser state */
164     YYSTACKDATA            yystack; /* saved parser stack */
165     int                    state;   /* saved parser state */
166     int                    errflag; /* saved error recovery status */
167     int                    lexeme;  /* saved index of the conflict lexeme in the lexical queue */
168     YYINT                  ctry;    /* saved index in yyctable[] for this conflict */
169 };
170 typedef struct YYParseState_s YYParseState;
171 #endif /* YYBTYACC */
172 /* variables for the parser stack */
173 static YYSTACKDATA yystack;
174 #if YYBTYACC
175 
176 /* Current parser state */
177 static YYParseState *yyps = 0;
178 
179 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
180 static YYParseState *yypath = 0;
181 
182 /* Base of the lexical value queue */
183 static YYSTYPE *yylvals = 0;
184 
185 /* Current position at lexical value queue */
186 static YYSTYPE *yylvp = 0;
187 
188 /* End position of lexical value queue */
189 static YYSTYPE *yylve = 0;
190 
191 /* The last allocated position at the lexical value queue */
192 static YYSTYPE *yylvlim = 0;
193 
194 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
195 /* Base of the lexical position queue */
196 static YYLTYPE *yylpsns = 0;
197 
198 /* Current position at lexical position queue */
199 static YYLTYPE *yylpp = 0;
200 
201 /* End position of lexical position queue */
202 static YYLTYPE *yylpe = 0;
203 
204 /* The last allocated position at the lexical position queue */
205 static YYLTYPE *yylplim = 0;
206 #endif
207 
208 /* Current position at lexical token queue */
209 static YYINT  *yylexp = 0;
210 
211 static YYINT  *yylexemes = 0;
212 #endif /* YYBTYACC */
213 #line 12 "code_debug.y"
214 
215 #include <stdio.h>
216 
217 #ifdef YYBYACC
218 extern int YYLEX_DECL();
219 #endif
220 
221 int
222 main(void)
223 {
224     printf("yyparse() = %d\n", yyparse());
225     return 0;
226 }
227 
228 int
229 yylex(void)
230 {
231     return -1;
232 }
233 
234 static void
235 yyerror(const char* s)
236 {
237     printf("%s\n", s);
238 }
239 #line 241 "rename_debug.c"
240 
241 /* For use in generated program */
242 #define yydepth (int)(yystack.s_mark - yystack.s_base)
243 #if YYBTYACC
244 #define yytrial (yyps->save)
245 #endif /* YYBTYACC */
246 
247 #if YYDEBUG
248 #include <stdio.h>	/* needed for printf */
249 #endif
250 
251 #include <stdlib.h>	/* needed for malloc, etc */
252 #include <string.h>	/* needed for memset */
253 
254 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
255 static int yygrowstack(YYSTACKDATA *data)
256 {
257     int i;
258     unsigned newsize;
259     YYINT *newss;
260     YYSTYPE *newvs;
261 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
262     YYLTYPE *newps;
263 #endif
264 
265     if ((newsize = data->stacksize) == 0)
266         newsize = YYINITSTACKSIZE;
267     else if (newsize >= YYMAXDEPTH)
268         return YYENOMEM;
269     else if ((newsize *= 2) > YYMAXDEPTH)
270         newsize = YYMAXDEPTH;
271 
272     i = (int) (data->s_mark - data->s_base);
273     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
274     if (newss == 0)
275         return YYENOMEM;
276 
277     data->s_base = newss;
278     data->s_mark = newss + i;
279 
280     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
281     if (newvs == 0)
282         return YYENOMEM;
283 
284     data->l_base = newvs;
285     data->l_mark = newvs + i;
286 
287 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
288     newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
289     if (newps == 0)
290         return YYENOMEM;
291 
292     data->p_base = newps;
293     data->p_mark = newps + i;
294 #endif
295 
296     data->stacksize = newsize;
297     data->s_last = data->s_base + newsize - 1;
298 
299 #if YYDEBUG
300     if (yydebug)
301         fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
302 #endif
303     return 0;
304 }
305 
306 #if YYPURE || defined(YY_NO_LEAKS)
307 static void yyfreestack(YYSTACKDATA *data)
308 {
309     free(data->s_base);
310     free(data->l_base);
311 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
312     free(data->p_base);
313 #endif
314     memset(data, 0, sizeof(*data));
315 }
316 #else
317 #define yyfreestack(data) /* nothing */
318 #endif /* YYPURE || defined(YY_NO_LEAKS) */
319 #if YYBTYACC
320 
321 static YYParseState *
322 yyNewState(unsigned size)
323 {
324     YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
325     if (p == NULL) return NULL;
326 
327     p->yystack.stacksize = size;
328     if (size == 0)
329     {
330         p->yystack.s_base = NULL;
331         p->yystack.l_base = NULL;
332 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
333         p->yystack.p_base = NULL;
334 #endif
335         return p;
336     }
337     p->yystack.s_base    = (YYINT *) malloc(size * sizeof(YYINT));
338     if (p->yystack.s_base == NULL) return NULL;
339     p->yystack.l_base    = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
340     if (p->yystack.l_base == NULL) return NULL;
341     memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
342 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
343     p->yystack.p_base    = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
344     if (p->yystack.p_base == NULL) return NULL;
345     memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
346 #endif
347 
348     return p;
349 }
350 
351 static void
352 yyFreeState(YYParseState *p)
353 {
354     yyfreestack(&p->yystack);
355     free(p);
356 }
357 #endif /* YYBTYACC */
358 
359 #define YYABORT  goto yyabort
360 #define YYREJECT goto yyabort
361 #define YYACCEPT goto yyaccept
362 #define YYERROR  goto yyerrlab
363 #if YYBTYACC
364 #define YYVALID        do { if (yyps->save)            goto yyvalid; } while(0)
365 #define YYVALID_NESTED do { if (yyps->save && \
366                                 yyps->save->save == 0) goto yyvalid; } while(0)
367 #endif /* YYBTYACC */
368 
369 int
370 YYPARSE_DECL()
371 {
372     int yym, yyn, yystate, yyresult;
373 #if YYBTYACC
374     int yynewerrflag;
375     YYParseState *yyerrctx = NULL;
376 #endif /* YYBTYACC */
377 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
378     YYLTYPE  yyerror_loc_range[3]; /* position of error start/end (0 unused) */
379 #endif
380 #if YYDEBUG
381     const char *yys;
382 
383     if ((yys = getenv("YYDEBUG")) != 0)
384     {
385         yyn = *yys;
386         if (yyn >= '0' && yyn <= '9')
387             yydebug = yyn - '0';
388     }
389     if (yydebug)
390         fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
391 #endif
392 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
393     memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
394 #endif
395 
396 #if YYBTYACC
397     yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
398     yyps->save = 0;
399 #endif /* YYBTYACC */
400     yym = 0;
401     yyn = 0;
402     yynerrs = 0;
403     yyerrflag = 0;
404     yychar = YYEMPTY;
405     yystate = 0;
406 
407 #if YYPURE
408     memset(&yystack, 0, sizeof(yystack));
409 #endif
410 
411     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
412     yystack.s_mark = yystack.s_base;
413     yystack.l_mark = yystack.l_base;
414 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
415     yystack.p_mark = yystack.p_base;
416 #endif
417     yystate = 0;
418     *yystack.s_mark = 0;
419 
420 yyloop:
421     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
422     if (yychar < 0)
423     {
424 #if YYBTYACC
425         do {
426         if (yylvp < yylve)
427         {
428             /* we're currently re-reading tokens */
429             yylval = *yylvp++;
430 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
431             yylloc = *yylpp++;
432 #endif
433             yychar = *yylexp++;
434             break;
435         }
436         if (yyps->save)
437         {
438             /* in trial mode; save scanner results for future parse attempts */
439             if (yylvp == yylvlim)
440             {   /* Enlarge lexical value queue */
441                 size_t p = (size_t) (yylvp - yylvals);
442                 size_t s = (size_t) (yylvlim - yylvals);
443 
444                 s += YYLVQUEUEGROWTH;
445                 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
446                 if ((yylvals   = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
447 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
448                 if ((yylpsns   = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
449 #endif
450                 yylvp   = yylve = yylvals + p;
451                 yylvlim = yylvals + s;
452 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
453                 yylpp   = yylpe = yylpsns + p;
454                 yylplim = yylpsns + s;
455 #endif
456                 yylexp  = yylexemes + p;
457             }
458             *yylexp = (YYINT) YYLEX;
459             *yylvp++ = yylval;
460             yylve++;
461 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
462             *yylpp++ = yylloc;
463             yylpe++;
464 #endif
465             yychar = *yylexp++;
466             break;
467         }
468         /* normal operation, no conflict encountered */
469 #endif /* YYBTYACC */
470         yychar = YYLEX;
471 #if YYBTYACC
472         } while (0);
473 #endif /* YYBTYACC */
474         if (yychar < 0) yychar = YYEOF;
475 #if YYDEBUG
476         if (yydebug)
477         {
478             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
479             fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
480                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
481 #ifdef YYSTYPE_TOSTRING
482 #if YYBTYACC
483             if (!yytrial)
484 #endif /* YYBTYACC */
485                 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
486 #endif
487             fputc('\n', stderr);
488         }
489 #endif
490     }
491 #if YYBTYACC
492 
493     /* Do we have a conflict? */
494     if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
495         yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
496     {
497         YYINT ctry;
498 
499         if (yypath)
500         {
501             YYParseState *save;
502 #if YYDEBUG
503             if (yydebug)
504                 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
505                                 YYDEBUGSTR, yydepth, yystate);
506 #endif
507             /* Switch to the next conflict context */
508             save = yypath;
509             yypath = save->save;
510             save->save = NULL;
511             ctry = save->ctry;
512             if (save->state != yystate) YYABORT;
513             yyFreeState(save);
514 
515         }
516         else
517         {
518 
519             /* Unresolved conflict - start/continue trial parse */
520             YYParseState *save;
521 #if YYDEBUG
522             if (yydebug)
523             {
524                 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
525                 if (yyps->save)
526                     fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
527                 else
528                     fputs("Starting trial parse.\n", stderr);
529             }
530 #endif
531             save                  = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
532             if (save == NULL) goto yyenomem;
533             save->save            = yyps->save;
534             save->state           = yystate;
535             save->errflag         = yyerrflag;
536             save->yystack.s_mark  = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
537             memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
538             save->yystack.l_mark  = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
539             memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
540 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
541             save->yystack.p_mark  = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
542             memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
543 #endif
544             ctry                  = yytable[yyn];
545             if (yyctable[ctry] == -1)
546             {
547 #if YYDEBUG
548                 if (yydebug && yychar >= YYEOF)
549                     fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
550 #endif
551                 ctry++;
552             }
553             save->ctry = ctry;
554             if (yyps->save == NULL)
555             {
556                 /* If this is a first conflict in the stack, start saving lexemes */
557                 if (!yylexemes)
558                 {
559                     yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
560                     if (yylexemes == NULL) goto yyenomem;
561                     yylvals   = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
562                     if (yylvals == NULL) goto yyenomem;
563                     yylvlim   = yylvals + YYLVQUEUEGROWTH;
564 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
565                     yylpsns   = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
566                     if (yylpsns == NULL) goto yyenomem;
567                     yylplim   = yylpsns + YYLVQUEUEGROWTH;
568 #endif
569                 }
570                 if (yylvp == yylve)
571                 {
572                     yylvp  = yylve = yylvals;
573 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
574                     yylpp  = yylpe = yylpsns;
575 #endif
576                     yylexp = yylexemes;
577                     if (yychar >= YYEOF)
578                     {
579                         *yylve++ = yylval;
580 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
581                         *yylpe++ = yylloc;
582 #endif
583                         *yylexp  = (YYINT) yychar;
584                         yychar   = YYEMPTY;
585                     }
586                 }
587             }
588             if (yychar >= YYEOF)
589             {
590                 yylvp--;
591 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
592                 yylpp--;
593 #endif
594                 yylexp--;
595                 yychar = YYEMPTY;
596             }
597             save->lexeme = (int) (yylvp - yylvals);
598             yyps->save   = save;
599         }
600         if (yytable[yyn] == ctry)
601         {
602 #if YYDEBUG
603             if (yydebug)
604                 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
605                                 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
606 #endif
607             if (yychar < 0)
608             {
609                 yylvp++;
610 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
611                 yylpp++;
612 #endif
613                 yylexp++;
614             }
615             if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
616                 goto yyoverflow;
617             yystate = yyctable[ctry];
618             *++yystack.s_mark = (YYINT) yystate;
619             *++yystack.l_mark = yylval;
620 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
621             *++yystack.p_mark = yylloc;
622 #endif
623             yychar  = YYEMPTY;
624             if (yyerrflag > 0) --yyerrflag;
625             goto yyloop;
626         }
627         else
628         {
629             yyn = yyctable[ctry];
630             goto yyreduce;
631         }
632     } /* End of code dealing with conflicts */
633 #endif /* YYBTYACC */
634     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
635             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
636     {
637 #if YYDEBUG
638         if (yydebug)
639             fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
640                             YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
641 #endif
642         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
643         yystate = yytable[yyn];
644         *++yystack.s_mark = yytable[yyn];
645         *++yystack.l_mark = yylval;
646 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
647         *++yystack.p_mark = yylloc;
648 #endif
649         yychar = YYEMPTY;
650         if (yyerrflag > 0)  --yyerrflag;
651         goto yyloop;
652     }
653     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
654             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
655     {
656         yyn = yytable[yyn];
657         goto yyreduce;
658     }
659     if (yyerrflag != 0) goto yyinrecovery;
660 #if YYBTYACC
661 
662     yynewerrflag = 1;
663     goto yyerrhandler;
664     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
665 
666 yyerrlab:
667     /* explicit YYERROR from an action -- pop the rhs of the rule reduced
668      * before looking for error recovery */
669     yystack.s_mark -= yym;
670     yystate = *yystack.s_mark;
671     yystack.l_mark -= yym;
672 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
673     yystack.p_mark -= yym;
674 #endif
675 
676     yynewerrflag = 0;
677 yyerrhandler:
678     while (yyps->save)
679     {
680         int ctry;
681         YYParseState *save = yyps->save;
682 #if YYDEBUG
683         if (yydebug)
684             fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
685                             YYDEBUGSTR, yydepth, yystate, yyps->save->state,
686                     (int)(yylvp - yylvals - yyps->save->lexeme));
687 #endif
688         /* Memorize most forward-looking error state in case it's really an error. */
689         if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
690         {
691             /* Free old saved error context state */
692             if (yyerrctx) yyFreeState(yyerrctx);
693             /* Create and fill out new saved error context state */
694             yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
695             if (yyerrctx == NULL) goto yyenomem;
696             yyerrctx->save           = yyps->save;
697             yyerrctx->state          = yystate;
698             yyerrctx->errflag        = yyerrflag;
699             yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
700             memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
701             yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
702             memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
703 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
704             yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
705             memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
706 #endif
707             yyerrctx->lexeme         = (int) (yylvp - yylvals);
708         }
709         yylvp          = yylvals   + save->lexeme;
710 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
711         yylpp          = yylpsns   + save->lexeme;
712 #endif
713         yylexp         = yylexemes + save->lexeme;
714         yychar         = YYEMPTY;
715         yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
716         memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
717         yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
718         memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
719 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
720         yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
721         memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
722 #endif
723         ctry           = ++save->ctry;
724         yystate        = save->state;
725         /* We tried shift, try reduce now */
726         if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
727         yyps->save     = save->save;
728         save->save     = NULL;
729         yyFreeState(save);
730 
731         /* Nothing left on the stack -- error */
732         if (!yyps->save)
733         {
734 #if YYDEBUG
735             if (yydebug)
736                 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
737                                 YYPREFIX, yydepth);
738 #endif
739             /* Restore state as it was in the most forward-advanced error */
740             yylvp          = yylvals   + yyerrctx->lexeme;
741 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
742             yylpp          = yylpsns   + yyerrctx->lexeme;
743 #endif
744             yylexp         = yylexemes + yyerrctx->lexeme;
745             yychar         = yylexp[-1];
746             yylval         = yylvp[-1];
747 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
748             yylloc         = yylpp[-1];
749 #endif
750             yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
751             memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
752             yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
753             memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
754 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
755             yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
756             memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
757 #endif
758             yystate        = yyerrctx->state;
759             yyFreeState(yyerrctx);
760             yyerrctx       = NULL;
761         }
762         yynewerrflag = 1;
763     }
764     if (yynewerrflag == 0) goto yyinrecovery;
765 #endif /* YYBTYACC */
766 
767     YYERROR_CALL("syntax error");
768 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
769     yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
770 #endif
771 
772 #if !YYBTYACC
773     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
774 yyerrlab:
775 #endif
776     ++yynerrs;
777 
778 yyinrecovery:
779     if (yyerrflag < 3)
780     {
781         yyerrflag = 3;
782         for (;;)
783         {
784             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
785                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
786             {
787 #if YYDEBUG
788                 if (yydebug)
789                     fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
790                                     YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
791 #endif
792                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
793                 yystate = yytable[yyn];
794                 *++yystack.s_mark = yytable[yyn];
795                 *++yystack.l_mark = yylval;
796 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
797                 /* lookahead position is error end position */
798                 yyerror_loc_range[2] = yylloc;
799                 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
800                 *++yystack.p_mark = yyloc;
801 #endif
802                 goto yyloop;
803             }
804             else
805             {
806 #if YYDEBUG
807                 if (yydebug)
808                     fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
809                                     YYDEBUGSTR, yydepth, *yystack.s_mark);
810 #endif
811                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
812 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
813                 /* the current TOS position is the error start position */
814                 yyerror_loc_range[1] = *yystack.p_mark;
815 #endif
816 #if defined(YYDESTRUCT_CALL)
817 #if YYBTYACC
818                 if (!yytrial)
819 #endif /* YYBTYACC */
820 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
821                     YYDESTRUCT_CALL("error: discarding state",
822                                     yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
823 #else
824                     YYDESTRUCT_CALL("error: discarding state",
825                                     yystos[*yystack.s_mark], yystack.l_mark);
826 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
827 #endif /* defined(YYDESTRUCT_CALL) */
828                 --yystack.s_mark;
829                 --yystack.l_mark;
830 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
831                 --yystack.p_mark;
832 #endif
833             }
834         }
835     }
836     else
837     {
838         if (yychar == YYEOF) goto yyabort;
839 #if YYDEBUG
840         if (yydebug)
841         {
842             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
843             fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
844                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
845         }
846 #endif
847 #if defined(YYDESTRUCT_CALL)
848 #if YYBTYACC
849         if (!yytrial)
850 #endif /* YYBTYACC */
851 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
852             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
853 #else
854             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
855 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
856 #endif /* defined(YYDESTRUCT_CALL) */
857         yychar = YYEMPTY;
858         goto yyloop;
859     }
860 
861 yyreduce:
862     yym = yylen[yyn];
863 #if YYDEBUG
864     if (yydebug)
865     {
866         fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
867                         YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
868 #ifdef YYSTYPE_TOSTRING
869 #if YYBTYACC
870         if (!yytrial)
871 #endif /* YYBTYACC */
872             if (yym > 0)
873             {
874                 int i;
875                 fputc('<', stderr);
876                 for (i = yym; i > 0; i--)
877                 {
878                     if (i != yym) fputs(", ", stderr);
879                     fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
880                                            yystack.l_mark[1-i]), stderr);
881                 }
882                 fputc('>', stderr);
883             }
884 #endif
885         fputc('\n', stderr);
886     }
887 #endif
888     if (yym > 0)
889         yyval = yystack.l_mark[1-yym];
890     else
891         memset(&yyval, 0, sizeof yyval);
892 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
893 
894     /* Perform position reduction */
895     memset(&yyloc, 0, sizeof(yyloc));
896 #if YYBTYACC
897     if (!yytrial)
898 #endif /* YYBTYACC */
899     {
900         YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
901         /* just in case YYERROR is invoked within the action, save
902            the start of the rhs as the error start position */
903         yyerror_loc_range[1] = yystack.p_mark[1-yym];
904     }
905 #endif
906 
907     switch (yyn)
908     {
909     default:
910         break;
911     }
912     yystack.s_mark -= yym;
913     yystate = *yystack.s_mark;
914     yystack.l_mark -= yym;
915 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
916     yystack.p_mark -= yym;
917 #endif
918     yym = yylhs[yyn];
919     if (yystate == 0 && yym == 0)
920     {
921 #if YYDEBUG
922         if (yydebug)
923         {
924             fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
925 #ifdef YYSTYPE_TOSTRING
926 #if YYBTYACC
927             if (!yytrial)
928 #endif /* YYBTYACC */
929                 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
930 #endif
931             fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
932         }
933 #endif
934         yystate = YYFINAL;
935         *++yystack.s_mark = YYFINAL;
936         *++yystack.l_mark = yyval;
937 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
938         *++yystack.p_mark = yyloc;
939 #endif
940         if (yychar < 0)
941         {
942 #if YYBTYACC
943             do {
944             if (yylvp < yylve)
945             {
946                 /* we're currently re-reading tokens */
947                 yylval = *yylvp++;
948 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
949                 yylloc = *yylpp++;
950 #endif
951                 yychar = *yylexp++;
952                 break;
953             }
954             if (yyps->save)
955             {
956                 /* in trial mode; save scanner results for future parse attempts */
957                 if (yylvp == yylvlim)
958                 {   /* Enlarge lexical value queue */
959                     size_t p = (size_t) (yylvp - yylvals);
960                     size_t s = (size_t) (yylvlim - yylvals);
961 
962                     s += YYLVQUEUEGROWTH;
963                     if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
964                         goto yyenomem;
965                     if ((yylvals   = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
966                         goto yyenomem;
967 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
968                     if ((yylpsns   = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
969                         goto yyenomem;
970 #endif
971                     yylvp   = yylve = yylvals + p;
972                     yylvlim = yylvals + s;
973 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
974                     yylpp   = yylpe = yylpsns + p;
975                     yylplim = yylpsns + s;
976 #endif
977                     yylexp  = yylexemes + p;
978                 }
979                 *yylexp = (YYINT) YYLEX;
980                 *yylvp++ = yylval;
981                 yylve++;
982 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
983                 *yylpp++ = yylloc;
984                 yylpe++;
985 #endif
986                 yychar = *yylexp++;
987                 break;
988             }
989             /* normal operation, no conflict encountered */
990 #endif /* YYBTYACC */
991             yychar = YYLEX;
992 #if YYBTYACC
993             } while (0);
994 #endif /* YYBTYACC */
995             if (yychar < 0) yychar = YYEOF;
996 #if YYDEBUG
997             if (yydebug)
998             {
999                 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1000                 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1001                                 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1002             }
1003 #endif
1004         }
1005         if (yychar == YYEOF) goto yyaccept;
1006         goto yyloop;
1007     }
1008     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1009             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1010         yystate = yytable[yyn];
1011     else
1012         yystate = yydgoto[yym];
1013 #if YYDEBUG
1014     if (yydebug)
1015     {
1016         fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1017 #ifdef YYSTYPE_TOSTRING
1018 #if YYBTYACC
1019         if (!yytrial)
1020 #endif /* YYBTYACC */
1021             fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1022 #endif
1023         fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1024     }
1025 #endif
1026     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1027     *++yystack.s_mark = (YYINT) yystate;
1028     *++yystack.l_mark = yyval;
1029 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1030     *++yystack.p_mark = yyloc;
1031 #endif
1032     goto yyloop;
1033 #if YYBTYACC
1034 
1035     /* Reduction declares that this path is valid. Set yypath and do a full parse */
1036 yyvalid:
1037     if (yypath) YYABORT;
1038     while (yyps->save)
1039     {
1040         YYParseState *save = yyps->save;
1041         yyps->save = save->save;
1042         save->save = yypath;
1043         yypath = save;
1044     }
1045 #if YYDEBUG
1046     if (yydebug)
1047         fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1048                         YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1049 #endif
1050     if (yyerrctx)
1051     {
1052         yyFreeState(yyerrctx);
1053         yyerrctx = NULL;
1054     }
1055     yylvp          = yylvals + yypath->lexeme;
1056 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1057     yylpp          = yylpsns + yypath->lexeme;
1058 #endif
1059     yylexp         = yylexemes + yypath->lexeme;
1060     yychar         = YYEMPTY;
1061     yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1062     memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1063     yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1064     memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1065 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1066     yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1067     memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1068 #endif
1069     yystate        = yypath->state;
1070     goto yyloop;
1071 #endif /* YYBTYACC */
1072 
1073 yyoverflow:
1074     YYERROR_CALL("yacc stack overflow");
1075 #if YYBTYACC
1076     goto yyabort_nomem;
1077 yyenomem:
1078     YYERROR_CALL("memory exhausted");
1079 yyabort_nomem:
1080 #endif /* YYBTYACC */
1081     yyresult = 2;
1082     goto yyreturn;
1083 
1084 yyabort:
1085     yyresult = 1;
1086     goto yyreturn;
1087 
1088 yyaccept:
1089 #if YYBTYACC
1090     if (yyps->save) goto yyvalid;
1091 #endif /* YYBTYACC */
1092     yyresult = 0;
1093 
1094 yyreturn:
1095 #if defined(YYDESTRUCT_CALL)
1096     if (yychar != YYEOF && yychar != YYEMPTY)
1097 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1098         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1099 #else
1100         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1101 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1102 
1103     {
1104         YYSTYPE *pv;
1105 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1106         YYLTYPE *pp;
1107 
1108         for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1109              YYDESTRUCT_CALL("cleanup: discarding state",
1110                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1111 #else
1112         for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1113              YYDESTRUCT_CALL("cleanup: discarding state",
1114                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1115 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1116     }
1117 #endif /* defined(YYDESTRUCT_CALL) */
1118 
1119 #if YYBTYACC
1120     if (yyerrctx)
1121     {
1122         yyFreeState(yyerrctx);
1123         yyerrctx = NULL;
1124     }
1125     while (yyps)
1126     {
1127         YYParseState *save = yyps;
1128         yyps = save->save;
1129         save->save = NULL;
1130         yyFreeState(save);
1131     }
1132     while (yypath)
1133     {
1134         YYParseState *save = yypath;
1135         yypath = save->save;
1136         save->save = NULL;
1137         yyFreeState(save);
1138     }
1139 #endif /* YYBTYACC */
1140     yyfreestack(&yystack);
1141     return (yyresult);
1142 }
1143