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