1:
2:
3:
4: #define YYBISON 1
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
13: # define EQUOP2 257
14: # define CMPOP2 258
15: # define ADDOP2 259
16: # define MULOP2 260
17: # define NUMBER 261
18:
19: #line 1 "plural.y"
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45: #if defined _AIX && !defined __GNUC__
46: #pragma alloca
47: #endif
48: #ifdef HAVE_CONFIG_H
49: # include <config.h>
50: #endif
51:
52: #include <stddef.h>
53: #include <stdlib.h>
54: #include <string.h>
55: #include "plural-exp.h"
56:
57:
58:
59: #ifndef _LIBC
60: # define __gettextparse PLURAL_PARSE
61: #endif
62:
63: #define YYLEX_PARAM &((struct parse_args *) arg)->cp
64: #define YYPARSE_PARAM arg
65:
66: #line 49 "plural.y"
67: #ifndef YYSTYPE
68: typedef union {
69: unsigned long int num;
70: enum operator op;
71: struct expression *exp;
72: } yystype;
73: # define YYSTYPE yystype
74: # define YYSTYPE_IS_TRIVIAL 1
75: #endif
76: #line 55 "plural.y"
77:
78:
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:
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:
106: for (i = nargs - 1; i >= 0; i--)
107: if (args[i] == NULL)
108: goto fail;
109:
110:
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:
174: #ifndef YYDEBUG
175: # define YYDEBUG 0
176: #endif
177:
178:
179:
180: #define YYFINAL 27
181: #define YYFLAG -32768
182: #define YYNTBASE 16
183:
184:
185: #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
186:
187:
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
217: };
218:
219: #if YYDEBUG
220: static const short yyprhs[] =
221: {
222: 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
223: 35, 37, 39
224: };
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
232: };
233:
234: #endif
235:
236: #if YYDEBUG
237:
238: static const short yyrline[] =
239: {
240: 0, 174, 182, 186, 190, 194, 198, 202, 206, 210,
241: 214, 218, 223
242: };
243: #endif
244:
245:
246: #if (YYDEBUG) || defined YYERROR_VERBOSE
247:
248:
249: static const char *const yytname[] =
250: {
251: "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
252: "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
253: "start", "exp", 0
254: };
255: #endif
256:
257:
258: static const short yyr1[] =
259: {
260: 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
261: 17, 17, 17
262: };
263:
264:
265: static const short yyr2[] =
266: {
267: 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
268: 1, 1, 3
269: };
270:
271:
272:
273:
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
279: };
280:
281: static const short yydefgoto[] =
282: {
283: 25, 5
284: };
285:
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
291: };
292:
293: static const short yypgoto[] =
294: {
295: -32768, -1
296: };
297:
298:
299: #define YYLAST 53
300:
301:
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
310: };
311:
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
320: };
321: #define YYPURE 1
322:
323:
324: #line 3 "/castro/street/H-alpha-linux/share/bison/bison.simple"
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363: #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
364:
365:
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:
383: # define YYSTACK_FREE(Ptr) do { ; } while (0)
384: # else
385: # if defined (__STDC__) || defined (__cplusplus)
386: # include <stdlib.h>
387: # define YYSIZE_T size_t
388: # endif
389: # define YYSTACK_ALLOC malloc
390: # define YYSTACK_FREE free
391: # endif
392: #endif
393:
394:
395: #if (! defined (yyoverflow) \
396: && (! defined (__cplusplus) \
397: || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
398:
399:
400: union yyalloc
401: {
402: short yyss;
403: YYSTYPE yyvs;
404: # if YYLSP_NEEDED
405: YYLTYPE yyls;
406: # endif
407: };
408:
409:
410: # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
411:
412:
413:
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:
425:
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:
443:
444:
445:
446:
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)
457:
458: #endif
459:
460:
461: #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
462: # define YYSIZE_T __SIZE_TYPE__
463: #endif
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>
470: # define YYSIZE_T size_t
471: # endif
472: #endif
473: #if ! defined (YYSIZE_T)
474: # define YYSIZE_T unsigned int
475: #endif
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
484:
485:
486:
487: #define YYFAIL goto yyerrlab
488: #define YYRECOVERING() (!!yyerrstatus)
489: #define YYBACKUP(Token, Value) \
490: do \
491: if (yychar == YYEMPTY && yylen == 1) \
492: { \
493: yychar = (Token); \
494: yylval = (Value); \
495: yychar1 = YYTRANSLATE (yychar); \
496: YYPOPSTACK; \
497: goto yybackup; \
498: } \
499: else \
500: { \
501: yyerror ("syntax error: cannot back up"); \
502: YYERROR; \
503: <