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