2 /* A Bison parser, made from plural.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse __gettextparse
8 #define yylex __gettextlex
9 #define yyerror __gettexterror
10 #define yylval __gettextlval
11 #define yychar __gettextchar
12 #define yydebug __gettextdebug
13 #define yynerrs __gettextnerrs
18 /* Expression parsing for plural form selection.
19 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
20 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
22 The GNU C Library is free software; you can redistribute it and/or
23 modify it under the terms of the GNU Library General Public License as
24 published by the Free Software Foundation; either version 2 of the
25 License, or (at your option) any later version.
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Library General Public License for more details.
32 You should have received a copy of the GNU Library General Public
33 License along with the GNU C Library; see the file COPYING.LIB. If not,
34 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
35 Boston, MA 02111-1307, USA. */
46 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
47 #define YYPARSE_PARAM arg
51 unsigned long int num
;
52 struct expression
*exp
;
56 /* Prototypes for local functions. */
57 static struct expression
*new_exp (enum operator op
, int n
, ...);
58 static int yylex (YYSTYPE
*lval
, const char **pexp
);
59 static void yyerror (const char *str
);
74 #define YYTRANSLATE(x) ((unsigned)(x) <= 257 ? yytranslate[x] : 20)
76 static const char yytranslate
[] = { 0,
77 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
79 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
80 2, 2, 7, 2, 2, 2, 12, 5, 2, 16,
81 17, 10, 8, 2, 9, 2, 11, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 14, 2, 2,
83 6, 2, 3, 2, 2, 2, 2, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
85 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
86 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
87 2, 2, 2, 2, 2, 2, 2, 2, 2, 15,
88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
89 2, 2, 2, 4, 2, 2, 2, 2, 2, 2,
90 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
91 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
94 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
95 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
96 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
97 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
98 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 static const short yyprhs
[] = { 0,
107 0, 2, 8, 12, 16, 20, 24, 28, 32, 36,
111 static const short yyrhs
[] = { 19,
112 0, 19, 3, 19, 14, 19, 0, 19, 4, 19,
113 0, 19, 5, 19, 0, 19, 6, 19, 0, 19,
114 7, 19, 0, 19, 8, 19, 0, 19, 9, 19,
115 0, 19, 10, 19, 0, 19, 11, 19, 0, 19,
116 12, 19, 0, 15, 0, 13, 0, 16, 19, 17,
123 static const short yyrline
[] = { 0,
124 59, 65, 70, 75, 80, 85, 90, 95, 100, 105,
130 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
132 static const char * const yytname
[] = { "$","error","$undefined.","'?'","'|'",
133 "'&'","'='","'!'","'+'","'-'","'*'","'/'","'%'","NUMBER","':'","'n'","'('","')'",
138 static const short yyr1
[] = { 0,
139 18, 19, 19, 19, 19, 19, 19, 19, 19, 19,
143 static const short yyr2
[] = { 0,
144 1, 5, 3, 3, 3, 3, 3, 3, 3, 3,
148 static const short yydefact
[] = { 0,
149 13, 12, 0, 1, 0, 0, 0, 0, 0, 0,
150 0, 0, 0, 0, 0, 14, 0, 3, 4, 5,
151 6, 7, 8, 9, 10, 11, 0, 2, 0, 0,
155 static const short yydefgoto
[] = { 29,
159 static const short yypact
[] = { 58,
160 -32768,-32768, 58, 37, 10, 58, 58, 58, 58, 58,
161 58, 58, 58, 58, 58,-32768, 25, 45, 52, 57,
162 57, 65, 65,-32768,-32768,-32768, 58, 37, 1, 2,
166 static const short yypgoto
[] = {-32768,
174 static const short yytable
[] = { 5,
175 30, 31, 17, 18, 19, 20, 21, 22, 23, 24,
176 25, 26, 6, 7, 8, 9, 10, 11, 12, 13,
177 14, 15, 0, 28, 0, 0, 16, 6, 7, 8,
178 9, 10, 11, 12, 13, 14, 15, 0, 27, 6,
179 7, 8, 9, 10, 11, 12, 13, 14, 15, 8,
180 9, 10, 11, 12, 13, 14, 15, 9, 10, 11,
181 12, 13, 14, 15, 11, 12, 13, 14, 15, 0,
182 1, 0, 2, 3, 13, 14, 15
185 static const short yycheck
[] = { 3,
186 0, 0, 6, 7, 8, 9, 10, 11, 12, 13,
187 14, 15, 3, 4, 5, 6, 7, 8, 9, 10,
188 11, 12, -1, 27, -1, -1, 17, 3, 4, 5,
189 6, 7, 8, 9, 10, 11, 12, -1, 14, 3,
190 4, 5, 6, 7, 8, 9, 10, 11, 12, 5,
191 6, 7, 8, 9, 10, 11, 12, 6, 7, 8,
192 9, 10, 11, 12, 8, 9, 10, 11, 12, -1,
193 13, -1, 15, 16, 10, 11, 12
197 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
198 #line 3 "/usr/lib/bison.simple"
199 /* This file comes from bison-1.28. */
201 /* Skeleton output parser for bison,
202 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
204 This program is free software; you can redistribute it and/or modify
205 it under the terms of the GNU General Public License as published by
206 the Free Software Foundation; either version 2, or (at your option)
209 This program is distributed in the hope that it will be useful,
210 but WITHOUT ANY WARRANTY; without even the implied warranty of
211 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
212 GNU General Public License for more details.
214 You should have received a copy of the GNU General Public License
215 along with this program; if not, write to the Free Software
216 Foundation, Inc., 59 Temple Place - Suite 330,
217 Boston, MA 02111-1307, USA. */
219 /* As a special exception, when this file is copied by Bison into a
220 Bison output file, you may use that output file without restriction.
221 This special exception was added by the Free Software Foundation
222 in version 1.24 of Bison. */
224 /* This is the parser code that is written into each bison parser
225 when the %semantic_parser declaration is not specified in the grammar.
226 It was written by Richard Stallman by simplifying the hairy parser
227 used when %semantic_parser is specified. */
229 #ifndef YYSTACK_USE_ALLOCA
231 #define YYSTACK_USE_ALLOCA
232 #else /* alloca not defined */
234 #define YYSTACK_USE_ALLOCA
235 #define alloca __builtin_alloca
236 #else /* not GNU C. */
237 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
238 #define YYSTACK_USE_ALLOCA
240 #else /* not sparc */
241 /* We think this test detects Watcom and Microsoft C. */
242 /* This used to test MSDOS, but that is a bad idea
243 since that symbol is in the user namespace. */
244 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
245 #if 0 /* No need for malloc.h, which pollutes the namespace;
246 instead, just don't use alloca. */
249 #else /* not MSDOS, or __TURBOC__ */
251 /* I don't know what this was needed for, but it pollutes the namespace.
252 So I turned it off. rms, 2 May 1997. */
253 /* #include <malloc.h> */
255 #define YYSTACK_USE_ALLOCA
256 #else /* not MSDOS, or __TURBOC__, or _AIX */
258 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
259 and on HPUX 10. Eventually we can turn this on. */
260 #define YYSTACK_USE_ALLOCA
261 #define alloca __builtin_alloca
264 #endif /* not _AIX */
265 #endif /* not MSDOS, or __TURBOC__ */
266 #endif /* not sparc */
267 #endif /* not GNU C */
268 #endif /* alloca not defined */
269 #endif /* YYSTACK_USE_ALLOCA not defined */
271 #ifdef YYSTACK_USE_ALLOCA
272 #define YYSTACK_ALLOC alloca
274 #define YYSTACK_ALLOC malloc
277 /* Note: there must be only one dollar sign in this file.
278 It is replaced by the list of actions, each action
279 as one case of the switch. */
281 #define yyerrok (yyerrstatus = 0)
282 #define yyclearin (yychar = YYEMPTY)
285 #define YYACCEPT goto yyacceptlab
286 #define YYABORT goto yyabortlab
287 #define YYERROR goto yyerrlab1
288 /* Like YYERROR except do call yyerror.
289 This remains here temporarily to ease the
290 transition to the new meaning of YYERROR, for GCC.
291 Once GCC version 2 has supplanted version 1, this can go. */
292 #define YYFAIL goto yyerrlab
293 #define YYRECOVERING() (!!yyerrstatus)
294 #define YYBACKUP(token, value) \
296 if (yychar == YYEMPTY && yylen == 1) \
297 { yychar = (token), yylval = (value); \
298 yychar1 = YYTRANSLATE (yychar); \
303 { yyerror ("syntax error: cannot back up"); YYERROR; } \
307 #define YYERRCODE 256
310 #define YYLEX yylex()
316 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
318 #define YYLEX yylex(&yylval, &yylloc)
320 #else /* not YYLSP_NEEDED */
322 #define YYLEX yylex(&yylval, YYLEX_PARAM)
324 #define YYLEX yylex(&yylval)
326 #endif /* not YYLSP_NEEDED */
329 /* If nonreentrant, generate the variables here */
333 int yychar
; /* the lookahead symbol */
334 YYSTYPE yylval
; /* the semantic value of the */
335 /* lookahead symbol */
338 YYLTYPE yylloc
; /* location data for the lookahead */
342 int yynerrs
; /* number of parse errors so far */
343 #endif /* not YYPURE */
346 int yydebug
; /* nonzero means print parse trace */
347 /* Since this is uninitialized, it does not stop multiple parsers
351 /* YYINITDEPTH indicates the initial size of the parser's stacks */
354 #define YYINITDEPTH 200
357 /* YYMAXDEPTH is the maximum size the stacks can grow to
358 (effective only if the built-in stack extension method is used). */
365 #define YYMAXDEPTH 10000
368 /* Define __yy_memcpy. Note that the size argument
369 should be passed with type unsigned int, because that is what the non-GCC
370 definitions require. With GCC, __builtin_memcpy takes an arg
371 of type size_t, but it can handle unsigned int. */
373 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
374 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
375 #else /* not GNU C or C++ */
378 /* This is the most reliable way to avoid incompatibilities
379 in available built-in functions on various systems. */
381 __yy_memcpy (to
, from
, count
)
386 register char *f
= from
;
387 register char *t
= to
;
388 register int i
= count
;
394 #else /* __cplusplus */
396 /* This is the most reliable way to avoid incompatibilities
397 in available built-in functions on various systems. */
399 __yy_memcpy (char *to
, char *from
, unsigned int count
)
401 register char *t
= to
;
402 register char *f
= from
;
403 register int i
= count
;
412 #line 217 "/usr/lib/bison.simple"
414 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
415 into yyparse. The argument should have type void *.
416 It should actually point to an object.
417 Grammar actions can access the variable by casting it
418 to the proper pointer type. */
422 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
423 #define YYPARSE_PARAM_DECL
424 #else /* not __cplusplus */
425 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
426 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
427 #endif /* not __cplusplus */
428 #else /* not YYPARSE_PARAM */
429 #define YYPARSE_PARAM_ARG
430 #define YYPARSE_PARAM_DECL
431 #endif /* not YYPARSE_PARAM */
433 /* Prevent warning if -Wstrict-prototypes. */
436 int yyparse (void *);
443 yyparse(YYPARSE_PARAM_ARG
)
446 register int yystate
;
448 register short *yyssp
;
449 register YYSTYPE
*yyvsp
;
450 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
451 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
453 short yyssa
[YYINITDEPTH
]; /* the state stack */
454 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
456 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
457 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
460 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
461 YYLTYPE
*yyls
= yylsa
;
464 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
466 #define YYPOPSTACK (yyvsp--, yyssp--)
469 int yystacksize
= YYINITDEPTH
;
470 int yyfree_stacks
= 0;
481 YYSTYPE yyval
; /* the variable used to return */
482 /* semantic values from the action */
489 fprintf(stderr
, "Starting parse\n");
495 yychar
= YYEMPTY
; /* Cause a token to be read. */
497 /* Initialize stack pointers.
498 Waste one element of value and location stack
499 so that they stay on the same level as the state stack.
500 The wasted elements are never initialized. */
508 /* Push a new state, which is found in yystate . */
509 /* In all cases, when you get here, the value and location stacks
510 have just been pushed. so pushing a state here evens the stacks. */
515 if (yyssp
>= yyss
+ yystacksize
- 1)
517 /* Give user a chance to reallocate the stack */
518 /* Use copies of these so that the &'s don't force the real ones into memory. */
519 YYSTYPE
*yyvs1
= yyvs
;
522 YYLTYPE
*yyls1
= yyls
;
525 /* Get the current used size of the three stacks, in elements. */
526 int size
= yyssp
- yyss
+ 1;
529 /* Each stack pointer address is followed by the size of
530 the data in use in that stack, in bytes. */
532 /* This used to be a conditional around just the two extra args,
533 but that might be undefined if yyoverflow is a macro. */
534 yyoverflow("parser stack overflow",
535 &yyss1
, size
* sizeof (*yyssp
),
536 &yyvs1
, size
* sizeof (*yyvsp
),
537 &yyls1
, size
* sizeof (*yylsp
),
540 yyoverflow("parser stack overflow",
541 &yyss1
, size
* sizeof (*yyssp
),
542 &yyvs1
, size
* sizeof (*yyvsp
),
546 yyss
= yyss1
; yyvs
= yyvs1
;
550 #else /* no yyoverflow */
551 /* Extend the stack our own way. */
552 if (yystacksize
>= YYMAXDEPTH
)
554 yyerror("parser stack overflow");
566 if (yystacksize
> YYMAXDEPTH
)
567 yystacksize
= YYMAXDEPTH
;
568 #ifndef YYSTACK_USE_ALLOCA
571 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
572 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
573 size
* (unsigned int) sizeof (*yyssp
));
574 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
575 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
576 size
* (unsigned int) sizeof (*yyvsp
));
578 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
579 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
580 size
* (unsigned int) sizeof (*yylsp
));
582 #endif /* no yyoverflow */
584 yyssp
= yyss
+ size
- 1;
585 yyvsp
= yyvs
+ size
- 1;
587 yylsp
= yyls
+ size
- 1;
592 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
595 if (yyssp
>= yyss
+ yystacksize
- 1)
601 fprintf(stderr
, "Entering state %d\n", yystate
);
607 /* Do appropriate processing given the current state. */
608 /* Read a lookahead token if we need one and don't already have one. */
611 /* First try to decide what to do without reference to lookahead token. */
613 yyn
= yypact
[yystate
];
617 /* Not known => get a lookahead token if don't already have one. */
619 /* yychar is either YYEMPTY or YYEOF
620 or a valid token in external form. */
622 if (yychar
== YYEMPTY
)
626 fprintf(stderr
, "Reading a token: ");
631 /* Convert token to internal form (in yychar1) for indexing tables with */
633 if (yychar
<= 0) /* This means end of input. */
636 yychar
= YYEOF
; /* Don't call YYLEX any more */
640 fprintf(stderr
, "Now at end of input.\n");
645 yychar1
= YYTRANSLATE(yychar
);
650 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
651 /* Give the individual parser a way to print the precise meaning
652 of a token, for further debugging info. */
654 YYPRINT (stderr
, yychar
, yylval
);
656 fprintf (stderr
, ")\n");
662 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
667 /* yyn is what to do for this token type in this state.
668 Negative => reduce, -yyn is rule number.
669 Positive => shift, yyn is new state.
670 New state is final state => don't bother to shift,
672 0, or most negative number => error. */
687 /* Shift the lookahead token. */
691 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
694 /* Discard the token being shifted unless it is eof. */
703 /* count tokens shifted since error; after three, turn off error status. */
704 if (yyerrstatus
) yyerrstatus
--;
709 /* Do the default action for the current state. */
712 yyn
= yydefact
[yystate
];
716 /* Do a reduction. yyn is the number of a rule to reduce with. */
720 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
727 fprintf (stderr
, "Reducing via rule %d (line %d), ",
730 /* Print the symbols being reduced, and their result. */
731 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
732 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
733 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
743 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
749 if ((yyval
.exp
= new_exp (qmop
, 3, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
756 if ((yyval
.exp
= new_exp (lor
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
763 if ((yyval
.exp
= new_exp (land
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
770 if ((yyval
.exp
= new_exp (equal
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
777 if ((yyval
.exp
= new_exp (not_equal
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
784 if ((yyval
.exp
= new_exp (plus
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
791 if ((yyval
.exp
= new_exp (minus
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
798 if ((yyval
.exp
= new_exp (mult
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
805 if ((yyval
.exp
= new_exp (divide
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
812 if ((yyval
.exp
= new_exp (module
, 2, yyvsp
[-2].exp
, yyvsp
[0].exp
)) == NULL
)
819 if ((yyval
.exp
= new_exp (var
, 0)) == NULL
)
826 if ((yyval
.exp
= new_exp (num
, 0)) == NULL
)
828 yyval
.exp
->val
.num
= yyvsp
[0].num
834 yyval
.exp
= yyvsp
[-1].exp
838 /* the action file gets copied in in place of this dollarsign */
839 #line 543 "/usr/lib/bison.simple"
850 short *ssp1
= yyss
- 1;
851 fprintf (stderr
, "state stack now");
852 while (ssp1
!= yyssp
)
853 fprintf (stderr
, " %d", *++ssp1
);
854 fprintf (stderr
, "\n");
864 yylsp
->first_line
= yylloc
.first_line
;
865 yylsp
->first_column
= yylloc
.first_column
;
866 yylsp
->last_line
= (yylsp
-1)->last_line
;
867 yylsp
->last_column
= (yylsp
-1)->last_column
;
872 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
873 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
877 /* Now "shift" the result of the reduction.
878 Determine what state that goes to,
879 based on the state we popped back to
880 and the rule number reduced by. */
884 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
885 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
886 yystate
= yytable
[yystate
];
888 yystate
= yydefgoto
[yyn
- YYNTBASE
];
892 yyerrlab
: /* here on detecting error */
895 /* If not already recovering from an error, report this error. */
899 #ifdef YYERROR_VERBOSE
900 yyn
= yypact
[yystate
];
902 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
909 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
910 for (x
= (yyn
< 0 ? -yyn
: 0);
911 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
912 if (yycheck
[x
+ yyn
] == x
)
913 size
+= strlen(yytname
[x
]) + 15, count
++;
914 msg
= (char *) malloc(size
+ 15);
917 strcpy(msg
, "parse error");
922 for (x
= (yyn
< 0 ? -yyn
: 0);
923 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
924 if (yycheck
[x
+ yyn
] == x
)
926 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
927 strcat(msg
, yytname
[x
]);
936 yyerror ("parse error; also virtual memory exceeded");
939 #endif /* YYERROR_VERBOSE */
940 yyerror("parse error");
944 yyerrlab1
: /* here on error raised explicitly by an action */
946 if (yyerrstatus
== 3)
948 /* if just tried and failed to reuse lookahead token after an error, discard it. */
950 /* return failure if at end of input */
956 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
962 /* Else will try to reuse lookahead token
963 after shifting the error token. */
965 yyerrstatus
= 3; /* Each real token shifted decrements this */
969 yyerrdefault
: /* current state does not do anything special for the error token. */
972 /* This is wrong; only states that explicitly want error tokens
973 should shift them. */
974 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
975 if (yyn
) goto yydefault
;
978 yyerrpop
: /* pop the current state because it cannot handle the error token */
980 if (yyssp
== yyss
) YYABORT
;
990 short *ssp1
= yyss
- 1;
991 fprintf (stderr
, "Error: state stack now");
992 while (ssp1
!= yyssp
)
993 fprintf (stderr
, " %d", *++ssp1
);
994 fprintf (stderr
, "\n");
1000 yyn
= yypact
[yystate
];
1005 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1024 fprintf(stderr
, "Shifting error token, ");
1036 /* YYACCEPT comes here. */
1048 /* YYABORT comes here. */
1059 #line 132 "plural.y"
1062 static struct expression
*
1063 new_exp (enum operator op
, int n
, ...)
1065 struct expression
*newp
= (struct expression
*) calloc (1, sizeof (*newp
));
1072 __gettext_free_exp (va_arg (va
, struct expression
*));
1075 newp
->operation
= op
;
1078 newp
->val
.args3
.bexp
= va_arg (va
, struct expression
*);
1079 newp
->val
.args3
.tbranch
= va_arg (va
, struct expression
*);
1082 newp
->val
.args3
.fbranch
= va_arg (va
, struct expression
*);
1084 if (newp
->val
.args3
.bexp
== NULL
1085 || newp
->val
.args3
.tbranch
== NULL
1086 || (n
> 2 && newp
->val
.args3
.fbranch
== NULL
))
1088 __gettext_free_exp (newp
);
1101 __gettext_free_exp (struct expression
*exp
)
1106 /* Handle the recursive case. */
1107 switch (exp
->operation
)
1110 __gettext_free_exp (exp
->val
.args3
.fbranch
);
1122 __gettext_free_exp (exp
->val
.args2
.right
);
1123 __gettext_free_exp (exp
->val
.args2
.left
);
1135 yylex (YYSTYPE
*lval
, const char **pexp
)
1137 const char *exp
= *pexp
;
1142 if (exp
[0] == '\\' && exp
[1] == '\n')
1154 if (exp
[0] != ' ' && exp
[0] != '\t')
1163 case '0': case '1': case '2': case '3': case '4':
1164 case '5': case '6': case '7': case '8': case '9':
1166 unsigned long int n
= result
- '0';
1167 while (exp
[0] >= '0' && exp
[0] <= '9')
1188 if (exp
[0] == result
)
1204 /* Nothing, just return the character. */
1210 /* Be safe and let the user call this function again. */
1230 yyerror (const char *str
)
1232 /* Do nothing. We don't print error messages here. */