]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/btyacc/quote_calc4-s.tab.c
Import byacc 20160606.
[FreeBSD/FreeBSD.git] / test / btyacc / quote_calc4-s.tab.c
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_calc4_parse
22 #endif /* yyparse */
23
24 #ifndef yylex
25 #define yylex      quote_calc4_lex
26 #endif /* yylex */
27
28 #ifndef yyerror
29 #define yyerror    quote_calc4_error
30 #endif /* yyerror */
31
32 #ifndef yychar
33 #define yychar     quote_calc4_char
34 #endif /* yychar */
35
36 #ifndef yyval
37 #define yyval      quote_calc4_val
38 #endif /* yyval */
39
40 #ifndef yylval
41 #define yylval     quote_calc4_lval
42 #endif /* yylval */
43
44 #ifndef yydebug
45 #define yydebug    quote_calc4_debug
46 #endif /* yydebug */
47
48 #ifndef yynerrs
49 #define yynerrs    quote_calc4_nerrs
50 #endif /* yynerrs */
51
52 #ifndef yyerrflag
53 #define yyerrflag  quote_calc4_errflag
54 #endif /* yyerrflag */
55
56 #ifndef yylhs
57 #define yylhs      quote_calc4_lhs
58 #endif /* yylhs */
59
60 #ifndef yylen
61 #define yylen      quote_calc4_len
62 #endif /* yylen */
63
64 #ifndef yydefred
65 #define yydefred   quote_calc4_defred
66 #endif /* yydefred */
67
68 #ifndef yystos
69 #define yystos     quote_calc4_stos
70 #endif /* yystos */
71
72 #ifndef yydgoto
73 #define yydgoto    quote_calc4_dgoto
74 #endif /* yydgoto */
75
76 #ifndef yysindex
77 #define yysindex   quote_calc4_sindex
78 #endif /* yysindex */
79
80 #ifndef yyrindex
81 #define yyrindex   quote_calc4_rindex
82 #endif /* yyrindex */
83
84 #ifndef yygindex
85 #define yygindex   quote_calc4_gindex
86 #endif /* yygindex */
87
88 #ifndef yytable
89 #define yytable    quote_calc4_table
90 #endif /* yytable */
91
92 #ifndef yycheck
93 #define yycheck    quote_calc4_check
94 #endif /* yycheck */
95
96 #ifndef yyname
97 #define yyname     quote_calc4_name
98 #endif /* yyname */
99
100 #ifndef yyrule
101 #define yyrule     quote_calc4_rule
102 #endif /* yyrule */
103
104 #if YYBTYACC
105
106 #ifndef yycindex
107 #define yycindex   quote_calc4_cindex
108 #endif /* yycindex */
109
110 #ifndef yyctable
111 #define yyctable   quote_calc4_ctable
112 #endif /* yyctable */
113
114 #endif /* YYBTYACC */
115
116 #define YYPREFIX "quote_calc4_"
117
118 #define YYPURE 0
119
120 #line 2 "quote_calc4.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_calc4-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_calc4_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_calc4_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_calc4_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_calc4_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_calc4_dgoto[] = {                1,
201     7,    8,    9,
202 };
203 static const YYINT quote_calc4_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_calc4_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_calc4_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_calc4_gindex[] = {               0,
224     0,   42,    0,
225 };
226 #define YYTABLESIZE 259
227 static const YYINT quote_calc4_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_calc4_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_calc4_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_calc4_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-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
331 "\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
332 "OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","$accept","list","stat",
333 "expr","number","illegal-symbol",
334 };
335 static const char *const quote_calc4_rule[] = {
336 "$accept : list",
337 "list :",
338 "list : list stat '\\n'",
339 "list : list error '\\n'",
340 "stat : expr",
341 "stat : LETTER '=' expr",
342 "expr : '(' expr ')'",
343 "expr : expr \"ADD-operator\" expr",
344 "expr : expr \"SUB-operator\" expr",
345 "expr : expr \"MUL-operator\" expr",
346 "expr : expr \"DIV-operator\" expr",
347 "expr : expr \"MOD-operator\" expr",
348 "expr : expr \"AND-operator\" expr",
349 "expr : expr '|' expr",
350 "expr : \"SUB-operator\" expr",
351 "expr : LETTER",
352 "expr : number",
353 "number : DIGIT",
354 "number : number DIGIT",
355
356 };
357 #endif
358
359 int      yydebug;
360 int      yynerrs;
361
362 int      yyerrflag;
363 int      yychar;
364 YYSTYPE  yyval;
365 YYSTYPE  yylval;
366 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
367 YYLTYPE  yyloc; /* position returned by actions */
368 YYLTYPE  yylloc; /* position from the lexer */
369 #endif
370
371 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
372 #ifndef YYLLOC_DEFAULT
373 #define YYLLOC_DEFAULT(loc, rhs, n) \
374 do \
375 { \
376     if (n == 0) \
377     { \
378         (loc).first_line   = ((rhs)[-1]).last_line; \
379         (loc).first_column = ((rhs)[-1]).last_column; \
380         (loc).last_line    = ((rhs)[-1]).last_line; \
381         (loc).last_column  = ((rhs)[-1]).last_column; \
382     } \
383     else \
384     { \
385         (loc).first_line   = ((rhs)[ 0 ]).first_line; \
386         (loc).first_column = ((rhs)[ 0 ]).first_column; \
387         (loc).last_line    = ((rhs)[n-1]).last_line; \
388         (loc).last_column  = ((rhs)[n-1]).last_column; \
389     } \
390 } while (0)
391 #endif /* YYLLOC_DEFAULT */
392 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
393 #if YYBTYACC
394
395 #ifndef YYLVQUEUEGROWTH
396 #define YYLVQUEUEGROWTH 32
397 #endif
398 #endif /* YYBTYACC */
399
400 /* define the initial stack-sizes */
401 #ifdef YYSTACKSIZE
402 #undef YYMAXDEPTH
403 #define YYMAXDEPTH  YYSTACKSIZE
404 #else
405 #ifdef YYMAXDEPTH
406 #define YYSTACKSIZE YYMAXDEPTH
407 #else
408 #define YYSTACKSIZE 10000
409 #define YYMAXDEPTH  10000
410 #endif
411 #endif
412
413 #ifndef YYINITSTACKSIZE
414 #define YYINITSTACKSIZE 200
415 #endif
416
417 typedef struct {
418     unsigned stacksize;
419     YYINT    *s_base;
420     YYINT    *s_mark;
421     YYINT    *s_last;
422     YYSTYPE  *l_base;
423     YYSTYPE  *l_mark;
424 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
425     YYLTYPE  *p_base;
426     YYLTYPE  *p_mark;
427 #endif
428 } YYSTACKDATA;
429 #if YYBTYACC
430
431 struct YYParseState_s
432 {
433     struct YYParseState_s *save;    /* Previously saved parser state */
434     YYSTACKDATA            yystack; /* saved parser stack */
435     int                    state;   /* saved parser state */
436     int                    errflag; /* saved error recovery status */
437     int                    lexeme;  /* saved index of the conflict lexeme in the lexical queue */
438     YYINT                  ctry;    /* saved index in yyctable[] for this conflict */
439 };
440 typedef struct YYParseState_s YYParseState;
441 #endif /* YYBTYACC */
442 /* variables for the parser stack */
443 static YYSTACKDATA yystack;
444 #if YYBTYACC
445
446 /* Current parser state */
447 static YYParseState *yyps = 0;
448
449 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
450 static YYParseState *yypath = 0;
451
452 /* Base of the lexical value queue */
453 static YYSTYPE *yylvals = 0;
454
455 /* Current position at lexical value queue */
456 static YYSTYPE *yylvp = 0;
457
458 /* End position of lexical value queue */
459 static YYSTYPE *yylve = 0;
460
461 /* The last allocated position at the lexical value queue */
462 static YYSTYPE *yylvlim = 0;
463
464 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
465 /* Base of the lexical position queue */
466 static YYLTYPE *yylpsns = 0;
467
468 /* Current position at lexical position queue */
469 static YYLTYPE *yylpp = 0;
470
471 /* End position of lexical position queue */
472 static YYLTYPE *yylpe = 0;
473
474 /* The last allocated position at the lexical position queue */
475 static YYLTYPE *yylplim = 0;
476 #endif
477
478 /* Current position at lexical token queue */
479 static short  *yylexp = 0;
480
481 static short  *yylexemes = 0;
482 #endif /* YYBTYACC */
483 #line 73 "quote_calc4.y"
484  /* start of programs */
485
486 int
487 main (void)
488 {
489     while(!feof(stdin)) {
490         yyparse();
491     }
492     return 0;
493 }
494
495 static void
496 yyerror(const char *s)
497 {
498     fprintf(stderr, "%s\n", s);
499 }
500
501 int
502 yylex(void) {
503         /* lexical analysis routine */
504         /* returns LETTER for a lower case letter, yylval = 0 through 25 */
505         /* return DIGIT for a digit, yylval = 0 through 9 */
506         /* all other characters are returned immediately */
507
508     int c;
509
510     while( (c=getchar()) == ' ' )   { /* skip blanks */ }
511
512     /* c is now nonblank */
513
514     if( islower( c )) {
515         yylval = c - 'a';
516         return ( LETTER );
517     }
518     if( isdigit( c )) {
519         yylval = c - '0';
520         return ( DIGIT );
521     }
522     return( c );
523 }
524 #line 525 "quote_calc4-s.tab.c"
525
526 /* For use in generated program */
527 #define yydepth (int)(yystack.s_mark - yystack.s_base)
528 #if YYBTYACC
529 #define yytrial (yyps->save)
530 #endif /* YYBTYACC */
531
532 #if YYDEBUG
533 #include <stdio.h>      /* needed for printf */
534 #endif
535
536 #include <stdlib.h>     /* needed for malloc, etc */
537 #include <string.h>     /* needed for memset */
538
539 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
540 static int yygrowstack(YYSTACKDATA *data)
541 {
542     int i;
543     unsigned newsize;
544     YYINT *newss;
545     YYSTYPE *newvs;
546 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
547     YYLTYPE *newps;
548 #endif
549
550     if ((newsize = data->stacksize) == 0)
551         newsize = YYINITSTACKSIZE;
552     else if (newsize >= YYMAXDEPTH)
553         return YYENOMEM;
554     else if ((newsize *= 2) > YYMAXDEPTH)
555         newsize = YYMAXDEPTH;
556
557     i = (int) (data->s_mark - data->s_base);
558     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
559     if (newss == 0)
560         return YYENOMEM;
561
562     data->s_base = newss;
563     data->s_mark = newss + i;
564
565     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
566     if (newvs == 0)
567         return YYENOMEM;
568
569     data->l_base = newvs;
570     data->l_mark = newvs + i;
571
572 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
573     newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
574     if (newps == 0)
575         return YYENOMEM;
576
577     data->p_base = newps;
578     data->p_mark = newps + i;
579 #endif
580
581     data->stacksize = newsize;
582     data->s_last = data->s_base + newsize - 1;
583
584 #if YYDEBUG
585     if (yydebug)
586         fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
587 #endif
588     return 0;
589 }
590
591 #if YYPURE || defined(YY_NO_LEAKS)
592 static void yyfreestack(YYSTACKDATA *data)
593 {
594     free(data->s_base);
595     free(data->l_base);
596 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
597     free(data->p_base);
598 #endif
599     memset(data, 0, sizeof(*data));
600 }
601 #else
602 #define yyfreestack(data) /* nothing */
603 #endif /* YYPURE || defined(YY_NO_LEAKS) */
604 #if YYBTYACC
605
606 static YYParseState *
607 yyNewState(unsigned size)
608 {
609     YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
610     if (p == NULL) return NULL;
611
612     p->yystack.stacksize = size;
613     if (size == 0)
614     {
615         p->yystack.s_base = NULL;
616         p->yystack.l_base = NULL;
617 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
618         p->yystack.p_base = NULL;
619 #endif
620         return p;
621     }
622     p->yystack.s_base    = (YYINT *) malloc(size * sizeof(YYINT));
623     if (p->yystack.s_base == NULL) return NULL;
624     p->yystack.l_base    = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
625     if (p->yystack.l_base == NULL) return NULL;
626     memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
627 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
628     p->yystack.p_base    = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
629     if (p->yystack.p_base == NULL) return NULL;
630     memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
631 #endif
632
633     return p;
634 }
635
636 static void
637 yyFreeState(YYParseState *p)
638 {
639     yyfreestack(&p->yystack);
640     free(p);
641 }
642 #endif /* YYBTYACC */
643
644 #define YYABORT  goto yyabort
645 #define YYREJECT goto yyabort
646 #define YYACCEPT goto yyaccept
647 #define YYERROR  goto yyerrlab
648 #if YYBTYACC
649 #define YYVALID        do { if (yyps->save)            goto yyvalid; } while(0)
650 #define YYVALID_NESTED do { if (yyps->save && \
651                                 yyps->save->save == 0) goto yyvalid; } while(0)
652 #endif /* YYBTYACC */
653
654 int
655 YYPARSE_DECL()
656 {
657     int yym, yyn, yystate, yyresult;
658 #if YYBTYACC
659     int yynewerrflag;
660     YYParseState *yyerrctx = NULL;
661 #endif /* YYBTYACC */
662 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
663     YYLTYPE  yyerror_loc_range[2]; /* position of error start & end */
664 #endif
665 #if YYDEBUG
666     const char *yys;
667
668     if ((yys = getenv("YYDEBUG")) != 0)
669     {
670         yyn = *yys;
671         if (yyn >= '0' && yyn <= '9')
672             yydebug = yyn - '0';
673     }
674     if (yydebug)
675         fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
676 #endif
677
678 #if YYBTYACC
679     yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
680     yyps->save = 0;
681 #endif /* YYBTYACC */
682     yym = 0;
683     yyn = 0;
684     yynerrs = 0;
685     yyerrflag = 0;
686     yychar = YYEMPTY;
687     yystate = 0;
688
689 #if YYPURE
690     memset(&yystack, 0, sizeof(yystack));
691 #endif
692
693     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
694     yystack.s_mark = yystack.s_base;
695     yystack.l_mark = yystack.l_base;
696 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
697     yystack.p_mark = yystack.p_base;
698 #endif
699     yystate = 0;
700     *yystack.s_mark = 0;
701
702 yyloop:
703     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
704     if (yychar < 0)
705     {
706 #if YYBTYACC
707         do {
708         if (yylvp < yylve)
709         {
710             /* we're currently re-reading tokens */
711             yylval = *yylvp++;
712 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
713             yylloc = *yylpp++;
714 #endif
715             yychar = *yylexp++;
716             break;
717         }
718         if (yyps->save)
719         {
720             /* in trial mode; save scanner results for future parse attempts */
721             if (yylvp == yylvlim)
722             {   /* Enlarge lexical value queue */
723                 size_t p = (size_t) (yylvp - yylvals);
724                 size_t s = (size_t) (yylvlim - yylvals);
725
726                 s += YYLVQUEUEGROWTH;
727                 if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
728                 if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
729 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
730                 if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
731 #endif
732                 yylvp   = yylve = yylvals + p;
733                 yylvlim = yylvals + s;
734 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
735                 yylpp   = yylpe = yylpsns + p;
736                 yylplim = yylpsns + s;
737 #endif
738                 yylexp  = yylexemes + p;
739             }
740             *yylexp = (short) YYLEX;
741             *yylvp++ = yylval;
742             yylve++;
743 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
744             *yylpp++ = yylloc;
745             yylpe++;
746 #endif
747             yychar = *yylexp++;
748             break;
749         }
750         /* normal operation, no conflict encountered */
751 #endif /* YYBTYACC */
752         yychar = YYLEX;
753 #if YYBTYACC
754         } while (0);
755 #endif /* YYBTYACC */
756         if (yychar < 0) yychar = YYEOF;
757 #if YYDEBUG
758         if (yydebug)
759         {
760             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
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(YYINT));
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 = (YYINT) 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; /* redundant goto avoids 'unused label' warning */
947
948 yyerrlab:
949     /* explicit YYERROR from an action -- pop the rhs of the rule reduced
950      * before looking for error recovery */
951     yystack.s_mark -= yym;
952     yystate = *yystack.s_mark;
953     yystack.l_mark -= yym;
954 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
955     yystack.p_mark -= yym;
956 #endif
957
958     yynewerrflag = 0;
959 yyerrhandler:
960     while (yyps->save)
961     {
962         int ctry;
963         YYParseState *save = yyps->save;
964 #if YYDEBUG
965         if (yydebug)
966             fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
967                             YYDEBUGSTR, yydepth, yystate, yyps->save->state,
968                     (int)(yylvp - yylvals - yyps->save->lexeme));
969 #endif
970         /* Memorize most forward-looking error state in case it's really an error. */
971         if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
972         {
973             /* Free old saved error context state */
974             if (yyerrctx) yyFreeState(yyerrctx);
975             /* Create and fill out new saved error context state */
976             yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
977             if (yyerrctx == NULL) goto yyenomem;
978             yyerrctx->save           = yyps->save;
979             yyerrctx->state          = yystate;
980             yyerrctx->errflag        = yyerrflag;
981             yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
982             memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
983             yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
984             memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
985 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
986             yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
987             memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
988 #endif
989             yyerrctx->lexeme         = (int) (yylvp - yylvals);
990         }
991         yylvp          = yylvals   + save->lexeme;
992 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
993         yylpp          = yylpsns   + save->lexeme;
994 #endif
995         yylexp         = yylexemes + save->lexeme;
996         yychar         = YYEMPTY;
997         yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
998         memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
999         yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1000         memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1001 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1002         yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1003         memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1004 #endif
1005         ctry           = ++save->ctry;
1006         yystate        = save->state;
1007         /* We tried shift, try reduce now */
1008         if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1009         yyps->save     = save->save;
1010         save->save     = NULL;
1011         yyFreeState(save);
1012
1013         /* Nothing left on the stack -- error */
1014         if (!yyps->save)
1015         {
1016 #if YYDEBUG
1017             if (yydebug)
1018                 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1019                                 YYPREFIX, yydepth);
1020 #endif
1021             /* Restore state as it was in the most forward-advanced error */
1022             yylvp          = yylvals   + yyerrctx->lexeme;
1023 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1024             yylpp          = yylpsns   + yyerrctx->lexeme;
1025 #endif
1026             yylexp         = yylexemes + yyerrctx->lexeme;
1027             yychar         = yylexp[-1];
1028             yylval         = yylvp[-1];
1029 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1030             yylloc         = yylpp[-1];
1031 #endif
1032             yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1033             memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1034             yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1035             memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1036 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1037             yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1038             memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1039 #endif
1040             yystate        = yyerrctx->state;
1041             yyFreeState(yyerrctx);
1042             yyerrctx       = NULL;
1043         }
1044         yynewerrflag = 1;
1045     }
1046     if (yynewerrflag == 0) goto yyinrecovery;
1047 #endif /* YYBTYACC */
1048
1049     YYERROR_CALL("syntax error");
1050 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1051     yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1052 #endif
1053
1054 #if !YYBTYACC
1055     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1056 yyerrlab:
1057 #endif
1058     ++yynerrs;
1059
1060 yyinrecovery:
1061     if (yyerrflag < 3)
1062     {
1063         yyerrflag = 3;
1064         for (;;)
1065         {
1066             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1067                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1068             {
1069 #if YYDEBUG
1070                 if (yydebug)
1071                     fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1072                                     YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1073 #endif
1074                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1075                 yystate = yytable[yyn];
1076                 *++yystack.s_mark = yytable[yyn];
1077                 *++yystack.l_mark = yylval;
1078 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1079                 /* lookahead position is error end position */
1080                 yyerror_loc_range[1] = yylloc;
1081                 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1082                 *++yystack.p_mark = yyloc;
1083 #endif
1084                 goto yyloop;
1085             }
1086             else
1087             {
1088 #if YYDEBUG
1089                 if (yydebug)
1090                     fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1091                                     YYDEBUGSTR, yydepth, *yystack.s_mark);
1092 #endif
1093                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1094 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1095                 /* the current TOS position is the error start position */
1096                 yyerror_loc_range[0] = *yystack.p_mark;
1097 #endif
1098 #if defined(YYDESTRUCT_CALL)
1099 #if YYBTYACC
1100                 if (!yytrial)
1101 #endif /* YYBTYACC */
1102 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1103                     YYDESTRUCT_CALL("error: discarding state",
1104                                     yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1105 #else
1106                     YYDESTRUCT_CALL("error: discarding state",
1107                                     yystos[*yystack.s_mark], yystack.l_mark);
1108 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1109 #endif /* defined(YYDESTRUCT_CALL) */
1110                 --yystack.s_mark;
1111                 --yystack.l_mark;
1112 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1113                 --yystack.p_mark;
1114 #endif
1115             }
1116         }
1117     }
1118     else
1119     {
1120         if (yychar == YYEOF) goto yyabort;
1121 #if YYDEBUG
1122         if (yydebug)
1123         {
1124             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1125             fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1126                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
1127         }
1128 #endif
1129 #if defined(YYDESTRUCT_CALL)
1130 #if YYBTYACC
1131         if (!yytrial)
1132 #endif /* YYBTYACC */
1133 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1134             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1135 #else
1136             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1137 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1138 #endif /* defined(YYDESTRUCT_CALL) */
1139         yychar = YYEMPTY;
1140         goto yyloop;
1141     }
1142
1143 yyreduce:
1144     yym = yylen[yyn];
1145 #if YYDEBUG
1146     if (yydebug)
1147     {
1148         fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1149                         YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1150 #ifdef YYSTYPE_TOSTRING
1151 #if YYBTYACC
1152         if (!yytrial)
1153 #endif /* YYBTYACC */
1154             if (yym > 0)
1155             {
1156                 int i;
1157                 fputc('<', stderr);
1158                 for (i = yym; i > 0; i--)
1159                 {
1160                     if (i != yym) fputs(", ", stderr);
1161                     fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1162                                            yystack.l_mark[1-i]), stderr);
1163                 }
1164                 fputc('>', stderr);
1165             }
1166 #endif
1167         fputc('\n', stderr);
1168     }
1169 #endif
1170     if (yym > 0)
1171         yyval = yystack.l_mark[1-yym];
1172     else
1173         memset(&yyval, 0, sizeof yyval);
1174 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1175
1176     /* Perform position reduction */
1177     memset(&yyloc, 0, sizeof(yyloc));
1178 #if YYBTYACC
1179     if (!yytrial)
1180 #endif /* YYBTYACC */
1181     {
1182         YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
1183         /* just in case YYERROR is invoked within the action, save
1184            the start of the rhs as the error start position */
1185         yyerror_loc_range[0] = yystack.p_mark[1-yym];
1186     }
1187 #endif
1188
1189     switch (yyn)
1190     {
1191 case 3:
1192 #line 35 "quote_calc4.y"
1193         {  yyerrok ; }
1194 break;
1195 case 4:
1196 #line 39 "quote_calc4.y"
1197         {  printf("%d\n",yystack.l_mark[0]);}
1198 break;
1199 case 5:
1200 #line 41 "quote_calc4.y"
1201         {  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
1202 break;
1203 case 6:
1204 #line 45 "quote_calc4.y"
1205         {  yyval = yystack.l_mark[-1]; }
1206 break;
1207 case 7:
1208 #line 47 "quote_calc4.y"
1209         {  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
1210 break;
1211 case 8:
1212 #line 49 "quote_calc4.y"
1213         {  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
1214 break;
1215 case 9:
1216 #line 51 "quote_calc4.y"
1217         {  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
1218 break;
1219 case 10:
1220 #line 53 "quote_calc4.y"
1221         {  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
1222 break;
1223 case 11:
1224 #line 55 "quote_calc4.y"
1225         {  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
1226 break;
1227 case 12:
1228 #line 57 "quote_calc4.y"
1229         {  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
1230 break;
1231 case 13:
1232 #line 59 "quote_calc4.y"
1233         {  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
1234 break;
1235 case 14:
1236 #line 61 "quote_calc4.y"
1237         {  yyval = - yystack.l_mark[0]; }
1238 break;
1239 case 15:
1240 #line 63 "quote_calc4.y"
1241         {  yyval = regs[yystack.l_mark[0]]; }
1242 break;
1243 case 17:
1244 #line 68 "quote_calc4.y"
1245         {  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
1246 break;
1247 case 18:
1248 #line 70 "quote_calc4.y"
1249         {  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
1250 break;
1251 #line 1252 "quote_calc4-s.tab.c"
1252     default:
1253         break;
1254     }
1255     yystack.s_mark -= yym;
1256     yystate = *yystack.s_mark;
1257     yystack.l_mark -= yym;
1258 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1259     yystack.p_mark -= yym;
1260 #endif
1261     yym = yylhs[yyn];
1262     if (yystate == 0 && yym == 0)
1263     {
1264 #if YYDEBUG
1265         if (yydebug)
1266         {
1267             fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1268 #ifdef YYSTYPE_TOSTRING
1269 #if YYBTYACC
1270             if (!yytrial)
1271 #endif /* YYBTYACC */
1272                 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1273 #endif
1274             fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1275         }
1276 #endif
1277         yystate = YYFINAL;
1278         *++yystack.s_mark = YYFINAL;
1279         *++yystack.l_mark = yyval;
1280 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1281         *++yystack.p_mark = yyloc;
1282 #endif
1283         if (yychar < 0)
1284         {
1285 #if YYBTYACC
1286             do {
1287             if (yylvp < yylve)
1288             {
1289                 /* we're currently re-reading tokens */
1290                 yylval = *yylvp++;
1291 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1292                 yylloc = *yylpp++;
1293 #endif
1294                 yychar = *yylexp++;
1295                 break;
1296             }
1297             if (yyps->save)
1298             {
1299                 /* in trial mode; save scanner results for future parse attempts */
1300                 if (yylvp == yylvlim)
1301                 {   /* Enlarge lexical value queue */
1302                     size_t p = (size_t) (yylvp - yylvals);
1303                     size_t s = (size_t) (yylvlim - yylvals);
1304
1305                     s += YYLVQUEUEGROWTH;
1306                     if ((yylexemes = (short *)   realloc(yylexemes, s * sizeof(short))) == NULL)
1307                         goto yyenomem;
1308                     if ((yylvals   = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1309                         goto yyenomem;
1310 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1311                     if ((yylpsns   = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1312                         goto yyenomem;
1313 #endif
1314                     yylvp   = yylve = yylvals + p;
1315                     yylvlim = yylvals + s;
1316 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1317                     yylpp   = yylpe = yylpsns + p;
1318                     yylplim = yylpsns + s;
1319 #endif
1320                     yylexp  = yylexemes + p;
1321                 }
1322                 *yylexp = (short) YYLEX;
1323                 *yylvp++ = yylval;
1324                 yylve++;
1325 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1326                 *yylpp++ = yylloc;
1327                 yylpe++;
1328 #endif
1329                 yychar = *yylexp++;
1330                 break;
1331             }
1332             /* normal operation, no conflict encountered */
1333 #endif /* YYBTYACC */
1334             yychar = YYLEX;
1335 #if YYBTYACC
1336             } while (0);
1337 #endif /* YYBTYACC */
1338             if (yychar < 0) yychar = YYEOF;
1339 #if YYDEBUG
1340             if (yydebug)
1341             {
1342                 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1343                 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1344                                 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1345             }
1346 #endif
1347         }
1348         if (yychar == YYEOF) goto yyaccept;
1349         goto yyloop;
1350     }
1351     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1352             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1353         yystate = yytable[yyn];
1354     else
1355         yystate = yydgoto[yym];
1356 #if YYDEBUG
1357     if (yydebug)
1358     {
1359         fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1360 #ifdef YYSTYPE_TOSTRING
1361 #if YYBTYACC
1362         if (!yytrial)
1363 #endif /* YYBTYACC */
1364             fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1365 #endif
1366         fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1367     }
1368 #endif
1369     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1370     *++yystack.s_mark = (YYINT) yystate;
1371     *++yystack.l_mark = yyval;
1372 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1373     *++yystack.p_mark = yyloc;
1374 #endif
1375     goto yyloop;
1376 #if YYBTYACC
1377
1378     /* Reduction declares that this path is valid. Set yypath and do a full parse */
1379 yyvalid:
1380     if (yypath) YYABORT;
1381     while (yyps->save)
1382     {
1383         YYParseState *save = yyps->save;
1384         yyps->save = save->save;
1385         save->save = yypath;
1386         yypath = save;
1387     }
1388 #if YYDEBUG
1389     if (yydebug)
1390         fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1391                         YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1392 #endif
1393     if (yyerrctx)
1394     {
1395         yyFreeState(yyerrctx);
1396         yyerrctx = NULL;
1397     }
1398     yylvp          = yylvals + yypath->lexeme;
1399 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1400     yylpp          = yylpsns + yypath->lexeme;
1401 #endif
1402     yylexp         = yylexemes + yypath->lexeme;
1403     yychar         = YYEMPTY;
1404     yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1405     memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1406     yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1407     memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1408 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1409     yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1410     memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1411 #endif
1412     yystate        = yypath->state;
1413     goto yyloop;
1414 #endif /* YYBTYACC */
1415
1416 yyoverflow:
1417     YYERROR_CALL("yacc stack overflow");
1418 #if YYBTYACC
1419     goto yyabort_nomem;
1420 yyenomem:
1421     YYERROR_CALL("memory exhausted");
1422 yyabort_nomem:
1423 #endif /* YYBTYACC */
1424     yyresult = 2;
1425     goto yyreturn;
1426
1427 yyabort:
1428     yyresult = 1;
1429     goto yyreturn;
1430
1431 yyaccept:
1432 #if YYBTYACC
1433     if (yyps->save) goto yyvalid;
1434 #endif /* YYBTYACC */
1435     yyresult = 0;
1436
1437 yyreturn:
1438 #if defined(YYDESTRUCT_CALL)
1439     if (yychar != YYEOF && yychar != YYEMPTY)
1440 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1441         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1442 #else
1443         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1444 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1445
1446     {
1447         YYSTYPE *pv;
1448 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1449         YYLTYPE *pp;
1450
1451         for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1452              YYDESTRUCT_CALL("cleanup: discarding state",
1453                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1454 #else
1455         for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1456              YYDESTRUCT_CALL("cleanup: discarding state",
1457                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1458 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1459     }
1460 #endif /* defined(YYDESTRUCT_CALL) */
1461
1462 #if YYBTYACC
1463     if (yyerrctx)
1464     {
1465         yyFreeState(yyerrctx);
1466         yyerrctx = NULL;
1467     }
1468     while (yyps)
1469     {
1470         YYParseState *save = yyps;
1471         yyps = save->save;
1472         save->save = NULL;
1473         yyFreeState(save);
1474     }
1475     while (yypath)
1476     {
1477         YYParseState *save = yypath;
1478         yypath = save->save;
1479         save->save = NULL;
1480         yyFreeState(save);
1481     }
1482 #endif /* YYBTYACC */
1483     yyfreestack(&yystack);
1484     return (yyresult);
1485 }