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