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