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 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. */
42 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
43 #define YYPARSE_PARAM arg
47 unsigned long int num
;
48 struct expression
*exp
;
52 /* Prototypes for local functions. */
53 static struct expression
*new_exp (enum operator op
, ...);
54 static int yylex (YYSTYPE
*lval
, const char **pexp
);
55 static void yyerror (const char *str
);
70 #define YYTRANSLATE(x) ((unsigned)(x) <= 257 ? yytranslate[x] : 20)
72 static const char yytranslate
[] = { 0,
73 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
74 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
75 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
76 2, 2, 7, 2, 2, 2, 12, 5, 2, 16,
77 17, 10, 8, 2, 9, 2, 11, 2, 2, 2,
78 2, 2, 2, 2, 2, 2, 2, 14, 2, 2,
79 6, 2, 3, 2, 2, 2, 2, 2, 2, 2,
80 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
83 2, 2, 2, 2, 2, 2, 2, 2, 2, 15,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
85 2, 2, 2, 4, 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, 2,
88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
89 2, 2, 2, 2, 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,
102 static const short yyprhs
[] = { 0,
103 0, 2, 8, 12, 16, 20, 24, 28, 32, 36,
107 static const short yyrhs
[] = { 19,
108 0, 19, 3, 19, 14, 19, 0, 19, 4, 19,
109 0, 19, 5, 19, 0, 19, 6, 19, 0, 19,
110 7, 19, 0, 19, 8, 19, 0, 19, 9, 19,
111 0, 19, 10, 19, 0, 19, 11, 19, 0, 19,
112 12, 19, 0, 15, 0, 13, 0, 16, 19, 17,
119 static const short yyrline
[] = { 0,
120 55, 61, 66, 71, 76, 81, 86, 91, 96, 101,
126 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
128 static const char * const yytname
[] = { "$","error","$undefined.","'?'","'|'",
129 "'&'","'='","'!'","'+'","'-'","'*'","'/'","'%'","NUMBER","':'","'n'","'('","')'",
134 static const short yyr1
[] = { 0,
135 18, 19, 19, 19, 19, 19, 19, 19, 19, 19,
139 static const short yyr2
[] = { 0,
140 1, 5, 3, 3, 3, 3, 3, 3, 3, 3,
144 static const short yydefact
[] = { 0,
145 13, 12, 0, 1, 0, 0, 0, 0, 0, 0,
146 0, 0, 0, 0, 0, 14, 0, 3, 4, 5,
147 6, 7, 8, 9, 10, 11, 0, 2, 0, 0,
151 static const short yydefgoto
[] = { 29,
155 static const short yypact
[] = { 58,
156 -32768,-32768, 58, 37, 10, 58, 58, 58, 58, 58,
157 58, 58, 58, 58, 58,-32768, 25, 45, 52, 57,
158 57, 65, 65,-32768,-32768,-32768, 58, 37, 1, 2,
162 static const short yypgoto
[] = {-32768,
170 static const short yytable
[] = { 5,
171 30, 31, 17, 18, 19, 20, 21, 22, 23, 24,
172 25, 26, 6, 7, 8, 9, 10, 11, 12, 13,
173 14, 15, 0, 28, 0, 0, 16, 6, 7, 8,
174 9, 10, 11, 12, 13, 14, 15, 0, 27, 6,
175 7, 8, 9, 10, 11, 12, 13, 14, 15, 8,
176 9, 10, 11, 12, 13, 14, 15, 9, 10, 11,
177 12, 13, 14, 15, 11, 12, 13, 14, 15, 0,
178 1, 0, 2, 3, 13, 14, 15
181 static const short yycheck
[] = { 3,
182 0, 0, 6, 7, 8, 9, 10, 11, 12, 13,
183 14, 15, 3, 4, 5, 6, 7, 8, 9, 10,
184 11, 12, -1, 27, -1, -1, 17, 3, 4, 5,
185 6, 7, 8, 9, 10, 11, 12, -1, 14, 3,
186 4, 5, 6, 7, 8, 9, 10, 11, 12, 5,
187 6, 7, 8, 9, 10, 11, 12, 6, 7, 8,
188 9, 10, 11, 12, 8, 9, 10, 11, 12, -1,
189 13, -1, 15, 16, 10, 11, 12
193 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
194 #line 3 "/usr/share/bison.simple"
195 /* This file comes from bison-1.28. */
197 /* Skeleton output parser for bison,
198 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
200 This program is free software; you can redistribute it and/or modify
201 it under the terms of the GNU General Public License as published by
202 the Free Software Foundation; either version 2, or (at your option)
205 This program is distributed in the hope that it will be useful,
206 but WITHOUT ANY WARRANTY; without even the implied warranty of
207 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
208 GNU General Public License for more details.
210 You should have received a copy of the GNU General Public License
211 along with this program; if not, write to the Free Software
212 Foundation, Inc., 59 Temple Place - Suite 330,
213 Boston, MA 02111-1307, USA. */
215 /* As a special exception, when this file is copied by Bison into a
216 Bison output file, you may use that output file without restriction.
217 This special exception was added by the Free Software Foundation
218 in version 1.24 of Bison. */
220 /* This is the parser code that is written into each bison parser
221 when the %semantic_parser declaration is not specified in the grammar.
222 It was written by Richard Stallman by simplifying the hairy parser
223 used when %semantic_parser is specified. */
225 #ifndef YYSTACK_USE_ALLOCA
227 #define YYSTACK_USE_ALLOCA
228 #else /* alloca not defined */
230 #define YYSTACK_USE_ALLOCA
231 #define alloca __builtin_alloca
232 #else /* not GNU C. */
233 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
234 #define YYSTACK_USE_ALLOCA
236 #else /* not sparc */
237 /* We think this test detects Watcom and Microsoft C. */
238 /* This used to test MSDOS, but that is a bad idea
239 since that symbol is in the user namespace. */
240 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
241 #if 0 /* No need for malloc.h, which pollutes the namespace;
242 instead, just don't use alloca. */
245 #else /* not MSDOS, or __TURBOC__ */
247 /* I don't know what this was needed for, but it pollutes the namespace.
248 So I turned it off. rms, 2 May 1997. */
249 /* #include <malloc.h> */
251 #define YYSTACK_USE_ALLOCA
252 #else /* not MSDOS, or __TURBOC__, or _AIX */
254 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
255 and on HPUX 10. Eventually we can turn this on. */
256 #define YYSTACK_USE_ALLOCA
257 #define alloca __builtin_alloca
260 #endif /* not _AIX */
261 #endif /* not MSDOS, or __TURBOC__ */
262 #endif /* not sparc */
263 #endif /* not GNU C */
264 #endif /* alloca not defined */
265 #endif /* YYSTACK_USE_ALLOCA not defined */
267 #ifdef YYSTACK_USE_ALLOCA
268 #define YYSTACK_ALLOC alloca
270 #define YYSTACK_ALLOC malloc
273 /* Note: there must be only one dollar sign in this file.
274 It is replaced by the list of actions, each action
275 as one case of the switch. */
277 #define yyerrok (yyerrstatus = 0)
278 #define yyclearin (yychar = YYEMPTY)
281 #define YYACCEPT goto yyacceptlab
282 #define YYABORT goto yyabortlab
283 #define YYERROR goto yyerrlab1
284 /* Like YYERROR except do call yyerror.
285 This remains here temporarily to ease the
286 transition to the new meaning of YYERROR, for GCC.
287 Once GCC version 2 has supplanted version 1, this can go. */
288 #define YYFAIL goto yyerrlab
289 #define YYRECOVERING() (!!yyerrstatus)
290 #define YYBACKUP(token, value) \
292 if (yychar == YYEMPTY && yylen == 1) \
293 { yychar = (token), yylval = (value); \
294 yychar1 = YYTRANSLATE (yychar); \
299 { yyerror ("syntax error: cannot back up"); YYERROR; } \
303 #define YYERRCODE 256
306 #define YYLEX yylex()
312 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
314 #define YYLEX yylex(&yylval, &yylloc)
316 #else /* not YYLSP_NEEDED */
318 #define YYLEX yylex(&yylval, YYLEX_PARAM)
320 #define YYLEX yylex(&yylval)
322 #endif /* not YYLSP_NEEDED */
325 /* If nonreentrant, generate the variables here */
329 int yychar
; /* the lookahead symbol */
330 YYSTYPE yylval
; /* the semantic value of the */
331 /* lookahead symbol */
334 YYLTYPE yylloc
; /* location data for the lookahead */
338 int yynerrs
; /* number of parse errors so far */
339 #endif /* not YYPURE */
342 int yydebug
; /* nonzero means print parse trace */
343 /* Since this is uninitialized, it does not stop multiple parsers
347 /* YYINITDEPTH indicates the initial size of the parser's stacks */
350 #define YYINITDEPTH 200
353 /* YYMAXDEPTH is the maximum size the stacks can grow to
354 (effective only if the built-in stack extension method is used). */
361 #define YYMAXDEPTH 10000
364 /* Define __yy_memcpy. Note that the size argument
365 should be passed with type unsigned int, because that is what the non-GCC
366 definitions require. With GCC, __builtin_memcpy takes an arg
367 of type size_t, but it can handle unsigned int. */
369 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
370 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
371 #else /* not GNU C or C++ */
374 /* This is the most reliable way to avoid incompatibilities
375 in available built-in functions on various systems. */
377 __yy_memcpy (to
, from
, count
)
382 register char *f
= from
;
383 register char *t
= to
;
384 register int i
= count
;
390 #else /* __cplusplus */
392 /* This is the most reliable way to avoid incompatibilities
393 in available built-in functions on various systems. */
395 __yy_memcpy (char *to
, char *from
, unsigned int count
)
397 register char *t
= to
;
398 register char *f
= from
;
399 register int i
= count
;
408 #line 217 "/usr/share/bison.simple"
410 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
411 into yyparse. The argument should have type void *.
412 It should actually point to an object.
413 Grammar actions can access the variable by casting it
414 to the proper pointer type. */
418 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
419 #define YYPARSE_PARAM_DECL
420 #else /* not __cplusplus */
421 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
422 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
423 #endif /* not __cplusplus */
424 #else /* not YYPARSE_PARAM */
425 #define YYPARSE_PARAM_ARG
426 #define YYPARSE_PARAM_DECL
427 #endif /* not YYPARSE_PARAM */
429 /* Prevent warning if -Wstrict-prototypes. */
432 int yyparse (void *);
439 yyparse(YYPARSE_PARAM_ARG
)
442 register int yystate
;
444 register short *yyssp
;
445 register YYSTYPE
*yyvsp
;
446 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
447 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
449 short yyssa
[YYINITDEPTH
]; /* the state stack */
450 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
452 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
453 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
456 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
457 YYLTYPE
*yyls
= yylsa
;
460 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
462 #define YYPOPSTACK (yyvsp--, yyssp--)
465 int yystacksize
= YYINITDEPTH
;
466 int yyfree_stacks
= 0;
477 YYSTYPE yyval
; /* the variable used to return */
478 /* semantic values from the action */
485 fprintf(stderr
, "Starting parse\n");
491 yychar
= YYEMPTY
; /* Cause a token to be read. */
493 /* Initialize stack pointers.
494 Waste one element of value and location stack
495 so that they stay on the same level as the state stack.
496 The wasted elements are never initialized. */
504 /* Push a new state, which is found in yystate . */
505 /* In all cases, when you get here, the value and location stacks
506 have just been pushed. so pushing a state here evens the stacks. */
511 if (yyssp
>= yyss
+ yystacksize
- 1)
513 /* Give user a chance to reallocate the stack */
514 /* Use copies of these so that the &'s don't force the real ones into memory. */
515 YYSTYPE
*yyvs1
= yyvs
;
518 YYLTYPE
*yyls1
= yyls
;
521 /* Get the current used size of the three stacks, in elements. */
522 int size
= yyssp
- yyss
+ 1;
525 /* Each stack pointer address is followed by the size of
526 the data in use in that stack, in bytes. */
528 /* This used to be a conditional around just the two extra args,
529 but that might be undefined if yyoverflow is a macro. */
530 yyoverflow("parser stack overflow",
531 &yyss1
, size
* sizeof (*yyssp
),
532 &yyvs1
, size
* sizeof (*yyvsp
),
533 &yyls1
, size
* sizeof (*yylsp
),
536 yyoverflow("parser stack overflow",
537 &yyss1
, size
* sizeof (*yyssp
),
538 &yyvs1
, size
* sizeof (*yyvsp
),
542 yyss
= yyss1
; yyvs
= yyvs1
;
546 #else /* no yyoverflow */
547 /* Extend the stack our own way. */
548 if (yystacksize
>= YYMAXDEPTH
)
550 yyerror("parser stack overflow");
562 if (yystacksize
> YYMAXDEPTH
)
563 yystacksize
= YYMAXDEPTH
;
564 #ifndef YYSTACK_USE_ALLOCA
567 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
568 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
569 size
* (unsigned int) sizeof (*yyssp
));
570 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
571 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
572 size
* (unsigned int) sizeof (*yyvsp
));
574 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
575 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
576 size
* (unsigned int) sizeof (*yylsp
));
578 #endif /* no yyoverflow */
580 yyssp
= yyss
+ size
- 1;
581 yyvsp
= yyvs
+ size
- 1;
583 yylsp
= yyls
+ size
- 1;
588 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
591 if (yyssp
>= yyss
+ yystacksize
- 1)
597 fprintf(stderr
, "Entering state %d\n", yystate
);
603 /* Do appropriate processing given the current state. */
604 /* Read a lookahead token if we need one and don't already have one. */
607 /* First try to decide what to do without reference to lookahead token. */
609 yyn
= yypact
[yystate
];
613 /* Not known => get a lookahead token if don't already have one. */
615 /* yychar is either YYEMPTY or YYEOF
616 or a valid token in external form. */
618 if (yychar
== YYEMPTY
)
622 fprintf(stderr
, "Reading a token: ");
627 /* Convert token to internal form (in yychar1) for indexing tables with */
629 if (yychar
<= 0) /* This means end of input. */
632 yychar
= YYEOF
; /* Don't call YYLEX any more */
636 fprintf(stderr
, "Now at end of input.\n");
641 yychar1
= YYTRANSLATE(yychar
);
646 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
647 /* Give the individual parser a way to print the precise meaning
648 of a token, for further debugging info. */
650 YYPRINT (stderr
, yychar
, yylval
);
652 fprintf (stderr
, ")\n");
658 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
663 /* yyn is what to do for this token type in this state.
664 Negative => reduce, -yyn is rule number.
665 Positive => shift, yyn is new state.
666 New state is final state => don't bother to shift,
668 0, or most negative number => error. */
683 /* Shift the lookahead token. */
687 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
690 /* Discard the token being shifted unless it is eof. */
699 /* count tokens shifted since error; after three, turn off error status. */
700 if (yyerrstatus
) yyerrstatus
--;
705 /* Do the default action for the current state. */
708 yyn
= yydefact
[yystate
];
712 /* Do a reduction. yyn is the number of a rule to reduce with. */
716 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
723 fprintf (stderr
, "Reducing via rule %d (line %d), ",
726 /* Print the symbols being reduced, and their result. */
727 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
728 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
729 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
739 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
745 if ((yyval
.exp
= new_exp (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
752 if ((yyval
.exp
= new_exp (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
759 if ((yyval
.exp
= new_exp (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
766 if ((yyval
.exp
= new_exp (equal
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
773 if ((yyval
.exp
= new_exp (not_equal
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
780 if ((yyval
.exp
= new_exp (plus
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
787 if ((yyval
.exp
= new_exp (minus
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
794 if ((yyval
.exp
= new_exp (mult
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
801 if ((yyval
.exp
= new_exp (divide
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
808 if ((yyval
.exp
= new_exp (module
, yyvsp
[-2].exp
, yyvsp
[0].exp
, NULL
)) == NULL
)
815 if ((yyval
.exp
= new_exp (var
, NULL
)) == NULL
)
822 if ((yyval
.exp
= new_exp (num
, NULL
)) == NULL
)
824 yyval
.exp
->val
.num
= yyvsp
[0].num
830 yyval
.exp
= yyvsp
[-1].exp
834 /* the action file gets copied in in place of this dollarsign */
835 #line 543 "/usr/share/bison.simple"
846 short *ssp1
= yyss
- 1;
847 fprintf (stderr
, "state stack now");
848 while (ssp1
!= yyssp
)
849 fprintf (stderr
, " %d", *++ssp1
);
850 fprintf (stderr
, "\n");
860 yylsp
->first_line
= yylloc
.first_line
;
861 yylsp
->first_column
= yylloc
.first_column
;
862 yylsp
->last_line
= (yylsp
-1)->last_line
;
863 yylsp
->last_column
= (yylsp
-1)->last_column
;
868 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
869 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
873 /* Now "shift" the result of the reduction.
874 Determine what state that goes to,
875 based on the state we popped back to
876 and the rule number reduced by. */
880 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
881 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
882 yystate
= yytable
[yystate
];
884 yystate
= yydefgoto
[yyn
- YYNTBASE
];
888 yyerrlab
: /* here on detecting error */
891 /* If not already recovering from an error, report this error. */
895 #ifdef YYERROR_VERBOSE
896 yyn
= yypact
[yystate
];
898 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
905 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
906 for (x
= (yyn
< 0 ? -yyn
: 0);
907 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
908 if (yycheck
[x
+ yyn
] == x
)
909 size
+= strlen(yytname
[x
]) + 15, count
++;
910 msg
= (char *) malloc(size
+ 15);
913 strcpy(msg
, "parse error");
918 for (x
= (yyn
< 0 ? -yyn
: 0);
919 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
920 if (yycheck
[x
+ yyn
] == x
)
922 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
923 strcat(msg
, yytname
[x
]);
932 yyerror ("parse error; also virtual memory exceeded");
935 #endif /* YYERROR_VERBOSE */
936 yyerror("parse error");
940 yyerrlab1
: /* here on error raised explicitly by an action */
942 if (yyerrstatus
== 3)
944 /* if just tried and failed to reuse lookahead token after an error, discard it. */
946 /* return failure if at end of input */
952 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
958 /* Else will try to reuse lookahead token
959 after shifting the error token. */
961 yyerrstatus
= 3; /* Each real token shifted decrements this */
965 yyerrdefault
: /* current state does not do anything special for the error token. */
968 /* This is wrong; only states that explicitly want error tokens
969 should shift them. */
970 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
971 if (yyn
) goto yydefault
;
974 yyerrpop
: /* pop the current state because it cannot handle the error token */
976 if (yyssp
== yyss
) YYABORT
;
986 short *ssp1
= yyss
- 1;
987 fprintf (stderr
, "Error: state stack now");
988 while (ssp1
!= yyssp
)
989 fprintf (stderr
, " %d", *++ssp1
);
990 fprintf (stderr
, "\n");
996 yyn
= yypact
[yystate
];
1001 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1020 fprintf(stderr
, "Shifting error token, ");
1032 /* YYACCEPT comes here. */
1044 /* YYABORT comes here. */
1055 #line 128 "plural.y"
1058 static struct expression
*
1059 new_exp (enum operator op
, ...)
1061 struct expression
*newp
= (struct expression
*) malloc (sizeof (*newp
));
1063 struct expression
*next
;
1068 while ((next
= va_arg (va
, struct expression
*)) != NULL
)
1069 __gettext_free_exp (next
);
1072 newp
->operation
= op
;
1073 next
= va_arg (va
, struct expression
*);
1076 newp
->val
.args3
.bexp
= next
;
1077 next
= va_arg (va
, struct expression
*);
1080 newp
->val
.args3
.tbranch
= next
;
1081 next
= va_arg (va
, struct expression
*);
1083 newp
->val
.args3
.fbranch
= next
;
1095 __gettext_free_exp (struct expression
*exp
)
1100 /* Handle the recursive case. */
1101 switch (exp
->operation
)
1104 __gettext_free_exp (exp
->val
.args3
.fbranch
);
1116 __gettext_free_exp (exp
->val
.args2
.right
);
1117 __gettext_free_exp (exp
->val
.args2
.left
);
1129 yylex (YYSTYPE
*lval
, const char **pexp
)
1131 const char *exp
= *pexp
;
1136 if (exp
[0] == '\\' && exp
[1] == '\n')
1141 if (exp
[0] != '\0' && exp
[0] != ' ' && exp
[0] != '\t')
1152 unsigned long int n
= exp
[-1] - '0';
1153 while (exp
[0] >= '0' && exp
[0] <= '9')
1174 if (exp
[0] == result
)
1190 /* Nothing, just return the character. */
1195 /* Be safe and let the user call this function again. */
1215 yyerror (const char *str
)
1217 /* Do nothing. We don't print error messages here. */