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
22 /* Expression parsing for plural form selection.
23 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
24 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
26 This program is free software; you can redistribute it and/or modify it
27 under the terms of the GNU Library General Public License as published
28 by the Free Software Foundation; either version 2, or (at your option)
31 This program 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
34 Library General Public License for more details.
36 You should have received a copy of the GNU Library General Public
37 License along with this program; if not, write to the Free Software
38 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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__
55 #include "plural-exp.h"
57 /* The main function generated by the parser is called __gettextparse,
58 but we want it to be called PLURAL_PARSE. */
60 # define __gettextparse PLURAL_PARSE
63 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
64 #define YYPARSE_PARAM arg
68 unsigned long int num
;
70 struct expression
*exp
;
74 /* Prototypes for local functions. */
75 static struct expression
*new_exp
PARAMS ((int nargs
, enum operator op
,
76 struct expression
* const *args
));
77 static inline struct expression
*new_exp_0
PARAMS ((enum operator op
));
78 static inline struct expression
*new_exp_1
PARAMS ((enum operator op
,
79 struct expression
*right
));
80 static struct expression
*new_exp_2
PARAMS ((enum operator op
,
81 struct expression
*left
,
82 struct expression
*right
));
83 static inline struct expression
*new_exp_3
PARAMS ((enum operator op
,
84 struct expression
*bexp
,
85 struct expression
*tbranch
,
86 struct expression
*fbranch
));
87 static int yylex
PARAMS ((YYSTYPE
*lval
, const char **pexp
));
88 static void yyerror
PARAMS ((const char *str
));
90 /* Allocation of expressions. */
92 static struct expression
*
93 new_exp (nargs
, op
, args
)
96 struct expression
* const *args
;
99 struct expression
*newp
;
101 /* If any of the argument could not be malloc'ed, just return NULL. */
102 for (i
= nargs
- 1; i
>= 0; i
--)
106 /* Allocate a new expression. */
107 newp
= (struct expression
*) malloc (sizeof (*newp
));
111 newp
->operation
= op
;
112 for (i
= nargs
- 1; i
>= 0; i
--)
113 newp
->val
.args
[i
] = args
[i
];
118 for (i
= nargs
- 1; i
>= 0; i
--)
119 FREE_EXPRESSION (args
[i
]);
124 static inline struct expression
*
128 return new_exp (0, op
, NULL
);
131 static inline struct expression
*
132 new_exp_1 (op
, right
)
134 struct expression
*right
;
136 struct expression
*args
[1];
139 return new_exp (1, op
, args
);
142 static struct expression
*
143 new_exp_2 (op
, left
, right
)
145 struct expression
*left
;
146 struct expression
*right
;
148 struct expression
*args
[2];
152 return new_exp (2, op
, args
);
155 static inline struct expression
*
156 new_exp_3 (op
, bexp
, tbranch
, fbranch
)
158 struct expression
*bexp
;
159 struct expression
*tbranch
;
160 struct expression
*fbranch
;
162 struct expression
*args
[3];
167 return new_exp (3, op
, args
);
181 #define YYFLAG -32768
184 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
186 static const char yytranslate
[] = { 0,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 10, 2, 2, 2, 2, 5, 2, 14,
191 15, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 2, 2, 2, 2, 12, 2, 2,
193 2, 2, 3, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 13,
198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
199 2, 2, 2, 4, 2, 2, 2, 2, 2, 2,
200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 2, 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, 1, 6, 7, 8, 9,
217 static const short yyprhs
[] = { 0,
218 0, 2, 8, 12, 16, 20, 24, 28, 32, 35,
222 static const short yyrhs
[] = { 17,
223 0, 17, 3, 17, 12, 17, 0, 17, 4, 17,
224 0, 17, 5, 17, 0, 17, 6, 17, 0, 17,
225 7, 17, 0, 17, 8, 17, 0, 17, 9, 17,
226 0, 10, 17, 0, 13, 0, 11, 0, 14, 17,
233 static const short yyrline
[] = { 0,
234 174, 182, 186, 190, 194, 198, 202, 206, 210, 214,
240 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
242 static const char * const yytname
[] = { "$","error","$undefined.","'?'","'|'",
243 "'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'",
248 static const short yyr1
[] = { 0,
249 16, 17, 17, 17, 17, 17, 17, 17, 17, 17,
253 static const short yyr2
[] = { 0,
254 1, 5, 3, 3, 3, 3, 3, 3, 2, 1,
258 static const short yydefact
[] = { 0,
259 0, 11, 10, 0, 1, 9, 0, 0, 0, 0,
260 0, 0, 0, 0, 12, 0, 3, 4, 5, 6,
264 static const short yydefgoto
[] = { 25,
268 static const short yypact
[] = { -9,
269 -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9,
270 -9, -9, -9, -9,-32768, 24, 39, 43, 16, 26,
271 -3,-32768, -9, 34, 21, 53,-32768
274 static const short yypgoto
[] = {-32768,
282 static const short yytable
[] = { 6,
283 1, 2, 7, 3, 4, 14, 16, 17, 18, 19,
284 20, 21, 22, 8, 9, 10, 11, 12, 13, 14,
285 26, 24, 12, 13, 14, 15, 8, 9, 10, 11,
286 12, 13, 14, 13, 14, 23, 8, 9, 10, 11,
287 12, 13, 14, 10, 11, 12, 13, 14, 11, 12,
291 static const short yycheck
[] = { 1,
292 10, 11, 4, 13, 14, 9, 8, 9, 10, 11,
293 12, 13, 14, 3, 4, 5, 6, 7, 8, 9,
294 0, 23, 7, 8, 9, 15, 3, 4, 5, 6,
295 7, 8, 9, 8, 9, 12, 3, 4, 5, 6,
296 7, 8, 9, 5, 6, 7, 8, 9, 6, 7,
301 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
302 #line 3 "/usr/local/share/bison.simple"
303 /* This file comes from bison-1.28. */
305 /* Skeleton output parser for bison,
306 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
308 This program is free software; you can redistribute it and/or modify
309 it under the terms of the GNU General Public License as published by
310 the Free Software Foundation; either version 2, or (at your option)
313 This program is distributed in the hope that it will be useful,
314 but WITHOUT ANY WARRANTY; without even the implied warranty of
315 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
316 GNU General Public License for more details.
318 You should have received a copy of the GNU General Public License
319 along with this program; if not, write to the Free Software
320 Foundation, Inc., 59 Temple Place - Suite 330,
321 Boston, MA 02111-1307, USA. */
323 /* As a special exception, when this file is copied by Bison into a
324 Bison output file, you may use that output file without restriction.
325 This special exception was added by the Free Software Foundation
326 in version 1.24 of Bison. */
328 /* This is the parser code that is written into each bison parser
329 when the %semantic_parser declaration is not specified in the grammar.
330 It was written by Richard Stallman by simplifying the hairy parser
331 used when %semantic_parser is specified. */
333 #ifndef YYSTACK_USE_ALLOCA
335 #define YYSTACK_USE_ALLOCA
336 #else /* alloca not defined */
338 #define YYSTACK_USE_ALLOCA
339 #define alloca __builtin_alloca
340 #else /* not GNU C. */
341 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
342 #define YYSTACK_USE_ALLOCA
344 #else /* not sparc */
345 /* We think this test detects Watcom and Microsoft C. */
346 /* This used to test MSDOS, but that is a bad idea
347 since that symbol is in the user namespace. */
348 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
349 #if 0 /* No need for malloc.h, which pollutes the namespace;
350 instead, just don't use alloca. */
353 #else /* not MSDOS, or __TURBOC__ */
355 /* I don't know what this was needed for, but it pollutes the namespace.
356 So I turned it off. rms, 2 May 1997. */
357 /* #include <malloc.h> */
359 #define YYSTACK_USE_ALLOCA
360 #else /* not MSDOS, or __TURBOC__, or _AIX */
362 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
363 and on HPUX 10. Eventually we can turn this on. */
364 #define YYSTACK_USE_ALLOCA
365 #define alloca __builtin_alloca
368 #endif /* not _AIX */
369 #endif /* not MSDOS, or __TURBOC__ */
370 #endif /* not sparc */
371 #endif /* not GNU C */
372 #endif /* alloca not defined */
373 #endif /* YYSTACK_USE_ALLOCA not defined */
375 #ifdef YYSTACK_USE_ALLOCA
376 #define YYSTACK_ALLOC alloca
378 #define YYSTACK_ALLOC malloc
381 /* Note: there must be only one dollar sign in this file.
382 It is replaced by the list of actions, each action
383 as one case of the switch. */
385 #define yyerrok (yyerrstatus = 0)
386 #define yyclearin (yychar = YYEMPTY)
389 #define YYACCEPT goto yyacceptlab
390 #define YYABORT goto yyabortlab
391 #define YYERROR goto yyerrlab1
392 /* Like YYERROR except do call yyerror.
393 This remains here temporarily to ease the
394 transition to the new meaning of YYERROR, for GCC.
395 Once GCC version 2 has supplanted version 1, this can go. */
396 #define YYFAIL goto yyerrlab
397 #define YYRECOVERING() (!!yyerrstatus)
398 #define YYBACKUP(token, value) \
400 if (yychar == YYEMPTY && yylen == 1) \
401 { yychar = (token), yylval = (value); \
402 yychar1 = YYTRANSLATE (yychar); \
407 { yyerror ("syntax error: cannot back up"); YYERROR; } \
411 #define YYERRCODE 256
414 #define YYLEX yylex()
420 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
422 #define YYLEX yylex(&yylval, &yylloc)
424 #else /* not YYLSP_NEEDED */
426 #define YYLEX yylex(&yylval, YYLEX_PARAM)
428 #define YYLEX yylex(&yylval)
430 #endif /* not YYLSP_NEEDED */
433 /* If nonreentrant, generate the variables here */
437 int yychar
; /* the lookahead symbol */
438 YYSTYPE yylval
; /* the semantic value of the */
439 /* lookahead symbol */
442 YYLTYPE yylloc
; /* location data for the lookahead */
446 int yynerrs
; /* number of parse errors so far */
447 #endif /* not YYPURE */
450 int yydebug
; /* nonzero means print parse trace */
451 /* Since this is uninitialized, it does not stop multiple parsers
455 /* YYINITDEPTH indicates the initial size of the parser's stacks */
458 #define YYINITDEPTH 200
461 /* YYMAXDEPTH is the maximum size the stacks can grow to
462 (effective only if the built-in stack extension method is used). */
469 #define YYMAXDEPTH 10000
472 /* Define __yy_memcpy. Note that the size argument
473 should be passed with type unsigned int, because that is what the non-GCC
474 definitions require. With GCC, __builtin_memcpy takes an arg
475 of type size_t, but it can handle unsigned int. */
477 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
478 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
479 #else /* not GNU C or C++ */
482 /* This is the most reliable way to avoid incompatibilities
483 in available built-in functions on various systems. */
485 __yy_memcpy (to
, from
, count
)
490 register char *f
= from
;
491 register char *t
= to
;
492 register int i
= count
;
498 #else /* __cplusplus */
500 /* This is the most reliable way to avoid incompatibilities
501 in available built-in functions on various systems. */
503 __yy_memcpy (char *to
, char *from
, unsigned int count
)
505 register char *t
= to
;
506 register char *f
= from
;
507 register int i
= count
;
516 #line 217 "/usr/local/share/bison.simple"
518 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
519 into yyparse. The argument should have type void *.
520 It should actually point to an object.
521 Grammar actions can access the variable by casting it
522 to the proper pointer type. */
526 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
527 #define YYPARSE_PARAM_DECL
528 #else /* not __cplusplus */
529 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
530 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
531 #endif /* not __cplusplus */
532 #else /* not YYPARSE_PARAM */
533 #define YYPARSE_PARAM_ARG
534 #define YYPARSE_PARAM_DECL
535 #endif /* not YYPARSE_PARAM */
537 /* Prevent warning if -Wstrict-prototypes. */
540 int yyparse (void *);
547 yyparse(YYPARSE_PARAM_ARG
)
550 register int yystate
;
552 register short *yyssp
;
553 register YYSTYPE
*yyvsp
;
554 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
555 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
557 short yyssa
[YYINITDEPTH
]; /* the state stack */
558 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
560 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
561 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
564 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
565 YYLTYPE
*yyls
= yylsa
;
568 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
570 #define YYPOPSTACK (yyvsp--, yyssp--)
573 int yystacksize
= YYINITDEPTH
;
574 int yyfree_stacks
= 0;
585 YYSTYPE yyval
; /* the variable used to return */
586 /* semantic values from the action */
593 fprintf(stderr
, "Starting parse\n");
599 yychar
= YYEMPTY
; /* Cause a token to be read. */
601 /* Initialize stack pointers.
602 Waste one element of value and location stack
603 so that they stay on the same level as the state stack.
604 The wasted elements are never initialized. */
612 /* Push a new state, which is found in yystate . */
613 /* In all cases, when you get here, the value and location stacks
614 have just been pushed. so pushing a state here evens the stacks. */
619 if (yyssp
>= yyss
+ yystacksize
- 1)
621 /* Give user a chance to reallocate the stack */
622 /* Use copies of these so that the &'s don't force the real ones into memory. */
623 YYSTYPE
*yyvs1
= yyvs
;
626 YYLTYPE
*yyls1
= yyls
;
629 /* Get the current used size of the three stacks, in elements. */
630 int size
= yyssp
- yyss
+ 1;
633 /* Each stack pointer address is followed by the size of
634 the data in use in that stack, in bytes. */
636 /* This used to be a conditional around just the two extra args,
637 but that might be undefined if yyoverflow is a macro. */
638 yyoverflow("parser stack overflow",
639 &yyss1
, size
* sizeof (*yyssp
),
640 &yyvs1
, size
* sizeof (*yyvsp
),
641 &yyls1
, size
* sizeof (*yylsp
),
644 yyoverflow("parser stack overflow",
645 &yyss1
, size
* sizeof (*yyssp
),
646 &yyvs1
, size
* sizeof (*yyvsp
),
650 yyss
= yyss1
; yyvs
= yyvs1
;
654 #else /* no yyoverflow */
655 /* Extend the stack our own way. */
656 if (yystacksize
>= YYMAXDEPTH
)
658 yyerror("parser stack overflow");
670 if (yystacksize
> YYMAXDEPTH
)
671 yystacksize
= YYMAXDEPTH
;
672 #ifndef YYSTACK_USE_ALLOCA
675 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
676 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
677 size
* (unsigned int) sizeof (*yyssp
));
678 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
679 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
680 size
* (unsigned int) sizeof (*yyvsp
));
682 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
683 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
684 size
* (unsigned int) sizeof (*yylsp
));
686 #endif /* no yyoverflow */
688 yyssp
= yyss
+ size
- 1;
689 yyvsp
= yyvs
+ size
- 1;
691 yylsp
= yyls
+ size
- 1;
696 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
699 if (yyssp
>= yyss
+ yystacksize
- 1)
705 fprintf(stderr
, "Entering state %d\n", yystate
);
711 /* Do appropriate processing given the current state. */
712 /* Read a lookahead token if we need one and don't already have one. */
715 /* First try to decide what to do without reference to lookahead token. */
717 yyn
= yypact
[yystate
];
721 /* Not known => get a lookahead token if don't already have one. */
723 /* yychar is either YYEMPTY or YYEOF
724 or a valid token in external form. */
726 if (yychar
== YYEMPTY
)
730 fprintf(stderr
, "Reading a token: ");
735 /* Convert token to internal form (in yychar1) for indexing tables with */
737 if (yychar
<= 0) /* This means end of input. */
740 yychar
= YYEOF
; /* Don't call YYLEX any more */
744 fprintf(stderr
, "Now at end of input.\n");
749 yychar1
= YYTRANSLATE(yychar
);
754 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
755 /* Give the individual parser a way to print the precise meaning
756 of a token, for further debugging info. */
758 YYPRINT (stderr
, yychar
, yylval
);
760 fprintf (stderr
, ")\n");
766 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
771 /* yyn is what to do for this token type in this state.
772 Negative => reduce, -yyn is rule number.
773 Positive => shift, yyn is new state.
774 New state is final state => don't bother to shift,
776 0, or most negative number => error. */
791 /* Shift the lookahead token. */
795 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
798 /* Discard the token being shifted unless it is eof. */
807 /* count tokens shifted since error; after three, turn off error status. */
808 if (yyerrstatus
) yyerrstatus
--;
813 /* Do the default action for the current state. */
816 yyn
= yydefact
[yystate
];
820 /* Do a reduction. yyn is the number of a rule to reduce with. */
824 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
831 fprintf (stderr
, "Reducing via rule %d (line %d), ",
834 /* Print the symbols being reduced, and their result. */
835 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
836 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
837 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
847 if (yyvsp
[0].exp
== NULL
)
849 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
855 yyval
.exp
= new_exp_3 (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
861 yyval
.exp
= new_exp_2 (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
867 yyval
.exp
= new_exp_2 (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
873 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
879 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
885 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
891 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
897 yyval
.exp
= new_exp_1 (lnot
, yyvsp
[0].exp
);
903 yyval
.exp
= new_exp_0 (var
);
909 if ((yyval
.exp
= new_exp_0 (num
)) != NULL
)
910 yyval
.exp
->val
.num
= yyvsp
[0].num
;
916 yyval
.exp
= yyvsp
[-1].exp
;
920 /* the action file gets copied in in place of this dollarsign */
921 #line 543 "/usr/local/share/bison.simple"
932 short *ssp1
= yyss
- 1;
933 fprintf (stderr
, "state stack now");
934 while (ssp1
!= yyssp
)
935 fprintf (stderr
, " %d", *++ssp1
);
936 fprintf (stderr
, "\n");
946 yylsp
->first_line
= yylloc
.first_line
;
947 yylsp
->first_column
= yylloc
.first_column
;
948 yylsp
->last_line
= (yylsp
-1)->last_line
;
949 yylsp
->last_column
= (yylsp
-1)->last_column
;
954 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
955 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
959 /* Now "shift" the result of the reduction.
960 Determine what state that goes to,
961 based on the state we popped back to
962 and the rule number reduced by. */
966 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
967 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
968 yystate
= yytable
[yystate
];
970 yystate
= yydefgoto
[yyn
- YYNTBASE
];
974 yyerrlab
: /* here on detecting error */
977 /* If not already recovering from an error, report this error. */
981 #ifdef YYERROR_VERBOSE
982 yyn
= yypact
[yystate
];
984 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
991 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
992 for (x
= (yyn
< 0 ? -yyn
: 0);
993 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
994 if (yycheck
[x
+ yyn
] == x
)
995 size
+= strlen(yytname
[x
]) + 15, count
++;
996 msg
= (char *) malloc(size
+ 15);
999 strcpy(msg
, "parse error");
1004 for (x
= (yyn
< 0 ? -yyn
: 0);
1005 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1006 if (yycheck
[x
+ yyn
] == x
)
1008 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1009 strcat(msg
, yytname
[x
]);
1018 yyerror ("parse error; also virtual memory exceeded");
1021 #endif /* YYERROR_VERBOSE */
1022 yyerror("parse error");
1026 yyerrlab1
: /* here on error raised explicitly by an action */
1028 if (yyerrstatus
== 3)
1030 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1032 /* return failure if at end of input */
1033 if (yychar
== YYEOF
)
1038 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1044 /* Else will try to reuse lookahead token
1045 after shifting the error token. */
1047 yyerrstatus
= 3; /* Each real token shifted decrements this */
1051 yyerrdefault
: /* current state does not do anything special for the error token. */
1054 /* This is wrong; only states that explicitly want error tokens
1055 should shift them. */
1056 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1057 if (yyn
) goto yydefault
;
1060 yyerrpop
: /* pop the current state because it cannot handle the error token */
1062 if (yyssp
== yyss
) YYABORT
;
1072 short *ssp1
= yyss
- 1;
1073 fprintf (stderr
, "Error: state stack now");
1074 while (ssp1
!= yyssp
)
1075 fprintf (stderr
, " %d", *++ssp1
);
1076 fprintf (stderr
, "\n");
1082 yyn
= yypact
[yystate
];
1087 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1106 fprintf(stderr
, "Shifting error token, ");
1118 /* YYACCEPT comes here. */
1130 /* YYABORT comes here. */
1141 #line 229 "plural.y"
1146 FREE_EXPRESSION (exp
)
1147 struct expression
*exp
;
1152 /* Handle the recursive case. */
1156 FREE_EXPRESSION (exp
->val
.args
[2]);
1159 FREE_EXPRESSION (exp
->val
.args
[1]);
1162 FREE_EXPRESSION (exp
->val
.args
[0]);
1177 const char *exp
= *pexp
;
1188 if (exp
[0] != ' ' && exp
[0] != '\t')
1197 case '0': case '1': case '2': case '3': case '4':
1198 case '5': case '6': case '7': case '8': case '9':
1200 unsigned long int n
= result
- '0';
1201 while (exp
[0] >= '0' && exp
[0] <= '9')
1227 lval
->op
= not_equal
;
1234 if (exp
[0] == result
)
1244 lval
->op
= less_or_equal
;
1247 lval
->op
= less_than
;
1255 lval
->op
= greater_or_equal
;
1258 lval
->op
= greater_than
;
1292 /* Nothing, just return the character. */
1298 /* Be safe and let the user call this function again. */
1321 /* Do nothing. We don't print error messages here. */