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