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