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