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