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