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