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