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