ldivmod, uldivmod: fix qdivrem calls
[minix.git] / tools / m4 / bootstrap / parser.c
blobe6890a76e06201c74ec76756174acabd062dc3a3
1 #if HAVE_NBTOOL_CONFIG_H
2 #include "nbtool_config.h"
3 #endif
4 #include <stdlib.h>
5 #ifndef lint
6 #if 0
7 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
8 #else
9 #if defined(__NetBSD__) && defined(__IDSTRING)
10 __IDSTRING(yyrcsid, "NetBSD: skeleton.c,v 1.29 2008/07/18 14:25:37 drochner Exp ");
11 #endif /* __NetBSD__ && __IDSTRING */
12 #endif /* 0 */
13 #endif /* lint */
14 #define YYBYACC 1
15 #define YYMAJOR 1
16 #define YYMINOR 9
17 #define YYLEX yylex()
18 #define YYEMPTY -1
19 #define yyclearin (yychar=(YYEMPTY))
20 #define yyerrok (yyerrflag=0)
21 #define YYRECOVERING (yyerrflag!=0)
22 #define YYPREFIX "yy"
23 #line 2 "../../../usr.bin/m4/parser.y"
24 /* NetBSD: parser.y,v 1.2 2009/10/26 21:11:28 christos Exp */
25 /* $OpenBSD: parser.y,v 1.6 2008/08/21 21:00:14 espie Exp $ */
27 * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
29 * Permission to use, copy, modify, and distribute this software for any
30 * purpose with or without fee is hereby granted, provided that the above
31 * copyright notice and this permission notice appear in all copies.
33 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
34 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
35 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
36 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
37 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
38 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
39 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41 #if HAVE_NBTOOL_CONFIG_H
42 #include "nbtool_config.h"
43 #endif
44 __RCSID("NetBSD: parser.y,v 1.2 2009/10/26 21:11:28 christos Exp ");
45 #include <stdint.h>
46 #define YYSTYPE int32_t
47 extern int32_t end_result;
48 extern int yylex(void);
49 extern int yyerror(const char *);
50 #line 48 "parser.c"
51 #define NUMBER 257
52 #define ERROR 258
53 #define LOR 259
54 #define LAND 260
55 #define EQ 261
56 #define NE 262
57 #define LE 263
58 #define GE 264
59 #define LSHIFT 265
60 #define RSHIFT 266
61 #define UMINUS 267
62 #define UPLUS 268
63 #define YYERRCODE 256
64 const short yylhs[] = { -1,
65 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
66 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
67 1, 1, 1, 1, 1,
69 const short yylen[] = { 2,
70 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
71 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
72 2, 2, 2, 2, 1,
74 const short yydefred[] = { 0,
75 25, 0, 0, 0, 0, 0, 0, 0, 22, 21,
76 23, 24, 0, 0, 0, 0, 0, 0, 0, 0,
77 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
78 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
79 0, 0, 0, 0, 0, 0, 0, 4, 5, 6,
81 const short yydgoto[] = { 7,
84 const short yysindex[] = { -13,
85 0, -13, -13, -13, -13, -13, 0, 190, 0, 0,
86 0, 0, 114, -13, -13, -13, -13, -13, -13, -13,
87 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
88 -13, 0, 321, 347, 159, 397, 354, -24, -24, -35,
89 -35, -35, -35, 136, 136, -31, -31, 0, 0, 0,
91 const short yyrindex[] = { 0,
92 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
93 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
94 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
95 0, 0, 65, 56, 51, 48, 74, 60, 66, 34,
96 40, 76, 83, 17, 26, 1, 9, 0, 0, 0,
98 const short yygindex[] = { 0,
99 458,
101 #define YYTABLESIZE 663
102 const short yytable[] = { 0,
103 2, 31, 1, 0, 0, 31, 29, 27, 3, 28,
104 29, 30, 31, 0, 0, 30, 7, 29, 27, 4,
105 28, 0, 30, 0, 0, 8, 6, 0, 0, 2,
106 0, 3, 0, 9, 0, 21, 0, 23, 2, 11,
107 0, 2, 0, 2, 0, 2, 3, 16, 0, 3,
108 17, 3, 0, 3, 7, 18, 0, 7, 0, 13,
109 2, 0, 2, 8, 19, 14, 8, 0, 3, 0,
110 3, 9, 0, 15, 9, 10, 7, 11, 7, 0,
111 11, 0, 12, 0, 0, 8, 0, 8, 16, 0,
112 0, 17, 0, 9, 2, 9, 18, 13, 0, 11,
113 13, 11, 3, 14, 0, 19, 14, 0, 0, 0,
114 7, 15, 5, 10, 15, 0, 10, 0, 0, 8,
115 12, 0, 0, 12, 2, 0, 0, 9, 0, 0,
116 0, 0, 3, 11, 0, 10, 0, 10, 0, 0,
117 7, 16, 12, 0, 12, 0, 0, 0, 0, 8,
118 31, 18, 0, 13, 32, 29, 27, 9, 28, 14,
119 30, 0, 0, 11, 0, 0, 0, 15, 0, 10,
120 0, 16, 31, 21, 17, 23, 12, 29, 27, 0,
121 28, 0, 30, 13, 0, 0, 0, 0, 0, 14,
122 0, 0, 0, 0, 0, 31, 18, 15, 0, 10,
123 29, 27, 0, 28, 0, 30, 12, 17, 0, 0,
124 0, 0, 0, 0, 0, 0, 0, 0, 21, 0,
125 23, 0, 0, 0, 0, 0, 31, 18, 0, 25,
126 26, 29, 27, 0, 28, 0, 30, 16, 22, 24,
127 25, 26, 0, 1, 0, 0, 0, 0, 0, 21,
128 0, 23, 17, 0, 0, 0, 0, 0, 0, 2,
129 2, 2, 2, 2, 2, 2, 2, 3, 3, 3,
130 3, 3, 3, 3, 3, 7, 7, 7, 7, 7,
131 7, 7, 7, 17, 8, 8, 8, 8, 8, 8,
132 8, 8, 9, 9, 9, 9, 9, 9, 11, 11,
133 11, 11, 11, 11, 0, 0, 16, 16, 0, 17,
134 17, 0, 0, 16, 18, 18, 0, 0, 13, 13,
135 13, 13, 0, 19, 14, 14, 14, 14, 0, 0,
136 0, 0, 15, 15, 10, 10, 10, 10, 10, 10,
137 0, 12, 12, 12, 12, 12, 12, 0, 0, 0,
138 0, 0, 0, 0, 0, 0, 0, 31, 18, 0,
139 0, 0, 29, 27, 0, 28, 0, 30, 0, 0,
140 0, 0, 14, 15, 19, 20, 22, 24, 25, 26,
141 21, 0, 23, 31, 18, 0, 0, 0, 29, 27,
142 31, 28, 0, 30, 0, 29, 27, 0, 28, 0,
143 30, 0, 0, 0, 0, 0, 21, 0, 23, 0,
144 0, 0, 0, 21, 17, 23, 0, 0, 0, 19,
145 20, 22, 24, 25, 26, 0, 0, 0, 0, 0,
146 0, 0, 0, 31, 18, 0, 0, 0, 29, 27,
147 17, 28, 0, 30, 16, 0, 0, 0, 14, 15,
148 19, 20, 22, 24, 25, 26, 21, 0, 23, 9,
149 10, 11, 12, 13, 0, 0, 0, 0, 0, 0,
150 16, 33, 34, 35, 36, 37, 38, 39, 40, 41,
151 42, 43, 44, 45, 46, 47, 48, 49, 50, 0,
152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
161 15, 19, 20, 22, 24, 25, 26, 0, 0, 0,
162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
163 0, 0, 0, 0, 0, 0, 0, 19, 20, 22,
164 24, 25, 26, 0, 19, 20, 22, 24, 25, 26,
165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
166 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
167 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
168 0, 0, 0, 0, 0, 0, 0, 19, 20, 22,
169 24, 25, 26,
171 const short yycheck[] = { -1,
172 0, 37, 0, -1, -1, 37, 42, 43, 0, 45,
173 42, 47, 37, -1, -1, 47, 0, 42, 43, 33,
174 45, -1, 47, -1, -1, 0, 40, -1, -1, 43,
175 -1, 45, -1, 0, -1, 60, -1, 62, 38, 0,
176 -1, 41, -1, 43, -1, 45, 38, 0, -1, 41,
177 0, 43, -1, 45, 38, 0, -1, 41, -1, 0,
178 60, -1, 62, 38, 0, 0, 41, -1, 60, -1,
179 62, 38, -1, 0, 41, 0, 60, 38, 62, -1,
180 41, -1, 0, -1, -1, 60, -1, 62, 41, -1,
181 -1, 41, -1, 60, 94, 62, 41, 38, -1, 60,
182 41, 62, 94, 38, -1, 41, 41, -1, -1, -1,
183 94, 38, 126, 38, 41, -1, 41, -1, -1, 94,
184 38, -1, -1, 41, 124, -1, -1, 94, -1, -1,
185 -1, -1, 124, 94, -1, 60, -1, 62, -1, -1,
186 124, 94, 60, -1, 62, -1, -1, -1, -1, 124,
187 37, 38, -1, 94, 41, 42, 43, 124, 45, 94,
188 47, -1, -1, 124, -1, -1, -1, 94, -1, 94,
189 -1, 124, 37, 60, 124, 62, 94, 42, 43, -1,
190 45, -1, 47, 124, -1, -1, -1, -1, -1, 124,
191 -1, -1, -1, -1, -1, 37, 38, 124, -1, 124,
192 42, 43, -1, 45, -1, 47, 124, 94, -1, -1,
193 -1, -1, -1, -1, -1, -1, -1, -1, 60, -1,
194 62, -1, -1, -1, -1, -1, 37, 38, -1, 265,
195 266, 42, 43, -1, 45, -1, 47, 124, 263, 264,
196 265, 266, -1, 257, -1, -1, -1, -1, -1, 60,
197 -1, 62, 94, -1, -1, -1, -1, -1, -1, 259,
198 260, 261, 262, 263, 264, 265, 266, 259, 260, 261,
199 262, 263, 264, 265, 266, 259, 260, 261, 262, 263,
200 264, 265, 266, 94, 259, 260, 261, 262, 263, 264,
201 265, 266, 259, 260, 261, 262, 263, 264, 259, 260,
202 261, 262, 263, 264, -1, -1, 259, 260, -1, 259,
203 260, -1, -1, 124, 259, 260, -1, -1, 259, 260,
204 261, 262, -1, 259, 259, 260, 261, 262, -1, -1,
205 -1, -1, 259, 260, 259, 260, 261, 262, 263, 264,
206 -1, 259, 260, 261, 262, 263, 264, -1, -1, -1,
207 -1, -1, -1, -1, -1, -1, -1, 37, 38, -1,
208 -1, -1, 42, 43, -1, 45, -1, 47, -1, -1,
209 -1, -1, 259, 260, 261, 262, 263, 264, 265, 266,
210 60, -1, 62, 37, 38, -1, -1, -1, 42, 43,
211 37, 45, -1, 47, -1, 42, 43, -1, 45, -1,
212 47, -1, -1, -1, -1, -1, 60, -1, 62, -1,
213 -1, -1, -1, 60, 94, 62, -1, -1, -1, 261,
214 262, 263, 264, 265, 266, -1, -1, -1, -1, -1,
215 -1, -1, -1, 37, 38, -1, -1, -1, 42, 43,
216 94, 45, -1, 47, 124, -1, -1, -1, 259, 260,
217 261, 262, 263, 264, 265, 266, 60, -1, 62, 2,
218 3, 4, 5, 6, -1, -1, -1, -1, -1, -1,
219 124, 14, 15, 16, 17, 18, 19, 20, 21, 22,
220 23, 24, 25, 26, 27, 28, 29, 30, 31, -1,
221 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
222 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
223 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
224 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
225 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
226 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
227 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
228 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
229 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
230 260, 261, 262, 263, 264, 265, 266, -1, -1, -1,
231 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
232 -1, -1, -1, -1, -1, -1, -1, 261, 262, 263,
233 264, 265, 266, -1, 261, 262, 263, 264, 265, 266,
234 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
235 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
236 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
237 -1, -1, -1, -1, -1, -1, -1, 261, 262, 263,
238 264, 265, 266,
240 #define YYFINAL 7
241 #ifndef YYDEBUG
242 #define YYDEBUG 0
243 #endif
244 #define YYMAXTOKEN 268
245 #if YYDEBUG
246 const char * const yyname[] = {
247 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
248 "'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
249 0,0,0,0,0,"'<'",0,"'>'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
250 0,0,0,"'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,
251 "'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
252 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
253 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
254 0,0,0,0,0,0,0,0,0,0,0,0,0,"NUMBER","ERROR","LOR","LAND","EQ","NE","LE","GE",
255 "LSHIFT","RSHIFT","UMINUS","UPLUS",
257 const char * const yyrule[] = {
258 "$accept : top",
259 "top : expr",
260 "expr : expr '+' expr",
261 "expr : expr '-' expr",
262 "expr : expr '*' expr",
263 "expr : expr '/' expr",
264 "expr : expr '%' expr",
265 "expr : expr LSHIFT expr",
266 "expr : expr RSHIFT expr",
267 "expr : expr '<' expr",
268 "expr : expr '>' expr",
269 "expr : expr LE expr",
270 "expr : expr GE expr",
271 "expr : expr EQ expr",
272 "expr : expr NE expr",
273 "expr : expr '&' expr",
274 "expr : expr '^' expr",
275 "expr : expr '|' expr",
276 "expr : expr LAND expr",
277 "expr : expr LOR expr",
278 "expr : '(' expr ')'",
279 "expr : '-' expr",
280 "expr : '+' expr",
281 "expr : '!' expr",
282 "expr : '~' expr",
283 "expr : NUMBER",
285 #endif
286 #ifndef YYSTYPE
287 typedef int YYSTYPE;
288 #endif
289 #ifdef YYSTACKSIZE
290 #undef YYMAXDEPTH
291 #define YYMAXDEPTH YYSTACKSIZE
292 #else
293 #ifdef YYMAXDEPTH
294 #define YYSTACKSIZE YYMAXDEPTH
295 #else
296 #define YYSTACKSIZE 10000
297 #define YYMAXDEPTH 10000
298 #endif
299 #endif
300 #define YYINITSTACKSIZE 200
301 int yydebug;
302 int yynerrs;
303 int yyerrflag;
304 int yychar;
305 short *yyssp;
306 YYSTYPE *yyvsp;
307 YYSTYPE yyval;
308 static YYSTYPE yyvalzero;
309 YYSTYPE yylval;
310 short *yyss;
311 short *yysslim;
312 YYSTYPE *yyvs;
313 int yystacksize;
314 int yyparse(void);
315 #line 85 "../../../usr.bin/m4/parser.y"
317 #line 315 "parser.c"
318 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
319 static int yygrowstack(void);
320 static int yygrowstack(void)
322 int newsize, i;
323 short *newss;
324 YYSTYPE *newvs;
326 if ((newsize = yystacksize) == 0)
327 newsize = YYINITSTACKSIZE;
328 else if (newsize >= YYMAXDEPTH)
329 return -1;
330 else if ((newsize *= 2) > YYMAXDEPTH)
331 newsize = YYMAXDEPTH;
332 i = yyssp - yyss;
333 if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL)
334 return -1;
335 yyss = newss;
336 yyssp = newss + i;
337 if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL)
338 return -1;
339 yyvs = newvs;
340 yyvsp = newvs + i;
341 yystacksize = newsize;
342 yysslim = yyss + newsize - 1;
343 return 0;
346 #define YYABORT goto yyabort
347 #define YYREJECT goto yyabort
348 #define YYACCEPT goto yyaccept
349 #define YYERROR goto yyerrlab
351 yyparse(void)
353 int yym, yyn, yystate;
354 #if YYDEBUG
355 const char *yys;
357 if ((yys = getenv("YYDEBUG")) != NULL)
359 yyn = *yys;
360 if (yyn >= '0' && yyn <= '9')
361 yydebug = yyn - '0';
363 #endif
365 yynerrs = 0;
366 yyerrflag = 0;
367 yychar = (-1);
369 if (yyss == NULL && yygrowstack()) goto yyoverflow;
370 yyssp = yyss;
371 yyvsp = yyvs;
372 *yyssp = yystate = 0;
374 yyloop:
375 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
376 if (yychar < 0)
378 if ((yychar = yylex()) < 0) yychar = 0;
379 #if YYDEBUG
380 if (yydebug)
382 yys = 0;
383 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
384 if (!yys) yys = "illegal-symbol";
385 printf("%sdebug: state %d, reading %d (%s)\n",
386 YYPREFIX, yystate, yychar, yys);
388 #endif
390 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
391 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
393 #if YYDEBUG
394 if (yydebug)
395 printf("%sdebug: state %d, shifting to state %d\n",
396 YYPREFIX, yystate, yytable[yyn]);
397 #endif
398 if (yyssp >= yysslim && yygrowstack())
400 goto yyoverflow;
402 *++yyssp = yystate = yytable[yyn];
403 *++yyvsp = yylval;
404 yychar = (-1);
405 if (yyerrflag > 0) --yyerrflag;
406 goto yyloop;
408 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
409 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
411 yyn = yytable[yyn];
412 goto yyreduce;
414 if (yyerrflag) goto yyinrecovery;
415 goto yynewerror;
416 yynewerror:
417 yyerror("syntax error");
418 goto yyerrlab;
419 yyerrlab:
420 ++yynerrs;
421 yyinrecovery:
422 if (yyerrflag < 3)
424 yyerrflag = 3;
425 for (;;)
427 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
428 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
430 #if YYDEBUG
431 if (yydebug)
432 printf("%sdebug: state %d, error recovery shifting\
433 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
434 #endif
435 if (yyssp >= yysslim && yygrowstack())
437 goto yyoverflow;
439 *++yyssp = yystate = yytable[yyn];
440 *++yyvsp = yylval;
441 goto yyloop;
443 else
445 #if YYDEBUG
446 if (yydebug)
447 printf("%sdebug: error recovery discarding state %d\n",
448 YYPREFIX, *yyssp);
449 #endif
450 if (yyssp <= yyss) goto yyabort;
451 --yyssp;
452 --yyvsp;
456 else
458 if (yychar == 0) goto yyabort;
459 #if YYDEBUG
460 if (yydebug)
462 yys = 0;
463 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
464 if (!yys) yys = "illegal-symbol";
465 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
466 YYPREFIX, yystate, yychar, yys);
468 #endif
469 yychar = (-1);
470 goto yyloop;
472 yyreduce:
473 #if YYDEBUG
474 if (yydebug)
475 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
476 YYPREFIX, yystate, yyn, yyrule[yyn]);
477 #endif
478 yym = yylen[yyn];
479 if (yym)
480 yyval = yyvsp[1-yym];
481 else
482 yyval = yyvalzero;
483 switch (yyn)
485 case 1:
486 #line 45 "../../../usr.bin/m4/parser.y"
487 { end_result = yyvsp[0]; }
488 break;
489 case 2:
490 #line 47 "../../../usr.bin/m4/parser.y"
491 { yyval = yyvsp[-2] + yyvsp[0]; }
492 break;
493 case 3:
494 #line 48 "../../../usr.bin/m4/parser.y"
495 { yyval = yyvsp[-2] - yyvsp[0]; }
496 break;
497 case 4:
498 #line 49 "../../../usr.bin/m4/parser.y"
499 { yyval = yyvsp[-2] * yyvsp[0]; }
500 break;
501 case 5:
502 #line 50 "../../../usr.bin/m4/parser.y"
504 if (yyvsp[0] == 0) {
505 yyerror("division by zero");
506 exit(1);
508 yyval = yyvsp[-2] / yyvsp[0];
510 break;
511 case 6:
512 #line 57 "../../../usr.bin/m4/parser.y"
514 if (yyvsp[0] == 0) {
515 yyerror("modulo zero");
516 exit(1);
518 yyval = yyvsp[-2] % yyvsp[0];
520 break;
521 case 7:
522 #line 64 "../../../usr.bin/m4/parser.y"
523 { yyval = yyvsp[-2] << yyvsp[0]; }
524 break;
525 case 8:
526 #line 65 "../../../usr.bin/m4/parser.y"
527 { yyval = yyvsp[-2] >> yyvsp[0]; }
528 break;
529 case 9:
530 #line 66 "../../../usr.bin/m4/parser.y"
531 { yyval = yyvsp[-2] < yyvsp[0]; }
532 break;
533 case 10:
534 #line 67 "../../../usr.bin/m4/parser.y"
535 { yyval = yyvsp[-2] > yyvsp[0]; }
536 break;
537 case 11:
538 #line 68 "../../../usr.bin/m4/parser.y"
539 { yyval = yyvsp[-2] <= yyvsp[0]; }
540 break;
541 case 12:
542 #line 69 "../../../usr.bin/m4/parser.y"
543 { yyval = yyvsp[-2] >= yyvsp[0]; }
544 break;
545 case 13:
546 #line 70 "../../../usr.bin/m4/parser.y"
547 { yyval = yyvsp[-2] == yyvsp[0]; }
548 break;
549 case 14:
550 #line 71 "../../../usr.bin/m4/parser.y"
551 { yyval = yyvsp[-2] != yyvsp[0]; }
552 break;
553 case 15:
554 #line 72 "../../../usr.bin/m4/parser.y"
555 { yyval = yyvsp[-2] & yyvsp[0]; }
556 break;
557 case 16:
558 #line 73 "../../../usr.bin/m4/parser.y"
559 { yyval = yyvsp[-2] ^ yyvsp[0]; }
560 break;
561 case 17:
562 #line 74 "../../../usr.bin/m4/parser.y"
563 { yyval = yyvsp[-2] | yyvsp[0]; }
564 break;
565 case 18:
566 #line 75 "../../../usr.bin/m4/parser.y"
567 { yyval = yyvsp[-2] && yyvsp[0]; }
568 break;
569 case 19:
570 #line 76 "../../../usr.bin/m4/parser.y"
571 { yyval = yyvsp[-2] || yyvsp[0]; }
572 break;
573 case 20:
574 #line 77 "../../../usr.bin/m4/parser.y"
575 { yyval = yyvsp[-1]; }
576 break;
577 case 21:
578 #line 78 "../../../usr.bin/m4/parser.y"
579 { yyval = -yyvsp[0]; }
580 break;
581 case 22:
582 #line 79 "../../../usr.bin/m4/parser.y"
583 { yyval = yyvsp[0]; }
584 break;
585 case 23:
586 #line 80 "../../../usr.bin/m4/parser.y"
587 { yyval = !yyvsp[0]; }
588 break;
589 case 24:
590 #line 81 "../../../usr.bin/m4/parser.y"
591 { yyval = ~yyvsp[0]; }
592 break;
593 #line 591 "parser.c"
595 yyssp -= yym;
596 yystate = *yyssp;
597 yyvsp -= yym;
598 yym = yylhs[yyn];
599 if (yystate == 0 && yym == 0)
601 #if YYDEBUG
602 if (yydebug)
603 printf("%sdebug: after reduction, shifting from state 0 to\
604 state %d\n", YYPREFIX, YYFINAL);
605 #endif
606 yystate = YYFINAL;
607 *++yyssp = YYFINAL;
608 *++yyvsp = yyval;
609 if (yychar < 0)
611 if ((yychar = yylex()) < 0) yychar = 0;
612 #if YYDEBUG
613 if (yydebug)
615 yys = 0;
616 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
617 if (!yys) yys = "illegal-symbol";
618 printf("%sdebug: state %d, reading %d (%s)\n",
619 YYPREFIX, YYFINAL, yychar, yys);
621 #endif
623 if (yychar == 0) goto yyaccept;
624 goto yyloop;
626 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
627 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
628 yystate = yytable[yyn];
629 else
630 yystate = yydgoto[yym];
631 #if YYDEBUG
632 if (yydebug)
633 printf("%sdebug: after reduction, shifting from state %d \
634 to state %d\n", YYPREFIX, *yyssp, yystate);
635 #endif
636 if (yyssp >= yysslim && yygrowstack())
638 goto yyoverflow;
640 *++yyssp = yystate;
641 *++yyvsp = yyval;
642 goto yyloop;
643 yyoverflow:
644 yyerror("yacc stack overflow");
645 yyabort:
646 return (1);
647 yyaccept:
648 return (0);