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 The GNU C Library is free software; you can redistribute it and/or
27 modify it under the terms of the GNU Library General Public License as
28 published by the Free Software Foundation; either version 2 of the
29 License, or (at your option) any later version.
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
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 the GNU C Library; see the file COPYING.LIB. If not,
38 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
39 Boston, MA 02111-1307, USA. */
48 /* Names for the libintl functions are a problem. They must not clash
49 with existing names and they should follow ANSI C. But this source
50 code is also used in GNU C Library where the names have a __
51 prefix. So we have to make a difference here. */
53 # define FREE_EXPRESSION __gettext_free_exp
55 # define FREE_EXPRESSION gettext_free_exp__
56 # define __gettextparse gettextparse__
59 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
60 #define YYPARSE_PARAM arg
64 unsigned long int num
;
66 struct expression
*exp
;
70 /* Prototypes for local functions. */
71 static struct expression
*new_exp
PARAMS ((int nargs
, enum operator op
,
72 struct expression
* const *args
));
73 static inline struct expression
*new_exp_0
PARAMS ((enum operator op
));
74 static inline struct expression
*new_exp_1
PARAMS ((enum operator op
,
75 struct expression
*right
));
76 static struct expression
*new_exp_2
PARAMS ((enum operator op
,
77 struct expression
*left
,
78 struct expression
*right
));
79 static inline struct expression
*new_exp_3
PARAMS ((enum operator op
,
80 struct expression
*bexp
,
81 struct expression
*tbranch
,
82 struct expression
*fbranch
));
83 static int yylex
PARAMS ((YYSTYPE
*lval
, const char **pexp
));
84 static void yyerror
PARAMS ((const char *str
));
86 /* Allocation of expressions. */
88 static struct expression
*
89 new_exp (nargs
, op
, args
)
92 struct expression
* const *args
;
95 struct expression
*newp
;
97 /* If any of the argument could not be malloc'ed, just return NULL. */
98 for (i
= nargs
- 1; i
>= 0; i
--)
102 /* Allocate a new expression. */
103 newp
= (struct expression
*) malloc (sizeof (*newp
));
107 newp
->operation
= op
;
108 for (i
= nargs
- 1; i
>= 0; i
--)
109 newp
->val
.args
[i
] = args
[i
];
114 for (i
= nargs
- 1; i
>= 0; i
--)
115 FREE_EXPRESSION (args
[i
]);
120 static inline struct expression
*
124 return new_exp (0, op
, NULL
);
127 static inline struct expression
*
128 new_exp_1 (op
, right
)
130 struct expression
*right
;
132 struct expression
*args
[1];
135 return new_exp (1, op
, args
);
138 static struct expression
*
139 new_exp_2 (op
, left
, right
)
141 struct expression
*left
;
142 struct expression
*right
;
144 struct expression
*args
[2];
148 return new_exp (2, op
, args
);
151 static inline struct expression
*
152 new_exp_3 (op
, bexp
, tbranch
, fbranch
)
154 struct expression
*bexp
;
155 struct expression
*tbranch
;
156 struct expression
*fbranch
;
158 struct expression
*args
[3];
163 return new_exp (3, op
, args
);
177 #define YYFLAG -32768
180 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
182 static const char yytranslate
[] = { 0,
183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
186 2, 2, 10, 2, 2, 2, 2, 5, 2, 14,
187 15, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 12, 2, 2,
189 2, 2, 3, 2, 2, 2, 2, 2, 2, 2,
190 2, 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, 2, 2, 2, 2, 2, 2, 13,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 4, 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, 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 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, 1, 6, 7, 8, 9,
213 static const short yyprhs
[] = { 0,
214 0, 2, 8, 12, 16, 20, 24, 28, 32, 35,
218 static const short yyrhs
[] = { 17,
219 0, 17, 3, 17, 12, 17, 0, 17, 4, 17,
220 0, 17, 5, 17, 0, 17, 6, 17, 0, 17,
221 7, 17, 0, 17, 8, 17, 0, 17, 9, 17,
222 0, 10, 17, 0, 13, 0, 11, 0, 14, 17,
229 static const short yyrline
[] = { 0,
230 170, 178, 182, 186, 190, 194, 198, 202, 206, 210,
236 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
238 static const char * const yytname
[] = { "$","error","$undefined.","'?'","'|'",
239 "'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'",
244 static const short yyr1
[] = { 0,
245 16, 17, 17, 17, 17, 17, 17, 17, 17, 17,
249 static const short yyr2
[] = { 0,
250 1, 5, 3, 3, 3, 3, 3, 3, 2, 1,
254 static const short yydefact
[] = { 0,
255 0, 11, 10, 0, 1, 9, 0, 0, 0, 0,
256 0, 0, 0, 0, 12, 0, 3, 4, 5, 6,
260 static const short yydefgoto
[] = { 25,
264 static const short yypact
[] = { -9,
265 -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9,
266 -9, -9, -9, -9,-32768, 24, 39, 43, 16, 26,
267 -3,-32768, -9, 34, 21, 53,-32768
270 static const short yypgoto
[] = {-32768,
278 static const short yytable
[] = { 6,
279 1, 2, 7, 3, 4, 14, 16, 17, 18, 19,
280 20, 21, 22, 8, 9, 10, 11, 12, 13, 14,
281 26, 24, 12, 13, 14, 15, 8, 9, 10, 11,
282 12, 13, 14, 13, 14, 23, 8, 9, 10, 11,
283 12, 13, 14, 10, 11, 12, 13, 14, 11, 12,
287 static const short yycheck
[] = { 1,
288 10, 11, 4, 13, 14, 9, 8, 9, 10, 11,
289 12, 13, 14, 3, 4, 5, 6, 7, 8, 9,
290 0, 23, 7, 8, 9, 15, 3, 4, 5, 6,
291 7, 8, 9, 8, 9, 12, 3, 4, 5, 6,
292 7, 8, 9, 5, 6, 7, 8, 9, 6, 7,
297 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
298 #line 3 "/usr/lib/bison.simple"
299 /* This file comes from bison-1.28. */
301 /* Skeleton output parser for bison,
302 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
304 This program is free software; you can redistribute it and/or modify
305 it under the terms of the GNU General Public License as published by
306 the Free Software Foundation; either version 2, or (at your option)
309 This program is distributed in the hope that it will be useful,
310 but WITHOUT ANY WARRANTY; without even the implied warranty of
311 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
312 GNU General Public License for more details.
314 You should have received a copy of the GNU General Public License
315 along with this program; if not, write to the Free Software
316 Foundation, Inc., 59 Temple Place - Suite 330,
317 Boston, MA 02111-1307, USA. */
319 /* As a special exception, when this file is copied by Bison into a
320 Bison output file, you may use that output file without restriction.
321 This special exception was added by the Free Software Foundation
322 in version 1.24 of Bison. */
324 /* This is the parser code that is written into each bison parser
325 when the %semantic_parser declaration is not specified in the grammar.
326 It was written by Richard Stallman by simplifying the hairy parser
327 used when %semantic_parser is specified. */
329 #ifndef YYSTACK_USE_ALLOCA
331 #define YYSTACK_USE_ALLOCA
332 #else /* alloca not defined */
334 #define YYSTACK_USE_ALLOCA
335 #define alloca __builtin_alloca
336 #else /* not GNU C. */
337 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
338 #define YYSTACK_USE_ALLOCA
340 #else /* not sparc */
341 /* We think this test detects Watcom and Microsoft C. */
342 /* This used to test MSDOS, but that is a bad idea
343 since that symbol is in the user namespace. */
344 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
345 #if 0 /* No need for malloc.h, which pollutes the namespace;
346 instead, just don't use alloca. */
349 #else /* not MSDOS, or __TURBOC__ */
351 /* I don't know what this was needed for, but it pollutes the namespace.
352 So I turned it off. rms, 2 May 1997. */
353 /* #include <malloc.h> */
355 #define YYSTACK_USE_ALLOCA
356 #else /* not MSDOS, or __TURBOC__, or _AIX */
358 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
359 and on HPUX 10. Eventually we can turn this on. */
360 #define YYSTACK_USE_ALLOCA
361 #define alloca __builtin_alloca
364 #endif /* not _AIX */
365 #endif /* not MSDOS, or __TURBOC__ */
366 #endif /* not sparc */
367 #endif /* not GNU C */
368 #endif /* alloca not defined */
369 #endif /* YYSTACK_USE_ALLOCA not defined */
371 #ifdef YYSTACK_USE_ALLOCA
372 #define YYSTACK_ALLOC alloca
374 #define YYSTACK_ALLOC malloc
377 /* Note: there must be only one dollar sign in this file.
378 It is replaced by the list of actions, each action
379 as one case of the switch. */
381 #define yyerrok (yyerrstatus = 0)
382 #define yyclearin (yychar = YYEMPTY)
385 #define YYACCEPT goto yyacceptlab
386 #define YYABORT goto yyabortlab
387 #define YYERROR goto yyerrlab1
388 /* Like YYERROR except do call yyerror.
389 This remains here temporarily to ease the
390 transition to the new meaning of YYERROR, for GCC.
391 Once GCC version 2 has supplanted version 1, this can go. */
392 #define YYFAIL goto yyerrlab
393 #define YYRECOVERING() (!!yyerrstatus)
394 #define YYBACKUP(token, value) \
396 if (yychar == YYEMPTY && yylen == 1) \
397 { yychar = (token), yylval = (value); \
398 yychar1 = YYTRANSLATE (yychar); \
403 { yyerror ("syntax error: cannot back up"); YYERROR; } \
407 #define YYERRCODE 256
410 #define YYLEX yylex()
416 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
418 #define YYLEX yylex(&yylval, &yylloc)
420 #else /* not YYLSP_NEEDED */
422 #define YYLEX yylex(&yylval, YYLEX_PARAM)
424 #define YYLEX yylex(&yylval)
426 #endif /* not YYLSP_NEEDED */
429 /* If nonreentrant, generate the variables here */
433 int yychar
; /* the lookahead symbol */
434 YYSTYPE yylval
; /* the semantic value of the */
435 /* lookahead symbol */
438 YYLTYPE yylloc
; /* location data for the lookahead */
442 int yynerrs
; /* number of parse errors so far */
443 #endif /* not YYPURE */
446 int yydebug
; /* nonzero means print parse trace */
447 /* Since this is uninitialized, it does not stop multiple parsers
451 /* YYINITDEPTH indicates the initial size of the parser's stacks */
454 #define YYINITDEPTH 200
457 /* YYMAXDEPTH is the maximum size the stacks can grow to
458 (effective only if the built-in stack extension method is used). */
465 #define YYMAXDEPTH 10000
468 /* Define __yy_memcpy. Note that the size argument
469 should be passed with type unsigned int, because that is what the non-GCC
470 definitions require. With GCC, __builtin_memcpy takes an arg
471 of type size_t, but it can handle unsigned int. */
473 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
474 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
475 #else /* not GNU C or C++ */
478 /* This is the most reliable way to avoid incompatibilities
479 in available built-in functions on various systems. */
481 __yy_memcpy (to
, from
, count
)
486 register char *f
= from
;
487 register char *t
= to
;
488 register int i
= count
;
494 #else /* __cplusplus */
496 /* This is the most reliable way to avoid incompatibilities
497 in available built-in functions on various systems. */
499 __yy_memcpy (char *to
, char *from
, unsigned int count
)
501 register char *t
= to
;
502 register char *f
= from
;
503 register int i
= count
;
512 #line 217 "/usr/lib/bison.simple"
514 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
515 into yyparse. The argument should have type void *.
516 It should actually point to an object.
517 Grammar actions can access the variable by casting it
518 to the proper pointer type. */
522 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
523 #define YYPARSE_PARAM_DECL
524 #else /* not __cplusplus */
525 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
526 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
527 #endif /* not __cplusplus */
528 #else /* not YYPARSE_PARAM */
529 #define YYPARSE_PARAM_ARG
530 #define YYPARSE_PARAM_DECL
531 #endif /* not YYPARSE_PARAM */
533 /* Prevent warning if -Wstrict-prototypes. */
536 int yyparse (void *);
543 yyparse(YYPARSE_PARAM_ARG
)
546 register int yystate
;
548 register short *yyssp
;
549 register YYSTYPE
*yyvsp
;
550 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
551 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
553 short yyssa
[YYINITDEPTH
]; /* the state stack */
554 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
556 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
557 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
560 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
561 YYLTYPE
*yyls
= yylsa
;
564 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
566 #define YYPOPSTACK (yyvsp--, yyssp--)
569 int yystacksize
= YYINITDEPTH
;
570 int yyfree_stacks
= 0;
581 YYSTYPE yyval
; /* the variable used to return */
582 /* semantic values from the action */
589 fprintf(stderr
, "Starting parse\n");
595 yychar
= YYEMPTY
; /* Cause a token to be read. */
597 /* Initialize stack pointers.
598 Waste one element of value and location stack
599 so that they stay on the same level as the state stack.
600 The wasted elements are never initialized. */
608 /* Push a new state, which is found in yystate . */
609 /* In all cases, when you get here, the value and location stacks
610 have just been pushed. so pushing a state here evens the stacks. */
615 if (yyssp
>= yyss
+ yystacksize
- 1)
617 /* Give user a chance to reallocate the stack */
618 /* Use copies of these so that the &'s don't force the real ones into memory. */
619 YYSTYPE
*yyvs1
= yyvs
;
622 YYLTYPE
*yyls1
= yyls
;
625 /* Get the current used size of the three stacks, in elements. */
626 int size
= yyssp
- yyss
+ 1;
629 /* Each stack pointer address is followed by the size of
630 the data in use in that stack, in bytes. */
632 /* This used to be a conditional around just the two extra args,
633 but that might be undefined if yyoverflow is a macro. */
634 yyoverflow("parser stack overflow",
635 &yyss1
, size
* sizeof (*yyssp
),
636 &yyvs1
, size
* sizeof (*yyvsp
),
637 &yyls1
, size
* sizeof (*yylsp
),
640 yyoverflow("parser stack overflow",
641 &yyss1
, size
* sizeof (*yyssp
),
642 &yyvs1
, size
* sizeof (*yyvsp
),
646 yyss
= yyss1
; yyvs
= yyvs1
;
650 #else /* no yyoverflow */
651 /* Extend the stack our own way. */
652 if (yystacksize
>= YYMAXDEPTH
)
654 yyerror("parser stack overflow");
666 if (yystacksize
> YYMAXDEPTH
)
667 yystacksize
= YYMAXDEPTH
;
668 #ifndef YYSTACK_USE_ALLOCA
671 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
672 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
673 size
* (unsigned int) sizeof (*yyssp
));
674 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
675 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
676 size
* (unsigned int) sizeof (*yyvsp
));
678 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
679 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
680 size
* (unsigned int) sizeof (*yylsp
));
682 #endif /* no yyoverflow */
684 yyssp
= yyss
+ size
- 1;
685 yyvsp
= yyvs
+ size
- 1;
687 yylsp
= yyls
+ size
- 1;
692 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
695 if (yyssp
>= yyss
+ yystacksize
- 1)
701 fprintf(stderr
, "Entering state %d\n", yystate
);
707 /* Do appropriate processing given the current state. */
708 /* Read a lookahead token if we need one and don't already have one. */
711 /* First try to decide what to do without reference to lookahead token. */
713 yyn
= yypact
[yystate
];
717 /* Not known => get a lookahead token if don't already have one. */
719 /* yychar is either YYEMPTY or YYEOF
720 or a valid token in external form. */
722 if (yychar
== YYEMPTY
)
726 fprintf(stderr
, "Reading a token: ");
731 /* Convert token to internal form (in yychar1) for indexing tables with */
733 if (yychar
<= 0) /* This means end of input. */
736 yychar
= YYEOF
; /* Don't call YYLEX any more */
740 fprintf(stderr
, "Now at end of input.\n");
745 yychar1
= YYTRANSLATE(yychar
);
750 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
751 /* Give the individual parser a way to print the precise meaning
752 of a token, for further debugging info. */
754 YYPRINT (stderr
, yychar
, yylval
);
756 fprintf (stderr
, ")\n");
762 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
767 /* yyn is what to do for this token type in this state.
768 Negative => reduce, -yyn is rule number.
769 Positive => shift, yyn is new state.
770 New state is final state => don't bother to shift,
772 0, or most negative number => error. */
787 /* Shift the lookahead token. */
791 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
794 /* Discard the token being shifted unless it is eof. */
803 /* count tokens shifted since error; after three, turn off error status. */
804 if (yyerrstatus
) yyerrstatus
--;
809 /* Do the default action for the current state. */
812 yyn
= yydefact
[yystate
];
816 /* Do a reduction. yyn is the number of a rule to reduce with. */
820 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
827 fprintf (stderr
, "Reducing via rule %d (line %d), ",
830 /* Print the symbols being reduced, and their result. */
831 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
832 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
833 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
843 if (yyvsp
[0].exp
== NULL
)
845 ((struct parse_args
*) arg
)->res
= yyvsp
[0].exp
;
851 yyval
.exp
= new_exp_3 (qmop
, yyvsp
[-4].exp
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
857 yyval
.exp
= new_exp_2 (lor
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
863 yyval
.exp
= new_exp_2 (land
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
869 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
875 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
881 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
887 yyval
.exp
= new_exp_2 (yyvsp
[-1].op
, yyvsp
[-2].exp
, yyvsp
[0].exp
);
893 yyval
.exp
= new_exp_1 (lnot
, yyvsp
[0].exp
);
899 yyval
.exp
= new_exp_0 (var
);
905 if ((yyval
.exp
= new_exp_0 (num
)) != NULL
)
906 yyval
.exp
->val
.num
= yyvsp
[0].num
;
912 yyval
.exp
= yyvsp
[-1].exp
;
916 /* the action file gets copied in in place of this dollarsign */
917 #line 543 "/usr/lib/bison.simple"
928 short *ssp1
= yyss
- 1;
929 fprintf (stderr
, "state stack now");
930 while (ssp1
!= yyssp
)
931 fprintf (stderr
, " %d", *++ssp1
);
932 fprintf (stderr
, "\n");
942 yylsp
->first_line
= yylloc
.first_line
;
943 yylsp
->first_column
= yylloc
.first_column
;
944 yylsp
->last_line
= (yylsp
-1)->last_line
;
945 yylsp
->last_column
= (yylsp
-1)->last_column
;
950 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
951 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
955 /* Now "shift" the result of the reduction.
956 Determine what state that goes to,
957 based on the state we popped back to
958 and the rule number reduced by. */
962 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
963 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
964 yystate
= yytable
[yystate
];
966 yystate
= yydefgoto
[yyn
- YYNTBASE
];
970 yyerrlab
: /* here on detecting error */
973 /* If not already recovering from an error, report this error. */
977 #ifdef YYERROR_VERBOSE
978 yyn
= yypact
[yystate
];
980 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
987 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
988 for (x
= (yyn
< 0 ? -yyn
: 0);
989 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
990 if (yycheck
[x
+ yyn
] == x
)
991 size
+= strlen(yytname
[x
]) + 15, count
++;
992 msg
= (char *) malloc(size
+ 15);
995 strcpy(msg
, "parse error");
1000 for (x
= (yyn
< 0 ? -yyn
: 0);
1001 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1002 if (yycheck
[x
+ yyn
] == x
)
1004 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1005 strcat(msg
, yytname
[x
]);
1014 yyerror ("parse error; also virtual memory exceeded");
1017 #endif /* YYERROR_VERBOSE */
1018 yyerror("parse error");
1022 yyerrlab1
: /* here on error raised explicitly by an action */
1024 if (yyerrstatus
== 3)
1026 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1028 /* return failure if at end of input */
1029 if (yychar
== YYEOF
)
1034 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1040 /* Else will try to reuse lookahead token
1041 after shifting the error token. */
1043 yyerrstatus
= 3; /* Each real token shifted decrements this */
1047 yyerrdefault
: /* current state does not do anything special for the error token. */
1050 /* This is wrong; only states that explicitly want error tokens
1051 should shift them. */
1052 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1053 if (yyn
) goto yydefault
;
1056 yyerrpop
: /* pop the current state because it cannot handle the error token */
1058 if (yyssp
== yyss
) YYABORT
;
1068 short *ssp1
= yyss
- 1;
1069 fprintf (stderr
, "Error: state stack now");
1070 while (ssp1
!= yyssp
)
1071 fprintf (stderr
, " %d", *++ssp1
);
1072 fprintf (stderr
, "\n");
1078 yyn
= yypact
[yystate
];
1083 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1102 fprintf(stderr
, "Shifting error token, ");
1114 /* YYACCEPT comes here. */
1126 /* YYABORT comes here. */
1137 #line 225 "plural.y"
1142 FREE_EXPRESSION (exp
)
1143 struct expression
*exp
;
1148 /* Handle the recursive case. */
1152 FREE_EXPRESSION (exp
->val
.args
[2]);
1155 FREE_EXPRESSION (exp
->val
.args
[1]);
1158 FREE_EXPRESSION (exp
->val
.args
[0]);
1173 const char *exp
= *pexp
;
1184 if (exp
[0] != ' ' && exp
[0] != '\t')
1193 case '0': case '1': case '2': case '3': case '4':
1194 case '5': case '6': case '7': case '8': case '9':
1196 unsigned long int n
= result
- '0';
1197 while (exp
[0] >= '0' && exp
[0] <= '9')
1223 lval
->op
= not_equal
;
1230 if (exp
[0] == result
)
1240 lval
->op
= less_or_equal
;
1243 lval
->op
= less_than
;
1251 lval
->op
= greater_or_equal
;
1254 lval
->op
= greater_than
;
1288 /* Nothing, just return the character. */
1294 /* Be safe and let the user call this function again. */
1317 /* Do nothing. We don't print error messages here. */