xref: /freebsd/contrib/byacc/test/btyacc/quote_calc2.tab.c (revision c81ab40b6a5ceb35a5b0464cdc8108e5023ff76b)
1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent of 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     short    *s_base;
425     short    *s_mark;
426     short    *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     short *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 = (short *)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    = (short *) malloc(size * sizeof(short));
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     yynerrs = 0;
688     yyerrflag = 0;
689     yychar = YYEMPTY;
690     yystate = 0;
691 
692 #if YYPURE
693     memset(&yystack, 0, sizeof(yystack));
694 #endif
695 
696     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
697     yystack.s_mark = yystack.s_base;
698     yystack.l_mark = yystack.l_base;
699 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
700     yystack.p_mark = yystack.p_base;
701 #endif
702     yystate = 0;
703     *yystack.s_mark = 0;
704 
705 yyloop:
706     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
707     if (yychar < 0)
708     {
709 #if YYBTYACC
710         do {
711         if (yylvp < yylve)
712         {
713             /* we're currently re-reading tokens */
714             yylval = *yylvp++;
715 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
716             yylloc = *yylpp++;
717 #endif
718             yychar = *yylexp++;
719             break;
720         }
721         if (yyps->save)
722         {
723             /* in trial mode; save scanner results for future parse attempts */
724             if (yylvp == yylvlim)
725             {   /* Enlarge lexical value queue */
726                 size_t p = (size_t) (yylvp - yylvals);
727                 size_t s = (size_t) (yylvlim - yylvals);
728 
729                 s += YYLVQUEUEGROWTH;
730                 if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
731                 if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
732 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
733                 if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
734 #endif
735                 yylvp   = yylve = yylvals + p;
736                 yylvlim = yylvals + s;
737 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
738                 yylpp   = yylpe = yylpsns + p;
739                 yylplim = yylpsns + s;
740 #endif
741                 yylexp  = yylexemes + p;
742             }
743             *yylexp = (short) YYLEX;
744             *yylvp++ = yylval;
745             yylve++;
746 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
747             *yylpp++ = yylloc;
748             yylpe++;
749 #endif
750             yychar = *yylexp++;
751             break;
752         }
753         /* normal operation, no conflict encountered */
754 #endif /* YYBTYACC */
755         yychar = YYLEX;
756 #if YYBTYACC
757         } while (0);
758 #endif /* YYBTYACC */
759         if (yychar < 0) yychar = YYEOF;
760         /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
761 #if YYDEBUG
762         if (yydebug)
763         {
764             yys = yyname[YYTRANSLATE(yychar)];
765             fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
766                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
767 #ifdef YYSTYPE_TOSTRING
768 #if YYBTYACC
769             if (!yytrial)
770 #endif /* YYBTYACC */
771                 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
772 #endif
773             fputc('\n', stderr);
774         }
775 #endif
776     }
777 #if YYBTYACC
778 
779     /* Do we have a conflict? */
780     if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
781         yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
782     {
783         YYINT ctry;
784 
785         if (yypath)
786         {
787             YYParseState *save;
788 #if YYDEBUG
789             if (yydebug)
790                 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
791                                 YYDEBUGSTR, yydepth, yystate);
792 #endif
793             /* Switch to the next conflict context */
794             save = yypath;
795             yypath = save->save;
796             save->save = NULL;
797             ctry = save->ctry;
798             if (save->state != yystate) YYABORT;
799             yyFreeState(save);
800 
801         }
802         else
803         {
804 
805             /* Unresolved conflict - start/continue trial parse */
806             YYParseState *save;
807 #if YYDEBUG
808             if (yydebug)
809             {
810                 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
811                 if (yyps->save)
812                     fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
813                 else
814                     fputs("Starting trial parse.\n", stderr);
815             }
816 #endif
817             save                  = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
818             if (save == NULL) goto yyenomem;
819             save->save            = yyps->save;
820             save->state           = yystate;
821             save->errflag         = yyerrflag;
822             save->yystack.s_mark  = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
823             memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
824             save->yystack.l_mark  = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
825             memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
826 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
827             save->yystack.p_mark  = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
828             memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
829 #endif
830             ctry                  = yytable[yyn];
831             if (yyctable[ctry] == -1)
832             {
833 #if YYDEBUG
834                 if (yydebug && yychar >= YYEOF)
835                     fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
836 #endif
837                 ctry++;
838             }
839             save->ctry = ctry;
840             if (yyps->save == NULL)
841             {
842                 /* If this is a first conflict in the stack, start saving lexemes */
843                 if (!yylexemes)
844                 {
845                     yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
846                     if (yylexemes == NULL) goto yyenomem;
847                     yylvals   = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
848                     if (yylvals == NULL) goto yyenomem;
849                     yylvlim   = yylvals + YYLVQUEUEGROWTH;
850 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
851                     yylpsns   = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
852                     if (yylpsns == NULL) goto yyenomem;
853                     yylplim   = yylpsns + YYLVQUEUEGROWTH;
854 #endif
855                 }
856                 if (yylvp == yylve)
857                 {
858                     yylvp  = yylve = yylvals;
859 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
860                     yylpp  = yylpe = yylpsns;
861 #endif
862                     yylexp = yylexemes;
863                     if (yychar >= YYEOF)
864                     {
865                         *yylve++ = yylval;
866 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
867                         *yylpe++ = yylloc;
868 #endif
869                         *yylexp  = (short) yychar;
870                         yychar   = YYEMPTY;
871                     }
872                 }
873             }
874             if (yychar >= YYEOF)
875             {
876                 yylvp--;
877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
878                 yylpp--;
879 #endif
880                 yylexp--;
881                 yychar = YYEMPTY;
882             }
883             save->lexeme = (int) (yylvp - yylvals);
884             yyps->save   = save;
885         }
886         if (yytable[yyn] == ctry)
887         {
888 #if YYDEBUG
889             if (yydebug)
890                 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
891                                 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
892 #endif
893             if (yychar < 0)
894             {
895                 yylvp++;
896 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
897                 yylpp++;
898 #endif
899                 yylexp++;
900             }
901             if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
902                 goto yyoverflow;
903             yystate = yyctable[ctry];
904             *++yystack.s_mark = (short) yystate;
905             *++yystack.l_mark = yylval;
906 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
907             *++yystack.p_mark = yylloc;
908 #endif
909             yychar  = YYEMPTY;
910             if (yyerrflag > 0) --yyerrflag;
911             goto yyloop;
912         }
913         else
914         {
915             yyn = yyctable[ctry];
916             goto yyreduce;
917         }
918     } /* End of code dealing with conflicts */
919 #endif /* YYBTYACC */
920     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
921             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
922     {
923 #if YYDEBUG
924         if (yydebug)
925             fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
926                             YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
927 #endif
928         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
929         yystate = yytable[yyn];
930         *++yystack.s_mark = yytable[yyn];
931         *++yystack.l_mark = yylval;
932 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
933         *++yystack.p_mark = yylloc;
934 #endif
935         yychar = YYEMPTY;
936         if (yyerrflag > 0)  --yyerrflag;
937         goto yyloop;
938     }
939     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
940             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
941     {
942         yyn = yytable[yyn];
943         goto yyreduce;
944     }
945     if (yyerrflag != 0) goto yyinrecovery;
946 #if YYBTYACC
947 
948     yynewerrflag = 1;
949     goto yyerrhandler;
950     goto yyerrlab;
951 
952 yyerrlab:
953     yynewerrflag = 0;
954 yyerrhandler:
955     while (yyps->save)
956     {
957         int ctry;
958         YYParseState *save = yyps->save;
959 #if YYDEBUG
960         if (yydebug)
961             fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
962                             YYDEBUGSTR, yydepth, yystate, yyps->save->state,
963                     (int)(yylvp - yylvals - yyps->save->lexeme));
964 #endif
965         /* Memorize most forward-looking error state in case it's really an error. */
966         if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
967         {
968             /* Free old saved error context state */
969             if (yyerrctx) yyFreeState(yyerrctx);
970             /* Create and fill out new saved error context state */
971             yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
972             if (yyerrctx == NULL) goto yyenomem;
973             yyerrctx->save           = yyps->save;
974             yyerrctx->state          = yystate;
975             yyerrctx->errflag        = yyerrflag;
976             yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
977             memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
978             yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
979             memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
980 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
981             yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
982             memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
983 #endif
984             yyerrctx->lexeme         = (int) (yylvp - yylvals);
985         }
986         yylvp          = yylvals   + save->lexeme;
987 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
988         yylpp          = yylpsns   + save->lexeme;
989 #endif
990         yylexp         = yylexemes + save->lexeme;
991         yychar         = YYEMPTY;
992         yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
993         memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
994         yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
995         memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
996 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
997         yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
998         memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
999 #endif
1000         ctry           = ++save->ctry;
1001         yystate        = save->state;
1002         /* We tried shift, try reduce now */
1003         if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1004         yyps->save     = save->save;
1005         save->save     = NULL;
1006         yyFreeState(save);
1007 
1008         /* Nothing left on the stack -- error */
1009         if (!yyps->save)
1010         {
1011 #if YYDEBUG
1012             if (yydebug)
1013                 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1014                                 YYPREFIX, yydepth);
1015 #endif
1016             /* Restore state as it was in the most forward-advanced error */
1017             yylvp          = yylvals   + yyerrctx->lexeme;
1018 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1019             yylpp          = yylpsns   + yyerrctx->lexeme;
1020 #endif
1021             yylexp         = yylexemes + yyerrctx->lexeme;
1022             yychar         = yylexp[-1];
1023             yylval         = yylvp[-1];
1024 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1025             yylloc         = yylpp[-1];
1026 #endif
1027             yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1028             memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1029             yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1030             memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1031 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1032             yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1033             memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1034 #endif
1035             yystate        = yyerrctx->state;
1036             yyFreeState(yyerrctx);
1037             yyerrctx       = NULL;
1038         }
1039         yynewerrflag = 1;
1040     }
1041     if (yynewerrflag == 0) goto yyinrecovery;
1042 #endif /* YYBTYACC */
1043 
1044     YYERROR_CALL("syntax error");
1045 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1046     yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1047 #endif
1048 
1049 #if !YYBTYACC
1050     goto yyerrlab;
1051 yyerrlab:
1052 #endif
1053     ++yynerrs;
1054 
1055 yyinrecovery:
1056     if (yyerrflag < 3)
1057     {
1058         yyerrflag = 3;
1059         for (;;)
1060         {
1061             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1062                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1063             {
1064 #if YYDEBUG
1065                 if (yydebug)
1066                     fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1067                                     YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1068 #endif
1069                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1070                 yystate = yytable[yyn];
1071                 *++yystack.s_mark = yytable[yyn];
1072                 *++yystack.l_mark = yylval;
1073 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1074                 /* lookahead position is error end position */
1075                 yyerror_loc_range[1] = yylloc;
1076                 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1077                 *++yystack.p_mark = yyloc;
1078 #endif
1079                 goto yyloop;
1080             }
1081             else
1082             {
1083 #if YYDEBUG
1084                 if (yydebug)
1085                     fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1086                                     YYDEBUGSTR, yydepth, *yystack.s_mark);
1087 #endif
1088                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1089 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1090                 /* the current TOS position is the error start position */
1091                 yyerror_loc_range[0] = *yystack.p_mark;
1092 #endif
1093 #if defined(YYDESTRUCT_CALL)
1094 #if YYBTYACC
1095                 if (!yytrial)
1096 #endif /* YYBTYACC */
1097 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1098                     YYDESTRUCT_CALL("error: discarding state",
1099                                     yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1100 #else
1101                     YYDESTRUCT_CALL("error: discarding state",
1102                                     yystos[*yystack.s_mark], yystack.l_mark);
1103 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1104 #endif /* defined(YYDESTRUCT_CALL) */
1105                 --yystack.s_mark;
1106                 --yystack.l_mark;
1107 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1108                 --yystack.p_mark;
1109 #endif
1110             }
1111         }
1112     }
1113     else
1114     {
1115         if (yychar == YYEOF) goto yyabort;
1116 #if YYDEBUG
1117         if (yydebug)
1118         {
1119             yys = yyname[YYTRANSLATE(yychar)];
1120             fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1121                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
1122         }
1123 #endif
1124 #if defined(YYDESTRUCT_CALL)
1125 #if YYBTYACC
1126         if (!yytrial)
1127 #endif /* YYBTYACC */
1128 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1129             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1130 #else
1131             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1132 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1133 #endif /* defined(YYDESTRUCT_CALL) */
1134         yychar = YYEMPTY;
1135         goto yyloop;
1136     }
1137 
1138 yyreduce:
1139     yym = yylen[yyn];
1140 #if YYDEBUG
1141     if (yydebug)
1142     {
1143         fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1144                         YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1145 #ifdef YYSTYPE_TOSTRING
1146 #if YYBTYACC
1147         if (!yytrial)
1148 #endif /* YYBTYACC */
1149             if (yym > 0)
1150             {
1151                 int i;
1152                 fputc('<', stderr);
1153                 for (i = yym; i > 0; i--)
1154                 {
1155                     if (i != yym) fputs(", ", stderr);
1156                     fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1157                                            yystack.l_mark[1-i]), stderr);
1158                 }
1159                 fputc('>', stderr);
1160             }
1161 #endif
1162         fputc('\n', stderr);
1163     }
1164 #endif
1165     if (yym > 0)
1166         yyval = yystack.l_mark[1-yym];
1167     else
1168         memset(&yyval, 0, sizeof yyval);
1169 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1170 
1171     /* Perform position reduction */
1172     memset(&yyloc, 0, sizeof(yyloc));
1173 #if YYBTYACC
1174     if (!yytrial)
1175 #endif /* YYBTYACC */
1176     {
1177         YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1178         /* just in case YYERROR is invoked within the action, save
1179            the start of the rhs as the error start position */
1180         yyerror_loc_range[0] = yystack.p_mark[1-yym];
1181     }
1182 #endif
1183 
1184     switch (yyn)
1185     {
1186 case 3:
1187 #line 35 "quote_calc2.y"
1188 	{  yyerrok ; }
1189 break;
1190 case 4:
1191 #line 39 "quote_calc2.y"
1192 	{  printf("%d\n",yystack.l_mark[0]);}
1193 break;
1194 case 5:
1195 #line 41 "quote_calc2.y"
1196 	{  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
1197 break;
1198 case 6:
1199 #line 45 "quote_calc2.y"
1200 	{  yyval = yystack.l_mark[-1]; }
1201 break;
1202 case 7:
1203 #line 47 "quote_calc2.y"
1204 	{  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
1205 break;
1206 case 8:
1207 #line 49 "quote_calc2.y"
1208 	{  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
1209 break;
1210 case 9:
1211 #line 51 "quote_calc2.y"
1212 	{  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
1213 break;
1214 case 10:
1215 #line 53 "quote_calc2.y"
1216 	{  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
1217 break;
1218 case 11:
1219 #line 55 "quote_calc2.y"
1220 	{  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
1221 break;
1222 case 12:
1223 #line 57 "quote_calc2.y"
1224 	{  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
1225 break;
1226 case 13:
1227 #line 59 "quote_calc2.y"
1228 	{  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
1229 break;
1230 case 14:
1231 #line 61 "quote_calc2.y"
1232 	{  yyval = - yystack.l_mark[0]; }
1233 break;
1234 case 15:
1235 #line 63 "quote_calc2.y"
1236 	{  yyval = regs[yystack.l_mark[0]]; }
1237 break;
1238 case 17:
1239 #line 68 "quote_calc2.y"
1240 	{  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
1241 break;
1242 case 18:
1243 #line 70 "quote_calc2.y"
1244 	{  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
1245 break;
1246 #line 1247 "quote_calc2.tab.c"
1247     default:
1248         break;
1249     }
1250     yystack.s_mark -= yym;
1251     yystate = *yystack.s_mark;
1252     yystack.l_mark -= yym;
1253 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1254     yystack.p_mark -= yym;
1255 #endif
1256     yym = yylhs[yyn];
1257     if (yystate == 0 && yym == 0)
1258     {
1259 #if YYDEBUG
1260         if (yydebug)
1261         {
1262             fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1263 #ifdef YYSTYPE_TOSTRING
1264 #if YYBTYACC
1265             if (!yytrial)
1266 #endif /* YYBTYACC */
1267                 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1268 #endif
1269             fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1270         }
1271 #endif
1272         yystate = YYFINAL;
1273         *++yystack.s_mark = YYFINAL;
1274         *++yystack.l_mark = yyval;
1275 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1276         *++yystack.p_mark = yyloc;
1277 #endif
1278         if (yychar < 0)
1279         {
1280 #if YYBTYACC
1281             do {
1282             if (yylvp < yylve)
1283             {
1284                 /* we're currently re-reading tokens */
1285                 yylval = *yylvp++;
1286 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1287                 yylloc = *yylpp++;
1288 #endif
1289                 yychar = *yylexp++;
1290                 break;
1291             }
1292             if (yyps->save)
1293             {
1294                 /* in trial mode; save scanner results for future parse attempts */
1295                 if (yylvp == yylvlim)
1296                 {   /* Enlarge lexical value queue */
1297                     size_t p = (size_t) (yylvp - yylvals);
1298                     size_t s = (size_t) (yylvlim - yylvals);
1299 
1300                     s += YYLVQUEUEGROWTH;
1301                     if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL)
1302                         goto yyenomem;
1303                     if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1304                         goto yyenomem;
1305 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1306                     if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1307                         goto yyenomem;
1308 #endif
1309                     yylvp   = yylve = yylvals + p;
1310                     yylvlim = yylvals + s;
1311 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1312                     yylpp   = yylpe = yylpsns + p;
1313                     yylplim = yylpsns + s;
1314 #endif
1315                     yylexp  = yylexemes + p;
1316                 }
1317                 *yylexp = (short) YYLEX;
1318                 *yylvp++ = yylval;
1319                 yylve++;
1320 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1321                 *yylpp++ = yylloc;
1322                 yylpe++;
1323 #endif
1324                 yychar = *yylexp++;
1325                 break;
1326             }
1327             /* normal operation, no conflict encountered */
1328 #endif /* YYBTYACC */
1329             yychar = YYLEX;
1330 #if YYBTYACC
1331             } while (0);
1332 #endif /* YYBTYACC */
1333             if (yychar < 0) yychar = YYEOF;
1334             /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
1335 #if YYDEBUG
1336             if (yydebug)
1337             {
1338                 yys = yyname[YYTRANSLATE(yychar)];
1339                 fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
1340                                 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1341             }
1342 #endif
1343         }
1344         if (yychar == YYEOF) goto yyaccept;
1345         goto yyloop;
1346     }
1347     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1348             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1349         yystate = yytable[yyn];
1350     else
1351         yystate = yydgoto[yym];
1352 #if YYDEBUG
1353     if (yydebug)
1354     {
1355         fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1356 #ifdef YYSTYPE_TOSTRING
1357 #if YYBTYACC
1358         if (!yytrial)
1359 #endif /* YYBTYACC */
1360             fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1361 #endif
1362         fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1363     }
1364 #endif
1365     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1366     *++yystack.s_mark = (short) yystate;
1367     *++yystack.l_mark = yyval;
1368 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1369     *++yystack.p_mark = yyloc;
1370 #endif
1371     goto yyloop;
1372 #if YYBTYACC
1373 
1374     /* Reduction declares that this path is valid. Set yypath and do a full parse */
1375 yyvalid:
1376     if (yypath) YYABORT;
1377     while (yyps->save)
1378     {
1379         YYParseState *save = yyps->save;
1380         yyps->save = save->save;
1381         save->save = yypath;
1382         yypath = save;
1383     }
1384 #if YYDEBUG
1385     if (yydebug)
1386         fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1387                         YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1388 #endif
1389     if (yyerrctx)
1390     {
1391         yyFreeState(yyerrctx);
1392         yyerrctx = NULL;
1393     }
1394     yylvp          = yylvals + yypath->lexeme;
1395 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1396     yylpp          = yylpsns + yypath->lexeme;
1397 #endif
1398     yylexp         = yylexemes + yypath->lexeme;
1399     yychar         = YYEMPTY;
1400     yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1401     memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
1402     yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1403     memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1404 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1405     yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1406     memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1407 #endif
1408     yystate        = yypath->state;
1409     goto yyloop;
1410 #endif /* YYBTYACC */
1411 
1412 yyoverflow:
1413     YYERROR_CALL("yacc stack overflow");
1414 #if YYBTYACC
1415     goto yyabort_nomem;
1416 yyenomem:
1417     YYERROR_CALL("memory exhausted");
1418 yyabort_nomem:
1419 #endif /* YYBTYACC */
1420     yyresult = 2;
1421     goto yyreturn;
1422 
1423 yyabort:
1424     yyresult = 1;
1425     goto yyreturn;
1426 
1427 yyaccept:
1428 #if YYBTYACC
1429     if (yyps->save) goto yyvalid;
1430 #endif /* YYBTYACC */
1431     yyresult = 0;
1432 
1433 yyreturn:
1434 #if defined(YYDESTRUCT_CALL)
1435     if (yychar != YYEOF && yychar != YYEMPTY)
1436 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1437         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1438 #else
1439         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1440 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1441 
1442     {
1443         YYSTYPE *pv;
1444 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1445         YYLTYPE *pp;
1446 
1447         for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1448              YYDESTRUCT_CALL("cleanup: discarding state",
1449                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1450 #else
1451         for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1452              YYDESTRUCT_CALL("cleanup: discarding state",
1453                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1454 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1455     }
1456 #endif /* defined(YYDESTRUCT_CALL) */
1457 
1458 #if YYBTYACC
1459     if (yyerrctx)
1460     {
1461         yyFreeState(yyerrctx);
1462         yyerrctx = NULL;
1463     }
1464     while (yyps)
1465     {
1466         YYParseState *save = yyps;
1467         yyps = save->save;
1468         save->save = NULL;
1469         yyFreeState(save);
1470     }
1471     while (yypath)
1472     {
1473         YYParseState *save = yypath;
1474         yypath = save->save;
1475         save->save = NULL;
1476         yyFreeState(save);
1477     }
1478 #endif /* YYBTYACC */
1479     yyfreestack(&yystack);
1480     return (yyresult);
1481 }
1482