]>
Commit | Line | Data |
---|---|---|
a58b1e65 RH |
1 | /* A Bison parser, made from plural.y |
2 | by GNU bison 1.35. */ | |
abbffdf9 UD |
3 | |
4 | #define YYBISON 1 /* Identify Bison output. */ | |
5 | ||
6 | #define yyparse __gettextparse | |
7 | #define yylex __gettextlex | |
8 | #define yyerror __gettexterror | |
9 | #define yylval __gettextlval | |
10 | #define yychar __gettextchar | |
11 | #define yydebug __gettextdebug | |
12 | #define yynerrs __gettextnerrs | |
a58b1e65 RH |
13 | # define EQUOP2 257 |
14 | # define CMPOP2 258 | |
15 | # define ADDOP2 259 | |
16 | # define MULOP2 260 | |
17 | # define NUMBER 261 | |
abbffdf9 UD |
18 | |
19 | #line 1 "plural.y" | |
20 | ||
21 | /* Expression parsing for plural form selection. | |
eda6c725 | 22 | Copyright (C) 2000, 2001 Free Software Foundation, Inc. |
a1b36134 | 23 | This file is part of the GNU C Library. |
abbffdf9 UD |
24 | Written by Ulrich Drepper <drepper@cygnus.com>, 2000. |
25 | ||
26 | The GNU C Library is free software; you can redistribute it and/or | |
a1b36134 AJ |
27 | modify it under the terms of the GNU Lesser General Public |
28 | License as published by the Free Software Foundation; either | |
29 | version 2.1 of the License, or (at your option) any later version. | |
abbffdf9 UD |
30 | |
31 | The GNU C Library is distributed in the hope that it will be useful, | |
32 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
33 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
a1b36134 | 34 | Lesser General Public License for more details. |
abbffdf9 | 35 | |
a1b36134 AJ |
36 | You should have received a copy of the GNU Lesser General Public |
37 | License along with the GNU C Library; if not, write to the Free | |
38 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
39 | 02111-1307 USA. */ | |
abbffdf9 | 40 | |
0555fcce UD |
41 | /* The bison generated parser uses alloca. AIX 3 forces us to put this |
42 | declaration at the beginning of the file. The declaration in bison's | |
43 | skeleton file comes too late. This must come before <config.h> | |
44 | because <config.h> may include arbitrary system headers. */ | |
45 | #if defined _AIX && !defined __GNUC__ | |
46 | #pragma alloca | |
47 | #endif | |
eda6c725 UD |
48 | #ifdef HAVE_CONFIG_H |
49 | # include <config.h> | |
50 | #endif | |
51 | ||
0555fcce | 52 | #include <stddef.h> |
abbffdf9 | 53 | #include <stdlib.h> |
85dd1003 | 54 | #include <string.h> |
0555fcce UD |
55 | #include "plural-exp.h" |
56 | ||
57 | /* The main function generated by the parser is called __gettextparse, | |
58 | but we want it to be called PLURAL_PARSE. */ | |
59 | #ifndef _LIBC | |
60 | # define __gettextparse PLURAL_PARSE | |
4a4d50f3 UD |
61 | #endif |
62 | ||
abbffdf9 UD |
63 | #define YYLEX_PARAM &((struct parse_args *) arg)->cp |
64 | #define YYPARSE_PARAM arg | |
65 | ||
0555fcce | 66 | #line 49 "plural.y" |
a58b1e65 | 67 | #ifndef YYSTYPE |
abbffdf9 UD |
68 | typedef union { |
69 | unsigned long int num; | |
4a4d50f3 | 70 | enum operator op; |
abbffdf9 | 71 | struct expression *exp; |
a58b1e65 RH |
72 | } yystype; |
73 | # define YYSTYPE yystype | |
74 | # define YYSTYPE_IS_TRIVIAL 1 | |
75 | #endif | |
0555fcce | 76 | #line 55 "plural.y" |
abbffdf9 UD |
77 | |
78 | /* Prototypes for local functions. */ | |
4a4d50f3 UD |
79 | static struct expression *new_exp PARAMS ((int nargs, enum operator op, |
80 | struct expression * const *args)); | |
81 | static inline struct expression *new_exp_0 PARAMS ((enum operator op)); | |
82 | static inline struct expression *new_exp_1 PARAMS ((enum operator op, | |
83 | struct expression *right)); | |
84 | static struct expression *new_exp_2 PARAMS ((enum operator op, | |
85 | struct expression *left, | |
86 | struct expression *right)); | |
87 | static inline struct expression *new_exp_3 PARAMS ((enum operator op, | |
88 | struct expression *bexp, | |
89 | struct expression *tbranch, | |
90 | struct expression *fbranch)); | |
91 | static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); | |
92 | static void yyerror PARAMS ((const char *str)); | |
93 | ||
94 | /* Allocation of expressions. */ | |
95 | ||
96 | static struct expression * | |
97 | new_exp (nargs, op, args) | |
98 | int nargs; | |
99 | enum operator op; | |
100 | struct expression * const *args; | |
101 | { | |
102 | int i; | |
103 | struct expression *newp; | |
104 | ||
105 | /* If any of the argument could not be malloc'ed, just return NULL. */ | |
106 | for (i = nargs - 1; i >= 0; i--) | |
107 | if (args[i] == NULL) | |
108 | goto fail; | |
109 | ||
110 | /* Allocate a new expression. */ | |
111 | newp = (struct expression *) malloc (sizeof (*newp)); | |
112 | if (newp != NULL) | |
113 | { | |
114 | newp->nargs = nargs; | |
115 | newp->operation = op; | |
116 | for (i = nargs - 1; i >= 0; i--) | |
117 | newp->val.args[i] = args[i]; | |
118 | return newp; | |
119 | } | |
120 | ||
121 | fail: | |
122 | for (i = nargs - 1; i >= 0; i--) | |
123 | FREE_EXPRESSION (args[i]); | |
124 | ||
125 | return NULL; | |
126 | } | |
127 | ||
128 | static inline struct expression * | |
129 | new_exp_0 (op) | |
130 | enum operator op; | |
131 | { | |
132 | return new_exp (0, op, NULL); | |
133 | } | |
134 | ||
135 | static inline struct expression * | |
136 | new_exp_1 (op, right) | |
137 | enum operator op; | |
138 | struct expression *right; | |
139 | { | |
140 | struct expression *args[1]; | |
141 | ||
142 | args[0] = right; | |
143 | return new_exp (1, op, args); | |
144 | } | |
145 | ||
146 | static struct expression * | |
147 | new_exp_2 (op, left, right) | |
148 | enum operator op; | |
149 | struct expression *left; | |
150 | struct expression *right; | |
151 | { | |
152 | struct expression *args[2]; | |
153 | ||
154 | args[0] = left; | |
155 | args[1] = right; | |
156 | return new_exp (2, op, args); | |
157 | } | |
158 | ||
159 | static inline struct expression * | |
160 | new_exp_3 (op, bexp, tbranch, fbranch) | |
161 | enum operator op; | |
162 | struct expression *bexp; | |
163 | struct expression *tbranch; | |
164 | struct expression *fbranch; | |
165 | { | |
166 | struct expression *args[3]; | |
167 | ||
168 | args[0] = bexp; | |
169 | args[1] = tbranch; | |
170 | args[2] = fbranch; | |
171 | return new_exp (3, op, args); | |
172 | } | |
173 | ||
a58b1e65 RH |
174 | #ifndef YYDEBUG |
175 | # define YYDEBUG 0 | |
abbffdf9 UD |
176 | #endif |
177 | ||
178 | ||
179 | ||
4a4d50f3 | 180 | #define YYFINAL 27 |
abbffdf9 | 181 | #define YYFLAG -32768 |
4a4d50f3 | 182 | #define YYNTBASE 16 |
abbffdf9 | 183 | |
a58b1e65 | 184 | /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ |
4a4d50f3 | 185 | #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18) |
abbffdf9 | 186 | |
a58b1e65 RH |
187 | /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ |
188 | static const char yytranslate[] = | |
189 | { | |
190 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
191 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
192 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
193 | 2, 2, 2, 10, 2, 2, 2, 2, 5, 2, | |
194 | 14, 15, 2, 2, 2, 2, 2, 2, 2, 2, | |
195 | 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, | |
196 | 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, | |
197 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
198 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
199 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
200 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
201 | 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
202 | 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, | |
203 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
204 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
205 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
206 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
207 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
208 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
209 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
210 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
211 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
212 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
213 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
214 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
215 | 2, 2, 2, 2, 2, 2, 1, 6, 7, 8, | |
216 | 9, 11 | |
abbffdf9 UD |
217 | }; |
218 | ||
a58b1e65 RH |
219 | #if YYDEBUG |
220 | static const short yyprhs[] = | |
221 | { | |
222 | 0, 0, 2, 8, 12, 16, 20, 24, 28, 32, | |
223 | 35, 37, 39 | |
abbffdf9 | 224 | }; |
a58b1e65 RH |
225 | static const short yyrhs[] = |
226 | { | |
227 | 17, 0, 17, 3, 17, 12, 17, 0, 17, 4, | |
228 | 17, 0, 17, 5, 17, 0, 17, 6, 17, 0, | |
229 | 17, 7, 17, 0, 17, 8, 17, 0, 17, 9, | |
230 | 17, 0, 10, 17, 0, 13, 0, 11, 0, 14, | |
231 | 17, 15, 0 | |
abbffdf9 UD |
232 | }; |
233 | ||
234 | #endif | |
235 | ||
a58b1e65 RH |
236 | #if YYDEBUG |
237 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | |
238 | static const short yyrline[] = | |
239 | { | |
240 | 0, 174, 182, 186, 190, 194, 198, 202, 206, 210, | |
241 | 214, 218, 223 | |
abbffdf9 UD |
242 | }; |
243 | #endif | |
244 | ||
245 | ||
a58b1e65 | 246 | #if (YYDEBUG) || defined YYERROR_VERBOSE |
abbffdf9 | 247 | |
a58b1e65 RH |
248 | /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ |
249 | static const char *const yytname[] = | |
250 | { | |
251 | "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2", | |
252 | "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'", | |
253 | "start", "exp", 0 | |
abbffdf9 UD |
254 | }; |
255 | #endif | |
256 | ||
a58b1e65 RH |
257 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
258 | static const short yyr1[] = | |
259 | { | |
260 | 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, | |
261 | 17, 17, 17 | |
abbffdf9 UD |
262 | }; |
263 | ||
a58b1e65 RH |
264 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
265 | static const short yyr2[] = | |
266 | { | |
267 | 0, 1, 5, 3, 3, 3, 3, 3, 3, 2, | |
268 | 1, 1, 3 | |
abbffdf9 UD |
269 | }; |
270 | ||
a58b1e65 RH |
271 | /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE |
272 | doesn't specify something else to do. Zero means the default is an | |
273 | error. */ | |
274 | static const short yydefact[] = | |
275 | { | |
276 | 0, 0, 11, 10, 0, 1, 9, 0, 0, 0, | |
277 | 0, 0, 0, 0, 0, 12, 0, 3, 4, 5, | |
278 | 6, 7, 8, 0, 2, 0, 0, 0 | |
abbffdf9 UD |
279 | }; |
280 | ||
a58b1e65 RH |
281 | static const short yydefgoto[] = |
282 | { | |
283 | 25, 5 | |
abbffdf9 UD |
284 | }; |
285 | ||
a58b1e65 RH |
286 | static const short yypact[] = |
287 | { | |
288 | -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, | |
289 | -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16, | |
290 | 26, -3,-32768, -9, 34, 21, 53,-32768 | |
abbffdf9 UD |
291 | }; |
292 | ||
a58b1e65 RH |
293 | static const short yypgoto[] = |
294 | { | |
295 | -32768, -1 | |
abbffdf9 UD |
296 | }; |
297 | ||
298 | ||
4a4d50f3 | 299 | #define YYLAST 53 |
abbffdf9 UD |
300 | |
301 | ||
a58b1e65 RH |
302 | static const short yytable[] = |
303 | { | |
304 | 6, 1, 2, 7, 3, 4, 14, 16, 17, 18, | |
305 | 19, 20, 21, 22, 8, 9, 10, 11, 12, 13, | |
306 | 14, 26, 24, 12, 13, 14, 15, 8, 9, 10, | |
307 | 11, 12, 13, 14, 13, 14, 23, 8, 9, 10, | |
308 | 11, 12, 13, 14, 10, 11, 12, 13, 14, 11, | |
309 | 12, 13, 14, 27 | |
abbffdf9 UD |
310 | }; |
311 | ||
a58b1e65 RH |
312 | static const short yycheck[] = |
313 | { | |
314 | 1, 10, 11, 4, 13, 14, 9, 8, 9, 10, | |
315 | 11, 12, 13, 14, 3, 4, 5, 6, 7, 8, | |
316 | 9, 0, 23, 7, 8, 9, 15, 3, 4, 5, | |
317 | 6, 7, 8, 9, 8, 9, 12, 3, 4, 5, | |
318 | 6, 7, 8, 9, 5, 6, 7, 8, 9, 6, | |
319 | 7, 8, 9, 0 | |
abbffdf9 UD |
320 | }; |
321 | #define YYPURE 1 | |
322 | ||
323 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
a58b1e65 | 324 | #line 3 "/castro/street/H-alpha-linux/share/bison/bison.simple" |
abbffdf9 UD |
325 | |
326 | /* Skeleton output parser for bison, | |
a58b1e65 RH |
327 | |
328 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software | |
329 | Foundation, Inc. | |
abbffdf9 UD |
330 | |
331 | This program is free software; you can redistribute it and/or modify | |
332 | it under the terms of the GNU General Public License as published by | |
333 | the Free Software Foundation; either version 2, or (at your option) | |
334 | any later version. | |
335 | ||
336 | This program is distributed in the hope that it will be useful, | |
337 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
338 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
339 | GNU General Public License for more details. | |
340 | ||
341 | You should have received a copy of the GNU General Public License | |
342 | along with this program; if not, write to the Free Software | |
343 | Foundation, Inc., 59 Temple Place - Suite 330, | |
344 | Boston, MA 02111-1307, USA. */ | |
345 | ||
346 | /* As a special exception, when this file is copied by Bison into a | |
347 | Bison output file, you may use that output file without restriction. | |
348 | This special exception was added by the Free Software Foundation | |
349 | in version 1.24 of Bison. */ | |
350 | ||
a58b1e65 RH |
351 | /* This is the parser code that is written into each bison parser when |
352 | the %semantic_parser declaration is not specified in the grammar. | |
353 | It was written by Richard Stallman by simplifying the hairy parser | |
354 | used when %semantic_parser is specified. */ | |
355 | ||
356 | /* All symbols defined below should begin with yy or YY, to avoid | |
357 | infringing on user name space. This should be done even for local | |
358 | variables, as they might otherwise be expanded by user macros. | |
359 | There are some unavoidable exceptions within include files to | |
360 | define necessary library symbols; they are noted "INFRINGES ON | |
361 | USER NAME SPACE" below. */ | |
362 | ||
363 | #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) | |
364 | ||
365 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | |
366 | ||
367 | # if YYSTACK_USE_ALLOCA | |
368 | # define YYSTACK_ALLOC alloca | |
369 | # else | |
370 | # ifndef YYSTACK_USE_ALLOCA | |
371 | # if defined (alloca) || defined (_ALLOCA_H) | |
372 | # define YYSTACK_ALLOC alloca | |
373 | # else | |
374 | # ifdef __GNUC__ | |
375 | # define YYSTACK_ALLOC __builtin_alloca | |
376 | # endif | |
377 | # endif | |
378 | # endif | |
379 | # endif | |
380 | ||
381 | # ifdef YYSTACK_ALLOC | |
382 | /* Pacify GCC's `empty if-body' warning. */ | |
383 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | |
384 | # else | |
385 | # if defined (__STDC__) || defined (__cplusplus) | |
386 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
387 | # define YYSIZE_T size_t | |
388 | # endif | |
389 | # define YYSTACK_ALLOC malloc | |
390 | # define YYSTACK_FREE free | |
391 | # endif | |
392 | #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ | |
393 | ||
394 | ||
395 | #if (! defined (yyoverflow) \ | |
396 | && (! defined (__cplusplus) \ | |
397 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | |
398 | ||
399 | /* A type that is properly aligned for any stack member. */ | |
400 | union yyalloc | |
401 | { | |
402 | short yyss; | |
403 | YYSTYPE yyvs; | |
404 | # if YYLSP_NEEDED | |
405 | YYLTYPE yyls; | |
406 | # endif | |
407 | }; | |
408 | ||
409 | /* The size of the maximum gap between one aligned stack and the next. */ | |
410 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) | |
411 | ||
412 | /* The size of an array large to enough to hold all stacks, each with | |
413 | N elements. */ | |
414 | # if YYLSP_NEEDED | |
415 | # define YYSTACK_BYTES(N) \ | |
416 | ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ | |
417 | + 2 * YYSTACK_GAP_MAX) | |
418 | # else | |
419 | # define YYSTACK_BYTES(N) \ | |
420 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ | |
421 | + YYSTACK_GAP_MAX) | |
422 | # endif | |
423 | ||
424 | /* Copy COUNT objects from FROM to TO. The source and destination do | |
425 | not overlap. */ | |
426 | # ifndef YYCOPY | |
427 | # if 1 < __GNUC__ | |
428 | # define YYCOPY(To, From, Count) \ | |
429 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | |
430 | # else | |
431 | # define YYCOPY(To, From, Count) \ | |
432 | do \ | |
433 | { \ | |
434 | register YYSIZE_T yyi; \ | |
435 | for (yyi = 0; yyi < (Count); yyi++) \ | |
436 | (To)[yyi] = (From)[yyi]; \ | |
437 | } \ | |
438 | while (0) | |
439 | # endif | |
440 | # endif | |
441 | ||
442 | /* Relocate STACK from its old location to the new one. The | |
443 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | |
444 | elements in the stack, and YYPTR gives the new location of the | |
445 | stack. Advance YYPTR to a properly aligned location for the next | |
446 | stack. */ | |
447 | # define YYSTACK_RELOCATE(Stack) \ | |
448 | do \ | |
449 | { \ | |
450 | YYSIZE_T yynewbytes; \ | |
451 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | |
452 | Stack = &yyptr->Stack; \ | |
453 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ | |
454 | yyptr += yynewbytes / sizeof (*yyptr); \ | |
455 | } \ | |
456 | while (0) | |
abbffdf9 | 457 | |
abbffdf9 | 458 | #endif |
a58b1e65 RH |
459 | |
460 | ||
461 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | |
462 | # define YYSIZE_T __SIZE_TYPE__ | |
abbffdf9 | 463 | #endif |
a58b1e65 RH |
464 | #if ! defined (YYSIZE_T) && defined (size_t) |
465 | # define YYSIZE_T size_t | |
466 | #endif | |
467 | #if ! defined (YYSIZE_T) | |
468 | # if defined (__STDC__) || defined (__cplusplus) | |
469 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | |
470 | # define YYSIZE_T size_t | |
471 | # endif | |
472 | #endif | |
473 | #if ! defined (YYSIZE_T) | |
474 | # define YYSIZE_T unsigned int | |
abbffdf9 | 475 | #endif |
abbffdf9 UD |
476 | |
477 | #define yyerrok (yyerrstatus = 0) | |
478 | #define yyclearin (yychar = YYEMPTY) | |
479 | #define YYEMPTY -2 | |
480 | #define YYEOF 0 | |
481 | #define YYACCEPT goto yyacceptlab | |
482 | #define YYABORT goto yyabortlab | |
483 | #define YYERROR goto yyerrlab1 | |
a58b1e65 RH |
484 | /* Like YYERROR except do call yyerror. This remains here temporarily |
485 | to ease the transition to the new meaning of YYERROR, for GCC. | |
abbffdf9 UD |
486 | Once GCC version 2 has supplanted version 1, this can go. */ |
487 | #define YYFAIL goto yyerrlab | |
488 | #define YYRECOVERING() (!!yyerrstatus) | |
a58b1e65 | 489 | #define YYBACKUP(Token, Value) \ |
abbffdf9 UD |
490 | do \ |
491 | if (yychar == YYEMPTY && yylen == 1) \ | |
a58b1e65 RH |
492 | { \ |
493 | yychar = (Token); \ | |
494 | yylval = (Value); \ | |
abbffdf9 UD |
495 | yychar1 = YYTRANSLATE (yychar); \ |
496 | YYPOPSTACK; \ | |
497 | goto yybackup; \ | |
498 | } \ | |
499 | else \ | |
a58b1e65 RH |
500 | { \ |
501 | yyerror ("syntax error: cannot back up"); \ | |
502 | YYERROR; \ | |
503 | } \ | |
abbffdf9 UD |
504 | while (0) |
505 | ||
506 | #define YYTERROR 1 | |
507 | #define YYERRCODE 256 | |
508 | ||
abbffdf9 | 509 | |
a58b1e65 RH |
510 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
511 | are run). | |
abbffdf9 | 512 | |
a58b1e65 RH |
513 | When YYLLOC_DEFAULT is run, CURRENT is set the location of the |
514 | first token. By default, to implement support for ranges, extend | |
515 | its range to the last symbol. */ | |
abbffdf9 | 516 | |
a58b1e65 RH |
517 | #ifndef YYLLOC_DEFAULT |
518 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |
519 | Current.last_line = Rhs[N].last_line; \ | |
520 | Current.last_column = Rhs[N].last_column; | |
abbffdf9 UD |
521 | #endif |
522 | ||
abbffdf9 | 523 | |
a58b1e65 RH |
524 | /* YYLEX -- calling `yylex' with the right arguments. */ |
525 | ||
526 | #if YYPURE | |
527 | # if YYLSP_NEEDED | |
528 | # ifdef YYLEX_PARAM | |
529 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) | |
530 | # else | |
531 | # define YYLEX yylex (&yylval, &yylloc) | |
532 | # endif | |
533 | # else /* !YYLSP_NEEDED */ | |
534 | # ifdef YYLEX_PARAM | |
535 | # define YYLEX yylex (&yylval, YYLEX_PARAM) | |
536 | # else | |
537 | # define YYLEX yylex (&yylval) | |
538 | # endif | |
539 | # endif /* !YYLSP_NEEDED */ | |
540 | #else /* !YYPURE */ | |
541 | # define YYLEX yylex () | |
542 | #endif /* !YYPURE */ | |
543 | ||
544 | ||
545 | /* Enable debugging if requested. */ | |
546 | #if YYDEBUG | |
547 | ||
548 | # ifndef YYFPRINTF | |
549 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | |
550 | # define YYFPRINTF fprintf | |
551 | # endif | |
552 | ||
553 | # define YYDPRINTF(Args) \ | |
554 | do { \ | |
555 | if (yydebug) \ | |
556 | YYFPRINTF Args; \ | |
557 | } while (0) | |
558 | /* Nonzero means print parse trace. It is left uninitialized so that | |
559 | multiple parsers can coexist. */ | |
560 | int yydebug; | |
561 | #else /* !YYDEBUG */ | |
562 | # define YYDPRINTF(Args) | |
563 | #endif /* !YYDEBUG */ | |
564 | ||
565 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
abbffdf9 | 566 | #ifndef YYINITDEPTH |
a58b1e65 | 567 | # define YYINITDEPTH 200 |
abbffdf9 UD |
568 | #endif |
569 | ||
a58b1e65 RH |
570 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
571 | if the built-in stack extension method is used). | |
572 | ||
573 | Do not make this value too large; the results are undefined if | |
574 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | |
575 | evaluated with infinite-precision integer arithmetic. */ | |
abbffdf9 UD |
576 | |
577 | #if YYMAXDEPTH == 0 | |
a58b1e65 | 578 | # undef YYMAXDEPTH |
abbffdf9 UD |
579 | #endif |
580 | ||
581 | #ifndef YYMAXDEPTH | |
a58b1e65 | 582 | # define YYMAXDEPTH 10000 |
abbffdf9 UD |
583 | #endif |
584 | \f | |
a58b1e65 | 585 | #ifdef YYERROR_VERBOSE |
abbffdf9 | 586 | |
a58b1e65 RH |
587 | # ifndef yystrlen |
588 | # if defined (__GLIBC__) && defined (_STRING_H) | |
589 | # define yystrlen strlen | |
590 | # else | |
591 | /* Return the length of YYSTR. */ | |
592 | static YYSIZE_T | |
593 | # if defined (__STDC__) || defined (__cplusplus) | |
594 | yystrlen (const char *yystr) | |
595 | # else | |
596 | yystrlen (yystr) | |
597 | const char *yystr; | |
598 | # endif | |
599 | { | |
600 | register const char *yys = yystr; | |
abbffdf9 | 601 | |
a58b1e65 RH |
602 | while (*yys++ != '\0') |
603 | continue; | |
abbffdf9 | 604 | |
a58b1e65 RH |
605 | return yys - yystr - 1; |
606 | } | |
607 | # endif | |
608 | # endif | |
609 | ||
610 | # ifndef yystpcpy | |
611 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | |
612 | # define yystpcpy stpcpy | |
613 | # else | |
614 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
615 | YYDEST. */ | |
616 | static char * | |
617 | # if defined (__STDC__) || defined (__cplusplus) | |
618 | yystpcpy (char *yydest, const char *yysrc) | |
619 | # else | |
620 | yystpcpy (yydest, yysrc) | |
621 | char *yydest; | |
622 | const char *yysrc; | |
623 | # endif | |
abbffdf9 | 624 | { |
a58b1e65 RH |
625 | register char *yyd = yydest; |
626 | register const char *yys = yysrc; | |
abbffdf9 | 627 | |
a58b1e65 RH |
628 | while ((*yyd++ = *yys++) != '\0') |
629 | continue; | |
abbffdf9 | 630 | |
a58b1e65 RH |
631 | return yyd - 1; |
632 | } | |
633 | # endif | |
634 | # endif | |
abbffdf9 UD |
635 | #endif |
636 | \f | |
a58b1e65 RH |
637 | #line 315 "/castro/street/H-alpha-linux/share/bison/bison.simple" |
638 | ||
abbffdf9 UD |
639 | |
640 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
641 | into yyparse. The argument should have type void *. | |
642 | It should actually point to an object. | |
643 | Grammar actions can access the variable by casting it | |
644 | to the proper pointer type. */ | |
645 | ||
646 | #ifdef YYPARSE_PARAM | |
a58b1e65 RH |
647 | # if defined (__STDC__) || defined (__cplusplus) |
648 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
649 | # define YYPARSE_PARAM_DECL | |
650 | # else | |
651 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
652 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
653 | # endif | |
654 | #else /* !YYPARSE_PARAM */ | |
655 | # define YYPARSE_PARAM_ARG | |
656 | # define YYPARSE_PARAM_DECL | |
657 | #endif /* !YYPARSE_PARAM */ | |
abbffdf9 UD |
658 | |
659 | /* Prevent warning if -Wstrict-prototypes. */ | |
660 | #ifdef __GNUC__ | |
a58b1e65 | 661 | # ifdef YYPARSE_PARAM |
0555fcce | 662 | int yyparse (void *); |
a58b1e65 | 663 | # else |
0555fcce | 664 | int yyparse (void); |
a58b1e65 | 665 | # endif |
abbffdf9 | 666 | #endif |
a58b1e65 RH |
667 | |
668 | /* YY_DECL_VARIABLES -- depending whether we use a pure parser, | |
669 | variables are global, or local to YYPARSE. */ | |
670 | ||
671 | #define YY_DECL_NON_LSP_VARIABLES \ | |
672 | /* The lookahead symbol. */ \ | |
673 | int yychar; \ | |
674 | \ | |
675 | /* The semantic value of the lookahead symbol. */ \ | |
676 | YYSTYPE yylval; \ | |
677 | \ | |
678 | /* Number of parse errors so far. */ \ | |
679 | int yynerrs; | |
680 | ||
681 | #if YYLSP_NEEDED | |
682 | # define YY_DECL_VARIABLES \ | |
683 | YY_DECL_NON_LSP_VARIABLES \ | |
684 | \ | |
685 | /* Location data for the lookahead symbol. */ \ | |
686 | YYLTYPE yylloc; | |
687 | #else | |
688 | # define YY_DECL_VARIABLES \ | |
689 | YY_DECL_NON_LSP_VARIABLES | |
abbffdf9 UD |
690 | #endif |
691 | ||
a58b1e65 RH |
692 | |
693 | /* If nonreentrant, generate the variables here. */ | |
694 | ||
695 | #if !YYPURE | |
696 | YY_DECL_VARIABLES | |
697 | #endif /* !YYPURE */ | |
698 | ||
0555fcce | 699 | int |
a58b1e65 | 700 | yyparse (YYPARSE_PARAM_ARG) |
abbffdf9 UD |
701 | YYPARSE_PARAM_DECL |
702 | { | |
a58b1e65 RH |
703 | /* If reentrant, generate the variables here. */ |
704 | #if YYPURE | |
705 | YY_DECL_VARIABLES | |
706 | #endif /* !YYPURE */ | |
707 | ||
abbffdf9 UD |
708 | register int yystate; |
709 | register int yyn; | |
a58b1e65 RH |
710 | int yyresult; |
711 | /* Number of tokens to shift before error messages enabled. */ | |
712 | int yyerrstatus; | |
713 | /* Lookahead token as an internal (translated) token number. */ | |
714 | int yychar1 = 0; | |
715 | ||
716 | /* Three stacks and their tools: | |
717 | `yyss': related to states, | |
718 | `yyvs': related to semantic values, | |
719 | `yyls': related to locations. | |
720 | ||
721 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
722 | to reallocate them elsewhere. */ | |
723 | ||
724 | /* The state stack. */ | |
725 | short yyssa[YYINITDEPTH]; | |
726 | short *yyss = yyssa; | |
abbffdf9 | 727 | register short *yyssp; |
abbffdf9 | 728 | |
a58b1e65 RH |
729 | /* The semantic value stack. */ |
730 | YYSTYPE yyvsa[YYINITDEPTH]; | |
731 | YYSTYPE *yyvs = yyvsa; | |
732 | register YYSTYPE *yyvsp; | |
abbffdf9 | 733 | |
a58b1e65 RH |
734 | #if YYLSP_NEEDED |
735 | /* The location stack. */ | |
736 | YYLTYPE yylsa[YYINITDEPTH]; | |
abbffdf9 UD |
737 | YYLTYPE *yyls = yylsa; |
738 | YYLTYPE *yylsp; | |
a58b1e65 | 739 | #endif |
abbffdf9 | 740 | |
a58b1e65 RH |
741 | #if YYLSP_NEEDED |
742 | # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
abbffdf9 | 743 | #else |
a58b1e65 | 744 | # define YYPOPSTACK (yyvsp--, yyssp--) |
abbffdf9 UD |
745 | #endif |
746 | ||
a58b1e65 | 747 | YYSIZE_T yystacksize = YYINITDEPTH; |
abbffdf9 | 748 | |
abbffdf9 | 749 | |
a58b1e65 RH |
750 | /* The variables used to return semantic value and location from the |
751 | action routines. */ | |
752 | YYSTYPE yyval; | |
753 | #if YYLSP_NEEDED | |
754 | YYLTYPE yyloc; | |
755 | #endif | |
abbffdf9 | 756 | |
a58b1e65 RH |
757 | /* When reducing, the number of symbols on the RHS of the reduced |
758 | rule. */ | |
abbffdf9 UD |
759 | int yylen; |
760 | ||
a58b1e65 | 761 | YYDPRINTF ((stderr, "Starting parse\n")); |
abbffdf9 UD |
762 | |
763 | yystate = 0; | |
764 | yyerrstatus = 0; | |
765 | yynerrs = 0; | |
766 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
767 | ||
768 | /* Initialize stack pointers. | |
769 | Waste one element of value and location stack | |
770 | so that they stay on the same level as the state stack. | |
771 | The wasted elements are never initialized. */ | |
772 | ||
a58b1e65 | 773 | yyssp = yyss; |
abbffdf9 | 774 | yyvsp = yyvs; |
a58b1e65 | 775 | #if YYLSP_NEEDED |
abbffdf9 UD |
776 | yylsp = yyls; |
777 | #endif | |
a58b1e65 | 778 | goto yysetstate; |
abbffdf9 | 779 | |
a58b1e65 RH |
780 | /*------------------------------------------------------------. |
781 | | yynewstate -- Push a new state, which is found in yystate. | | |
782 | `------------------------------------------------------------*/ | |
783 | yynewstate: | |
784 | /* In all cases, when you get here, the value and location stacks | |
785 | have just been pushed. so pushing a state here evens the stacks. | |
786 | */ | |
787 | yyssp++; | |
abbffdf9 | 788 | |
a58b1e65 RH |
789 | yysetstate: |
790 | *yyssp = yystate; | |
abbffdf9 UD |
791 | |
792 | if (yyssp >= yyss + yystacksize - 1) | |
793 | { | |
abbffdf9 | 794 | /* Get the current used size of the three stacks, in elements. */ |
a58b1e65 | 795 | YYSIZE_T yysize = yyssp - yyss + 1; |
abbffdf9 UD |
796 | |
797 | #ifdef yyoverflow | |
a58b1e65 RH |
798 | { |
799 | /* Give user a chance to reallocate the stack. Use copies of | |
800 | these so that the &'s don't force the real ones into | |
801 | memory. */ | |
802 | YYSTYPE *yyvs1 = yyvs; | |
803 | short *yyss1 = yyss; | |
804 | ||
805 | /* Each stack pointer address is followed by the size of the | |
806 | data in use in that stack, in bytes. */ | |
807 | # if YYLSP_NEEDED | |
808 | YYLTYPE *yyls1 = yyls; | |
809 | /* This used to be a conditional around just the two extra args, | |
810 | but that might be undefined if yyoverflow is a macro. */ | |
811 | yyoverflow ("parser stack overflow", | |
812 | &yyss1, yysize * sizeof (*yyssp), | |
813 | &yyvs1, yysize * sizeof (*yyvsp), | |
814 | &yyls1, yysize * sizeof (*yylsp), | |
815 | &yystacksize); | |
816 | yyls = yyls1; | |
817 | # else | |
818 | yyoverflow ("parser stack overflow", | |
819 | &yyss1, yysize * sizeof (*yyssp), | |
820 | &yyvs1, yysize * sizeof (*yyvsp), | |
821 | &yystacksize); | |
822 | # endif | |
823 | yyss = yyss1; | |
824 | yyvs = yyvs1; | |
825 | } | |
abbffdf9 | 826 | #else /* no yyoverflow */ |
a58b1e65 RH |
827 | # ifndef YYSTACK_RELOCATE |
828 | goto yyoverflowlab; | |
829 | # else | |
abbffdf9 UD |
830 | /* Extend the stack our own way. */ |
831 | if (yystacksize >= YYMAXDEPTH) | |
a58b1e65 | 832 | goto yyoverflowlab; |
abbffdf9 UD |
833 | yystacksize *= 2; |
834 | if (yystacksize > YYMAXDEPTH) | |
835 | yystacksize = YYMAXDEPTH; | |
a58b1e65 RH |
836 | |
837 | { | |
838 | short *yyss1 = yyss; | |
839 | union yyalloc *yyptr = | |
840 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | |
841 | if (! yyptr) | |
842 | goto yyoverflowlab; | |
843 | YYSTACK_RELOCATE (yyss); | |
844 | YYSTACK_RELOCATE (yyvs); | |
845 | # if YYLSP_NEEDED | |
846 | YYSTACK_RELOCATE (yyls); | |
847 | # endif | |
848 | # undef YYSTACK_RELOCATE | |
849 | if (yyss1 != yyssa) | |
850 | YYSTACK_FREE (yyss1); | |
851 | } | |
852 | # endif | |
abbffdf9 UD |
853 | #endif /* no yyoverflow */ |
854 | ||
a58b1e65 RH |
855 | yyssp = yyss + yysize - 1; |
856 | yyvsp = yyvs + yysize - 1; | |
857 | #if YYLSP_NEEDED | |
858 | yylsp = yyls + yysize - 1; | |
abbffdf9 UD |
859 | #endif |
860 | ||
a58b1e65 RH |
861 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
862 | (unsigned long int) yystacksize)); | |
abbffdf9 UD |
863 | |
864 | if (yyssp >= yyss + yystacksize - 1) | |
865 | YYABORT; | |
866 | } | |
867 | ||
a58b1e65 | 868 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
abbffdf9 UD |
869 | |
870 | goto yybackup; | |
a58b1e65 RH |
871 | |
872 | ||
873 | /*-----------. | |
874 | | yybackup. | | |
875 | `-----------*/ | |
876 | yybackup: | |
abbffdf9 UD |
877 | |
878 | /* Do appropriate processing given the current state. */ | |
879 | /* Read a lookahead token if we need one and don't already have one. */ | |
880 | /* yyresume: */ | |
881 | ||
882 | /* First try to decide what to do without reference to lookahead token. */ | |
883 | ||
884 | yyn = yypact[yystate]; | |
885 | if (yyn == YYFLAG) | |
886 | goto yydefault; | |
887 | ||
888 | /* Not known => get a lookahead token if don't already have one. */ | |
889 | ||
890 | /* yychar is either YYEMPTY or YYEOF | |
891 | or a valid token in external form. */ | |
892 | ||
893 | if (yychar == YYEMPTY) | |
894 | { | |
a58b1e65 | 895 | YYDPRINTF ((stderr, "Reading a token: ")); |
abbffdf9 UD |
896 | yychar = YYLEX; |
897 | } | |
898 | ||
899 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
900 | ||
901 | if (yychar <= 0) /* This means end of input. */ | |
902 | { | |
903 | yychar1 = 0; | |
904 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
905 | ||
a58b1e65 | 906 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
abbffdf9 UD |
907 | } |
908 | else | |
909 | { | |
a58b1e65 | 910 | yychar1 = YYTRANSLATE (yychar); |
abbffdf9 | 911 | |
a58b1e65 RH |
912 | #if YYDEBUG |
913 | /* We have to keep this `#if YYDEBUG', since we use variables | |
914 | which are defined only if `YYDEBUG' is set. */ | |
abbffdf9 UD |
915 | if (yydebug) |
916 | { | |
a58b1e65 RH |
917 | YYFPRINTF (stderr, "Next token is %d (%s", |
918 | yychar, yytname[yychar1]); | |
919 | /* Give the individual parser a way to print the precise | |
920 | meaning of a token, for further debugging info. */ | |
921 | # ifdef YYPRINT | |
abbffdf9 | 922 | YYPRINT (stderr, yychar, yylval); |
a58b1e65 RH |
923 | # endif |
924 | YYFPRINTF (stderr, ")\n"); | |
abbffdf9 UD |
925 | } |
926 | #endif | |
927 | } | |
928 | ||
929 | yyn += yychar1; | |
930 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
931 | goto yydefault; | |
932 | ||
933 | yyn = yytable[yyn]; | |
934 | ||
935 | /* yyn is what to do for this token type in this state. | |
936 | Negative => reduce, -yyn is rule number. | |
937 | Positive => shift, yyn is new state. | |
938 | New state is final state => don't bother to shift, | |
939 | just return success. | |
940 | 0, or most negative number => error. */ | |
941 | ||
942 | if (yyn < 0) | |
943 | { | |
944 | if (yyn == YYFLAG) | |
945 | goto yyerrlab; | |
946 | yyn = -yyn; | |
947 | goto yyreduce; | |
948 | } | |
949 | else if (yyn == 0) | |
950 | goto yyerrlab; | |
951 | ||
952 | if (yyn == YYFINAL) | |
953 | YYACCEPT; | |
954 | ||
955 | /* Shift the lookahead token. */ | |
a58b1e65 RH |
956 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", |
957 | yychar, yytname[yychar1])); | |
abbffdf9 UD |
958 | |
959 | /* Discard the token being shifted unless it is eof. */ | |
960 | if (yychar != YYEOF) | |
961 | yychar = YYEMPTY; | |
962 | ||
963 | *++yyvsp = yylval; | |
a58b1e65 | 964 | #if YYLSP_NEEDED |
abbffdf9 UD |
965 | *++yylsp = yylloc; |
966 | #endif | |
967 | ||
a58b1e65 RH |
968 | /* Count tokens shifted since error; after three, turn off error |
969 | status. */ | |
970 | if (yyerrstatus) | |
971 | yyerrstatus--; | |
abbffdf9 UD |
972 | |
973 | yystate = yyn; | |
974 | goto yynewstate; | |
975 | ||
abbffdf9 | 976 | |
a58b1e65 RH |
977 | /*-----------------------------------------------------------. |
978 | | yydefault -- do the default action for the current state. | | |
979 | `-----------------------------------------------------------*/ | |
980 | yydefault: | |
abbffdf9 UD |
981 | yyn = yydefact[yystate]; |
982 | if (yyn == 0) | |
983 | goto yyerrlab; | |
a58b1e65 RH |
984 | goto yyreduce; |
985 | ||
abbffdf9 | 986 | |
a58b1e65 RH |
987 | /*-----------------------------. |
988 | | yyreduce -- Do a reduction. | | |
989 | `-----------------------------*/ | |
abbffdf9 | 990 | yyreduce: |
a58b1e65 | 991 | /* yyn is the number of a rule to reduce with. */ |
abbffdf9 | 992 | yylen = yyr2[yyn]; |
abbffdf9 | 993 | |
a58b1e65 RH |
994 | /* If YYLEN is nonzero, implement the default value of the action: |
995 | `$$ = $1'. | |
996 | ||
997 | Otherwise, the following line sets YYVAL to the semantic value of | |
998 | the lookahead token. This behavior is undocumented and Bison | |
999 | users should not rely upon it. Assigning to YYVAL | |
1000 | unconditionally makes the parser a bit smaller, and it avoids a | |
1001 | GCC warning that YYVAL may be used uninitialized. */ | |
1002 | yyval = yyvsp[1-yylen]; | |
1003 | ||
1004 | #if YYLSP_NEEDED | |
1005 | /* Similarly for the default location. Let the user run additional | |
1006 | commands if for instance locations are ranges. */ | |
1007 | yyloc = yylsp[1-yylen]; | |
1008 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | |
1009 | #endif | |
1010 | ||
1011 | #if YYDEBUG | |
1012 | /* We have to keep this `#if YYDEBUG', since we use variables which | |
1013 | are defined only if `YYDEBUG' is set. */ | |
abbffdf9 UD |
1014 | if (yydebug) |
1015 | { | |
a58b1e65 | 1016 | int yyi; |
abbffdf9 | 1017 | |
a58b1e65 RH |
1018 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", |
1019 | yyn, yyrline[yyn]); | |
abbffdf9 UD |
1020 | |
1021 | /* Print the symbols being reduced, and their result. */ | |
a58b1e65 RH |
1022 | for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) |
1023 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); | |
1024 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
abbffdf9 UD |
1025 | } |
1026 | #endif | |
1027 | ||
abbffdf9 UD |
1028 | switch (yyn) { |
1029 | ||
1030 | case 1: | |
0555fcce | 1031 | #line 175 "plural.y" |
abbffdf9 | 1032 | { |
4a4d50f3 UD |
1033 | if (yyvsp[0].exp == NULL) |
1034 | YYABORT; | |
abbffdf9 | 1035 | ((struct parse_args *) arg)->res = yyvsp[0].exp; |
a58b1e65 RH |
1036 | } |
1037 | break; | |
abbffdf9 | 1038 | case 2: |
0555fcce | 1039 | #line 183 "plural.y" |
abbffdf9 | 1040 | { |
4a4d50f3 | 1041 | yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp); |
a58b1e65 RH |
1042 | } |
1043 | break; | |
abbffdf9 | 1044 | case 3: |
0555fcce | 1045 | #line 187 "plural.y" |
abbffdf9 | 1046 | { |
4a4d50f3 | 1047 | yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp); |
a58b1e65 RH |
1048 | } |
1049 | break; | |
abbffdf9 | 1050 | case 4: |
0555fcce | 1051 | #line 191 "plural.y" |
abbffdf9 | 1052 | { |
4a4d50f3 | 1053 | yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp); |
a58b1e65 RH |
1054 | } |
1055 | break; | |
abbffdf9 | 1056 | case 5: |
0555fcce | 1057 | #line 195 "plural.y" |
abbffdf9 | 1058 | { |
4a4d50f3 | 1059 | yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); |
a58b1e65 RH |
1060 | } |
1061 | break; | |
abbffdf9 | 1062 | case 6: |
0555fcce | 1063 | #line 199 "plural.y" |
abbffdf9 | 1064 | { |
4a4d50f3 | 1065 | yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); |
a58b1e65 RH |
1066 | } |
1067 | break; | |
abbffdf9 | 1068 | case 7: |
0555fcce | 1069 | #line 203 "plural.y" |
abbffdf9 | 1070 | { |
4a4d50f3 | 1071 | yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); |
a58b1e65 RH |
1072 | } |
1073 | break; | |
abbffdf9 | 1074 | case 8: |
0555fcce | 1075 | #line 207 "plural.y" |
abbffdf9 | 1076 | { |
4a4d50f3 | 1077 | yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); |
a58b1e65 RH |
1078 | } |
1079 | break; | |
abbffdf9 | 1080 | case 9: |
0555fcce | 1081 | #line 211 "plural.y" |
abbffdf9 | 1082 | { |
4a4d50f3 | 1083 | yyval.exp = new_exp_1 (lnot, yyvsp[0].exp); |
a58b1e65 RH |
1084 | } |
1085 | break; | |
abbffdf9 | 1086 | case 10: |
0555fcce | 1087 | #line 215 "plural.y" |
abbffdf9 | 1088 | { |
4a4d50f3 | 1089 | yyval.exp = new_exp_0 (var); |
a58b1e65 RH |
1090 | } |
1091 | break; | |
abbffdf9 | 1092 | case 11: |
0555fcce | 1093 | #line 219 "plural.y" |
abbffdf9 | 1094 | { |
4a4d50f3 UD |
1095 | if ((yyval.exp = new_exp_0 (num)) != NULL) |
1096 | yyval.exp->val.num = yyvsp[0].num; | |
a58b1e65 RH |
1097 | } |
1098 | break; | |
abbffdf9 | 1099 | case 12: |
0555fcce | 1100 | #line 224 "plural.y" |
abbffdf9 | 1101 | { |
4a4d50f3 | 1102 | yyval.exp = yyvsp[-1].exp; |
a58b1e65 RH |
1103 | } |
1104 | break; | |
abbffdf9 | 1105 | } |
a58b1e65 RH |
1106 | |
1107 | #line 705 "/castro/street/H-alpha-linux/share/bison/bison.simple" | |
1108 | ||
abbffdf9 UD |
1109 | \f |
1110 | yyvsp -= yylen; | |
1111 | yyssp -= yylen; | |
a58b1e65 | 1112 | #if YYLSP_NEEDED |
abbffdf9 UD |
1113 | yylsp -= yylen; |
1114 | #endif | |
1115 | ||
a58b1e65 | 1116 | #if YYDEBUG |
abbffdf9 UD |
1117 | if (yydebug) |
1118 | { | |
a58b1e65 RH |
1119 | short *yyssp1 = yyss - 1; |
1120 | YYFPRINTF (stderr, "state stack now"); | |
1121 | while (yyssp1 != yyssp) | |
1122 | YYFPRINTF (stderr, " %d", *++yyssp1); | |
1123 | YYFPRINTF (stderr, "\n"); | |
abbffdf9 UD |
1124 | } |
1125 | #endif | |
1126 | ||
1127 | *++yyvsp = yyval; | |
a58b1e65 RH |
1128 | #if YYLSP_NEEDED |
1129 | *++yylsp = yyloc; | |
abbffdf9 UD |
1130 | #endif |
1131 | ||
a58b1e65 RH |
1132 | /* Now `shift' the result of the reduction. Determine what state |
1133 | that goes to, based on the state we popped back to and the rule | |
1134 | number reduced by. */ | |
abbffdf9 UD |
1135 | |
1136 | yyn = yyr1[yyn]; | |
1137 | ||
1138 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
1139 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
1140 | yystate = yytable[yystate]; | |
1141 | else | |
1142 | yystate = yydefgoto[yyn - YYNTBASE]; | |
1143 | ||
1144 | goto yynewstate; | |
1145 | ||
abbffdf9 | 1146 | |
a58b1e65 RH |
1147 | /*------------------------------------. |
1148 | | yyerrlab -- here on detecting error | | |
1149 | `------------------------------------*/ | |
1150 | yyerrlab: | |
1151 | /* If not already recovering from an error, report this error. */ | |
1152 | if (!yyerrstatus) | |
abbffdf9 UD |
1153 | { |
1154 | ++yynerrs; | |
1155 | ||
1156 | #ifdef YYERROR_VERBOSE | |
1157 | yyn = yypact[yystate]; | |
1158 | ||
1159 | if (yyn > YYFLAG && yyn < YYLAST) | |
1160 | { | |
a58b1e65 RH |
1161 | YYSIZE_T yysize = 0; |
1162 | char *yymsg; | |
1163 | int yyx, yycount; | |
1164 | ||
1165 | yycount = 0; | |
1166 | /* Start YYX at -YYN if negative to avoid negative indexes in | |
1167 | YYCHECK. */ | |
1168 | for (yyx = yyn < 0 ? -yyn : 0; | |
1169 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) | |
1170 | if (yycheck[yyx + yyn] == yyx) | |
1171 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; | |
1172 | yysize += yystrlen ("parse error, unexpected ") + 1; | |
1173 | yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); | |
1174 | yymsg = (char *) YYSTACK_ALLOC (yysize); | |
1175 | if (yymsg != 0) | |
abbffdf9 | 1176 | { |
a58b1e65 RH |
1177 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); |
1178 | yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); | |
abbffdf9 | 1179 | |
a58b1e65 | 1180 | if (yycount < 5) |
abbffdf9 | 1181 | { |
a58b1e65 RH |
1182 | yycount = 0; |
1183 | for (yyx = yyn < 0 ? -yyn : 0; | |
1184 | yyx < (int) (sizeof (yytname) / sizeof (char *)); | |
1185 | yyx++) | |
1186 | if (yycheck[yyx + yyn] == yyx) | |
abbffdf9 | 1187 | { |
a58b1e65 RH |
1188 | const char *yyq = ! yycount ? ", expecting " : " or "; |
1189 | yyp = yystpcpy (yyp, yyq); | |
1190 | yyp = yystpcpy (yyp, yytname[yyx]); | |
1191 | yycount++; | |
abbffdf9 UD |
1192 | } |
1193 | } | |
a58b1e65 RH |
1194 | yyerror (yymsg); |
1195 | YYSTACK_FREE (yymsg); | |
abbffdf9 UD |
1196 | } |
1197 | else | |
a58b1e65 | 1198 | yyerror ("parse error; also virtual memory exhausted"); |
abbffdf9 UD |
1199 | } |
1200 | else | |
a58b1e65 RH |
1201 | #endif /* defined (YYERROR_VERBOSE) */ |
1202 | yyerror ("parse error"); | |
abbffdf9 | 1203 | } |
abbffdf9 | 1204 | goto yyerrlab1; |
abbffdf9 | 1205 | |
a58b1e65 RH |
1206 | |
1207 | /*--------------------------------------------------. | |
1208 | | yyerrlab1 -- error raised explicitly by an action | | |
1209 | `--------------------------------------------------*/ | |
1210 | yyerrlab1: | |
abbffdf9 UD |
1211 | if (yyerrstatus == 3) |
1212 | { | |
a58b1e65 RH |
1213 | /* If just tried and failed to reuse lookahead token after an |
1214 | error, discard it. */ | |
abbffdf9 UD |
1215 | |
1216 | /* return failure if at end of input */ | |
1217 | if (yychar == YYEOF) | |
1218 | YYABORT; | |
a58b1e65 RH |
1219 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
1220 | yychar, yytname[yychar1])); | |
abbffdf9 UD |
1221 | yychar = YYEMPTY; |
1222 | } | |
1223 | ||
a58b1e65 RH |
1224 | /* Else will try to reuse lookahead token after shifting the error |
1225 | token. */ | |
abbffdf9 UD |
1226 | |
1227 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
1228 | ||
1229 | goto yyerrhandle; | |
1230 | ||
abbffdf9 | 1231 | |
a58b1e65 RH |
1232 | /*-------------------------------------------------------------------. |
1233 | | yyerrdefault -- current state does not do anything special for the | | |
1234 | | error token. | | |
1235 | `-------------------------------------------------------------------*/ | |
1236 | yyerrdefault: | |
abbffdf9 UD |
1237 | #if 0 |
1238 | /* This is wrong; only states that explicitly want error tokens | |
1239 | should shift them. */ | |
a58b1e65 RH |
1240 | |
1241 | /* If its default is to accept any token, ok. Otherwise pop it. */ | |
1242 | yyn = yydefact[yystate]; | |
1243 | if (yyn) | |
1244 | goto yydefault; | |
abbffdf9 UD |
1245 | #endif |
1246 | ||
abbffdf9 | 1247 | |
a58b1e65 RH |
1248 | /*---------------------------------------------------------------. |
1249 | | yyerrpop -- pop the current state because it cannot handle the | | |
1250 | | error token | | |
1251 | `---------------------------------------------------------------*/ | |
1252 | yyerrpop: | |
1253 | if (yyssp == yyss) | |
1254 | YYABORT; | |
abbffdf9 UD |
1255 | yyvsp--; |
1256 | yystate = *--yyssp; | |
a58b1e65 | 1257 | #if YYLSP_NEEDED |
abbffdf9 UD |
1258 | yylsp--; |
1259 | #endif | |
1260 | ||
a58b1e65 | 1261 | #if YYDEBUG |
abbffdf9 UD |
1262 | if (yydebug) |
1263 | { | |
a58b1e65 RH |
1264 | short *yyssp1 = yyss - 1; |
1265 | YYFPRINTF (stderr, "Error: state stack now"); | |
1266 | while (yyssp1 != yyssp) | |
1267 | YYFPRINTF (stderr, " %d", *++yyssp1); | |
1268 | YYFPRINTF (stderr, "\n"); | |
abbffdf9 UD |
1269 | } |
1270 | #endif | |
1271 | ||
a58b1e65 RH |
1272 | /*--------------. |
1273 | | yyerrhandle. | | |
1274 | `--------------*/ | |
abbffdf9 | 1275 | yyerrhandle: |
abbffdf9 UD |
1276 | yyn = yypact[yystate]; |
1277 | if (yyn == YYFLAG) | |
1278 | goto yyerrdefault; | |
1279 | ||
1280 | yyn += YYTERROR; | |
1281 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
1282 | goto yyerrdefault; | |
1283 | ||
1284 | yyn = yytable[yyn]; | |
1285 | if (yyn < 0) | |
1286 | { | |
1287 | if (yyn == YYFLAG) | |
1288 | goto yyerrpop; | |
1289 | yyn = -yyn; | |
1290 | goto yyreduce; | |
1291 | } | |
1292 | else if (yyn == 0) | |
1293 | goto yyerrpop; | |
1294 | ||
1295 | if (yyn == YYFINAL) | |
1296 | YYACCEPT; | |
1297 | ||
a58b1e65 | 1298 | YYDPRINTF ((stderr, "Shifting error token, ")); |
abbffdf9 UD |
1299 | |
1300 | *++yyvsp = yylval; | |
a58b1e65 | 1301 | #if YYLSP_NEEDED |
abbffdf9 UD |
1302 | *++yylsp = yylloc; |
1303 | #endif | |
1304 | ||
1305 | yystate = yyn; | |
1306 | goto yynewstate; | |
1307 | ||
abbffdf9 | 1308 | |
a58b1e65 RH |
1309 | /*-------------------------------------. |
1310 | | yyacceptlab -- YYACCEPT comes here. | | |
1311 | `-------------------------------------*/ | |
1312 | yyacceptlab: | |
1313 | yyresult = 0; | |
1314 | goto yyreturn; | |
1315 | ||
1316 | /*-----------------------------------. | |
1317 | | yyabortlab -- YYABORT comes here. | | |
1318 | `-----------------------------------*/ | |
1319 | yyabortlab: | |
1320 | yyresult = 1; | |
1321 | goto yyreturn; | |
1322 | ||
1323 | /*---------------------------------------------. | |
1324 | | yyoverflowab -- parser overflow comes here. | | |
1325 | `---------------------------------------------*/ | |
1326 | yyoverflowlab: | |
1327 | yyerror ("parser stack overflow"); | |
1328 | yyresult = 2; | |
1329 | /* Fall through. */ | |
1330 | ||
1331 | yyreturn: | |
1332 | #ifndef yyoverflow | |
1333 | if (yyss != yyssa) | |
1334 | YYSTACK_FREE (yyss); | |
abbffdf9 | 1335 | #endif |
a58b1e65 | 1336 | return yyresult; |
abbffdf9 | 1337 | } |
0555fcce | 1338 | #line 229 "plural.y" |
abbffdf9 | 1339 | |
abbffdf9 UD |
1340 | |
1341 | void | |
1342 | internal_function | |
4a4d50f3 UD |
1343 | FREE_EXPRESSION (exp) |
1344 | struct expression *exp; | |
abbffdf9 UD |
1345 | { |
1346 | if (exp == NULL) | |
1347 | return; | |
1348 | ||
1349 | /* Handle the recursive case. */ | |
4a4d50f3 | 1350 | switch (exp->nargs) |
abbffdf9 | 1351 | { |
4a4d50f3 UD |
1352 | case 3: |
1353 | FREE_EXPRESSION (exp->val.args[2]); | |
1354 | /* FALLTHROUGH */ | |
1355 | case 2: | |
1356 | FREE_EXPRESSION (exp->val.args[1]); | |
1357 | /* FALLTHROUGH */ | |
1358 | case 1: | |
1359 | FREE_EXPRESSION (exp->val.args[0]); | |
abbffdf9 | 1360 | /* FALLTHROUGH */ |
abbffdf9 UD |
1361 | default: |
1362 | break; | |
1363 | } | |
1364 | ||
1365 | free (exp); | |
1366 | } | |
1367 | ||
1368 | ||
1369 | static int | |
4a4d50f3 UD |
1370 | yylex (lval, pexp) |
1371 | YYSTYPE *lval; | |
1372 | const char **pexp; | |
abbffdf9 UD |
1373 | { |
1374 | const char *exp = *pexp; | |
1375 | int result; | |
1376 | ||
1377 | while (1) | |
1378 | { | |
2f599545 UD |
1379 | if (exp[0] == '\0') |
1380 | { | |
1381 | *pexp = exp; | |
1382 | return YYEOF; | |
1383 | } | |
1384 | ||
1385 | if (exp[0] != ' ' && exp[0] != '\t') | |
abbffdf9 UD |
1386 | break; |
1387 | ||
1388 | ++exp; | |
1389 | } | |
1390 | ||
1391 | result = *exp++; | |
1392 | switch (result) | |
1393 | { | |
eda6c725 UD |
1394 | case '0': case '1': case '2': case '3': case '4': |
1395 | case '5': case '6': case '7': case '8': case '9': | |
abbffdf9 | 1396 | { |
eda6c725 | 1397 | unsigned long int n = result - '0'; |
abbffdf9 UD |
1398 | while (exp[0] >= '0' && exp[0] <= '9') |
1399 | { | |
1400 | n *= 10; | |
1401 | n += exp[0] - '0'; | |
1402 | ++exp; | |
1403 | } | |
1404 | lval->num = n; | |
1405 | result = NUMBER; | |
1406 | } | |
1407 | break; | |
1408 | ||
1409 | case '=': | |
abbffdf9 | 1410 | if (exp[0] == '=') |
4a4d50f3 UD |
1411 | { |
1412 | ++exp; | |
1413 | lval->op = equal; | |
1414 | result = EQUOP2; | |
1415 | } | |
abbffdf9 UD |
1416 | else |
1417 | result = YYERRCODE; | |
1418 | break; | |
1419 | ||
4a4d50f3 UD |
1420 | case '!': |
1421 | if (exp[0] == '=') | |
1422 | { | |
1423 | ++exp; | |
1424 | lval->op = not_equal; | |
1425 | result = EQUOP2; | |
1426 | } | |
1427 | break; | |
1428 | ||
abbffdf9 UD |
1429 | case '&': |
1430 | case '|': | |
1431 | if (exp[0] == result) | |
1432 | ++exp; | |
1433 | else | |
1434 | result = YYERRCODE; | |
1435 | break; | |
1436 | ||
4a4d50f3 UD |
1437 | case '<': |
1438 | if (exp[0] == '=') | |
1439 | { | |
1440 | ++exp; | |
1441 | lval->op = less_or_equal; | |
1442 | } | |
1443 | else | |
1444 | lval->op = less_than; | |
1445 | result = CMPOP2; | |
1446 | break; | |
1447 | ||
1448 | case '>': | |
1449 | if (exp[0] == '=') | |
1450 | { | |
1451 | ++exp; | |
1452 | lval->op = greater_or_equal; | |
1453 | } | |
1454 | else | |
1455 | lval->op = greater_than; | |
1456 | result = CMPOP2; | |
1457 | break; | |
1458 | ||
abbffdf9 | 1459 | case '*': |
4a4d50f3 UD |
1460 | lval->op = mult; |
1461 | result = MULOP2; | |
1462 | break; | |
1463 | ||
abbffdf9 | 1464 | case '/': |
4a4d50f3 UD |
1465 | lval->op = divide; |
1466 | result = MULOP2; | |
1467 | break; | |
1468 | ||
abbffdf9 | 1469 | case '%': |
4a4d50f3 UD |
1470 | lval->op = module; |
1471 | result = MULOP2; | |
1472 | break; | |
1473 | ||
abbffdf9 | 1474 | case '+': |
4a4d50f3 UD |
1475 | lval->op = plus; |
1476 | result = ADDOP2; | |
1477 | break; | |
1478 | ||
abbffdf9 | 1479 | case '-': |
4a4d50f3 UD |
1480 | lval->op = minus; |
1481 | result = ADDOP2; | |
1482 | break; | |
1483 | ||
1484 | case 'n': | |
abbffdf9 UD |
1485 | case '?': |
1486 | case ':': | |
1487 | case '(': | |
1488 | case ')': | |
1489 | /* Nothing, just return the character. */ | |
1490 | break; | |
1491 | ||
2f599545 | 1492 | case ';': |
abbffdf9 UD |
1493 | case '\n': |
1494 | case '\0': | |
1495 | /* Be safe and let the user call this function again. */ | |
1496 | --exp; | |
1497 | result = YYEOF; | |
1498 | break; | |
1499 | ||
1500 | default: | |
1501 | result = YYERRCODE; | |
1502 | #if YYDEBUG != 0 | |
1503 | --exp; | |
1504 | #endif | |
1505 | break; | |
1506 | } | |
1507 | ||
1508 | *pexp = exp; | |
1509 | ||
1510 | return result; | |
1511 | } | |
1512 | ||
1513 | ||
1514 | static void | |
4a4d50f3 UD |
1515 | yyerror (str) |
1516 | const char *str; | |
abbffdf9 UD |
1517 | { |
1518 | /* Do nothing. We don't print error messages here. */ | |
1519 | } |