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