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