1 /* A Bison parser, made from plural.y
2 by GNU bison 1.32. */
3
4 #define YYBISON 1 /* Identify Bison output. */
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 /* Expression parsing for plural form selection.
22 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
23 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
24
25 This program is free software; you can redistribute it and/or modify it
26 under the terms of the GNU Library General Public License as published
27 by the Free Software Foundation; either version 2, or (at your option)
28 any later version.
29
30 This program is distributed in the hope that it will be useful,
31 but WITHOUT ANY WARRANTY; without even the implied warranty of
32 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 Library General Public License for more details.
34
35 You should have received a copy of the GNU Library General Public
36 License along with this program; if not, write to the Free Software
37 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
38 USA. */
39
40 /* The bison generated parser uses alloca. AIX 3 forces us to put this
41 declaration at the beginning of the file. The declaration in bison's
42 skeleton file comes too late. This must come before <autoconf.h>
43 because <autoconf.h> may include arbitrary system headers. */
44 #if defined _AIX && !defined __GNUC__
45 #pragma alloca
46 #endif
47
48 #ifdef HAVE_CONFIG_H
49 # include <autoconf.h>
50 #endif
51
52 #include <stdlib.h>
53 #include "gettextP.h"
54
55 /* Names for the libintl functions are a problem. They must not clash
56 with existing names and they should follow ANSI C. But this source
57 code is also used in GNU C Library where the names have a __
58 prefix. So we have to make a difference here. */
59 #ifdef _LIBC
60 # define FREE_EXPRESSION __gettext_free_exp
61 #else
62 # define FREE_EXPRESSION gettext_free_exp__
63 # define __gettextparse gettextparse__
64 #endif
65
66 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
67 #define YYPARSE_PARAM arg
68
69 #line 53 "plural.y"
70 #ifndef YYSTYPE
71 typedef union {
72 unsigned long int num;
73 enum operator op;
74 struct expression *exp;
75 } yystype;
76 # define YYSTYPE yystype
77 #endif
78 #line 59 "plural.y"
79
80 /* Prototypes for local functions. */
81 static struct expression *new_exp PARAMS ((int nargs, enum operator op,
82 struct expression * const *args));
83 static inline struct expression *new_exp_0 PARAMS ((enum operator op));
84 static inline struct expression *new_exp_1 PARAMS ((enum operator op,
85 struct expression *right));
86 static struct expression *new_exp_2 PARAMS ((enum operator op,
87 struct expression *left,
88 struct expression *right));
89 static inline struct expression *new_exp_3 PARAMS ((enum operator op,
90 struct expression *bexp,
91 struct expression *tbranch,
92 struct expression *fbranch));
93 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
94 static void yyerror PARAMS ((const char *str));
95
96 /* Allocation of expressions. */
97
98 static struct expression *
new_exp(nargs,op,args)99 new_exp (nargs, op, args)
100 int nargs;
101 enum operator op;
102 struct expression * const *args;
103 {
104 int i;
105 struct expression *newp;
106
107 /* If any of the argument could not be malloc'ed, just return NULL. */
108 for (i = nargs - 1; i >= 0; i--)
109 if (args[i] == NULL)
110 goto fail;
111
112 /* Allocate a new expression. */
113 newp = (struct expression *) malloc (sizeof (*newp));
114 if (newp != NULL)
115 {
116 newp->nargs = nargs;
117 newp->operation = op;
118 for (i = nargs - 1; i >= 0; i--)
119 newp->val.args[i] = args[i];
120 return newp;
121 }
122
123 fail:
124 for (i = nargs - 1; i >= 0; i--)
125 FREE_EXPRESSION (args[i]);
126
127 return NULL;
128 }
129
130 static inline struct expression *
new_exp_0(op)131 new_exp_0 (op)
132 enum operator op;
133 {
134 return new_exp (0, op, NULL);
135 }
136
137 static inline struct expression *
new_exp_1(op,right)138 new_exp_1 (op, right)
139 enum operator op;
140 struct expression *right;
141 {
142 struct expression *args[1];
143
144 args[0] = right;
145 return new_exp (1, op, args);
146 }
147
148 static struct expression *
new_exp_2(op,left,right)149 new_exp_2 (op, left, right)
150 enum operator op;
151 struct expression *left;
152 struct expression *right;
153 {
154 struct expression *args[2];
155
156 args[0] = left;
157 args[1] = right;
158 return new_exp (2, op, args);
159 }
160
161 static inline struct expression *
new_exp_3(op,bexp,tbranch,fbranch)162 new_exp_3 (op, bexp, tbranch, fbranch)
163 enum operator op;
164 struct expression *bexp;
165 struct expression *tbranch;
166 struct expression *fbranch;
167 {
168 struct expression *args[3];
169
170 args[0] = bexp;
171 args[1] = tbranch;
172 args[2] = fbranch;
173 return new_exp (3, op, args);
174 }
175
176 #ifndef YYDEBUG
177 # define YYDEBUG 0
178 #endif
179
180
181
182 #define YYFINAL 27
183 #define YYFLAG -32768
184 #define YYNTBASE 16
185
186 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
187 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
188
189 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
190 static const char yytranslate[] =
191 {
192 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
196 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
198 2, 2, 2, 3, 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 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 4, 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, 2, 2, 2, 2,
216 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
217 2, 2, 2, 2, 2, 2, 1, 6, 7, 8,
218 9, 11
219 };
220
221 #if YYDEBUG
222 static const short yyprhs[] =
223 {
224 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
225 35, 37, 39
226 };
227 static const short yyrhs[] =
228 {
229 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
230 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
231 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
232 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
233 17, 15, 0
234 };
235
236 #endif
237
238 #if YYDEBUG
239 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
240 static const short yyrline[] =
241 {
242 0, 178, 186, 190, 194, 198, 202, 206, 210, 214,
243 218, 222, 227
244 };
245 #endif
246
247
248 #if (YYDEBUG) || defined YYERROR_VERBOSE
249
250 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
251 static const char *const yytname[] =
252 {
253 "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
254 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
255 "start", "exp", NULL
256 };
257 #endif
258
259 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
260 static const short yyr1[] =
261 {
262 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
263 17, 17, 17
264 };
265
266 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
267 static const short yyr2[] =
268 {
269 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
270 1, 1, 3
271 };
272
273 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
274 doesn't specify something else to do. Zero means the default is an
275 error. */
276 static const short yydefact[] =
277 {
278 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
279 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
280 6, 7, 8, 0, 2, 0, 0, 0
281 };
282
283 static const short yydefgoto[] =
284 {
285 25, 5
286 };
287
288 static const short yypact[] =
289 {
290 -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
291 -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
292 26, -3,-32768, -9, 34, 21, 53,-32768
293 };
294
295 static const short yypgoto[] =
296 {
297 -32768, -1
298 };
299
300
301 #define YYLAST 53
302
303
304 static const short yytable[] =
305 {
306 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
307 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
308 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
309 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
310 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
311 12, 13, 14, 27
312 };
313
314 static const short yycheck[] =
315 {
316 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
317 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
318 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
319 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
320 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
321 7, 8, 9, 0
322 };
323 #define YYPURE 1
324
325 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
326 #line 3 "/usr/share/bison/bison.simple"
327
328 /* Skeleton output parser for bison,
329 Copyright (C) 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
330
331 This program is free software; you can redistribute it and/or modify
332 it under the terms of the GNU General Public License as published by
333 the Free Software Foundation; either version 2, or (at your option)
334 any later version.
335
336 This program is distributed in the hope that it will be useful,
337 but WITHOUT ANY WARRANTY; without even the implied warranty of
338 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
339 GNU General Public License for more details.
340
341 You should have received a copy of the GNU General Public License
342 along with this program; if not, write to the Free Software
343 Foundation, Inc., 59 Temple Place - Suite 330,
344 Boston, MA 02111-1307, USA. */
345
346 /* As a special exception, when this file is copied by Bison into a
347 Bison output file, you may use that output file without restriction.
348 This special exception was added by the Free Software Foundation
349 in version 1.24 of Bison. */
350
351 /* This is the parser code that is written into each bison parser when
352 the %semantic_parser declaration is not specified in the grammar.
353 It was written by Richard Stallman by simplifying the hairy parser
354 used when %semantic_parser is specified. */
355
356 /* All symbols defined below should begin with yy or YY, to avoid
357 infringing on user name space. This should be done even for local
358 variables, as they might otherwise be expanded by user macros.
359 There are some unavoidable exceptions within include files to
360 define necessary library symbols; they are noted "INFRINGES ON
361 USER NAME SPACE" below. */
362
363 #ifdef __cplusplus
364 # define YYSTD(x) std::x
365 #else
366 # define YYSTD(x) x
367 #endif
368
369 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
370
371 /* The parser invokes alloca or malloc; define the necessary symbols. */
372
373 # if YYSTACK_USE_ALLOCA
374 # define YYSTACK_ALLOC alloca
375 # define YYSIZE_T YYSTD (size_t)
376 # else
377 # ifndef YYSTACK_USE_ALLOCA
378 # if defined (alloca) || defined (_ALLOCA_H)
379 # define YYSTACK_ALLOC alloca
380 # define YYSIZE_T YYSTD (size_t)
381 # else
382 # ifdef __GNUC__
383 # define YYSTACK_ALLOC __builtin_alloca
384 # endif
385 # endif
386 # endif
387 # endif
388
389 # ifdef YYSTACK_ALLOC
390 /* Pacify GCC's `empty if-body' warning. */
391 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
392 # else
393 # ifdef __cplusplus
394 # include <cstdlib> /* INFRINGES ON USER NAME SPACE */
395 # define YYSIZE_T std::size_t
396 # else
397 # ifdef __STDC__
398 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
399 # define YYSIZE_T size_t
400 # endif
401 # endif
402 # define YYSTACK_ALLOC YYSTD (malloc)
403 # define YYSTACK_FREE YYSTD (free)
404 # endif
405
406 /* A type that is properly aligned for any stack member. */
407 union yyalloc
408 {
409 short yyss;
410 YYSTYPE yyvs;
411 # if YYLSP_NEEDED
412 YYLTYPE yyls;
413 # endif
414 };
415
416 /* The size of the maximum gap between one aligned stack and the next. */
417 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
418
419 /* The size of an array large to enough to hold all stacks, each with
420 N elements. */
421 # if YYLSP_NEEDED
422 # define YYSTACK_BYTES(N) \
423 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
424 + 2 * YYSTACK_GAP_MAX)
425 # else
426 # define YYSTACK_BYTES(N) \
427 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
428 + YYSTACK_GAP_MAX)
429 # endif
430
431 /* Relocate the TYPE STACK from its old location to the new one. The
432 local variables YYSIZE and YYSTACKSIZE give the old and new number of
433 elements in the stack, and YYPTR gives the new location of the
434 stack. Advance YYPTR to a properly aligned location for the next
435 stack. */
436 # define YYSTACK_RELOCATE(Type, Stack) \
437 do \
438 { \
439 YYSIZE_T yynewbytes; \
440 yymemcpy ((char *) yyptr, (char *) (Stack), \
441 yysize * (YYSIZE_T) sizeof (Type)); \
442 Stack = &yyptr->Stack; \
443 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
444 yyptr += yynewbytes / sizeof (*yyptr); \
445 } \
446 while (0)
447
448 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
449
450
451 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
452 # define YYSIZE_T __SIZE_TYPE__
453 #endif
454 #if ! defined (YYSIZE_T) && defined (size_t)
455 # define YYSIZE_T size_t
456 #endif
457 #if ! defined (YYSIZE_T)
458 # ifdef __cplusplus
459 # include <cstddef> /* INFRINGES ON USER NAME SPACE */
460 # define YYSIZE_T std::size_t
461 # else
462 # ifdef __STDC__
463 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
464 # define YYSIZE_T size_t
465 # endif
466 # endif
467 #endif
468 #if ! defined (YYSIZE_T)
469 # define YYSIZE_T unsigned int
470 #endif
471
472 #define yyerrok (yyerrstatus = 0)
473 #define yyclearin (yychar = YYEMPTY)
474 #define YYEMPTY -2
475 #define YYEOF 0
476 #define YYACCEPT goto yyacceptlab
477 #define YYABORT goto yyabortlab
478 #define YYERROR goto yyerrlab1
479 /* Like YYERROR except do call yyerror. This remains here temporarily
480 to ease the transition to the new meaning of YYERROR, for GCC.
481 Once GCC version 2 has supplanted version 1, this can go. */
482 #define YYFAIL goto yyerrlab
483 #define YYRECOVERING() (!!yyerrstatus)
484 #define YYBACKUP(Token, Value) \
485 do \
486 if (yychar == YYEMPTY && yylen == 1) \
487 { \
488 yychar = (Token); \
489 yylval = (Value); \
490 yychar1 = YYTRANSLATE (yychar); \
491 YYPOPSTACK; \
492 goto yybackup; \
493 } \
494 else \
495 { \
496 yyerror ("syntax error: cannot back up"); \
497 YYERROR; \
498 } \
499 while (0)
500
501 #define YYTERROR 1
502 #define YYERRCODE 256
503
504
505 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
506 are run).
507
508 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
509 first token. By default, to implement support for ranges, extend
510 its range to the last symbol. */
511
512 #ifndef YYLLOC_DEFAULT
513 # define YYLLOC_DEFAULT(Current, Rhs, N) \
514 Current.last_line = Rhs[N].last_line; \
515 Current.last_column = Rhs[N].last_column;
516 #endif
517
518
519 /* YYLEX -- calling `yylex' with the right arguments. */
520
521 #if YYPURE
522 # if YYLSP_NEEDED
523 # ifdef YYLEX_PARAM
524 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
525 # else
526 # define YYLEX yylex (&yylval, &yylloc)
527 # endif
528 # else /* !YYLSP_NEEDED */
529 # ifdef YYLEX_PARAM
530 # define YYLEX yylex (&yylval, YYLEX_PARAM)
531 # else
532 # define YYLEX yylex (&yylval)
533 # endif
534 # endif /* !YYLSP_NEEDED */
535 #else /* !YYPURE */
536 # define YYLEX yylex ()
537 #endif /* !YYPURE */
538
539
540 /* Enable debugging if requested. */
541 #if YYDEBUG
542
543 # ifndef YYFPRINTF
544 # ifdef __cplusplus
545 # include <cstdio> /* INFRINGES ON USER NAME SPACE */
546 # else
547 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
548 # endif
549 # define YYFPRINTF YYSTD (fprintf)
550 # endif
551
552 # define YYDPRINTF(Args) \
553 do { \
554 if (yydebug) \
555 YYFPRINTF Args; \
556 } while (0)
557 /* Nonzero means print parse trace. [The following comment makes no
558 sense to me. Could someone clarify it? --akim] Since this is
559 uninitialized, it does not stop multiple parsers from coexisting.
560 */
561 int yydebug;
562 #else /* !YYDEBUG */
563 # define YYDPRINTF(Args)
564 #endif /* !YYDEBUG */
565
566 /* YYINITDEPTH -- initial size of the parser's stacks. */
567 #ifndef YYINITDEPTH
568 # define YYINITDEPTH 200
569 #endif
570
571 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
572 if the built-in stack extension method is used).
573
574 Do not make this value too large; the results are undefined if
575 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
576 evaluated with infinite-precision integer arithmetic. */
577
578 #if YYMAXDEPTH == 0
579 # undef YYMAXDEPTH
580 #endif
581
582 #ifndef YYMAXDEPTH
583 # define YYMAXDEPTH 10000
584 #endif
585
586 #if ! defined (yyoverflow) && ! defined (yymemcpy)
587 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
588 # define yymemcpy __builtin_memcpy
589 # else /* not GNU C or C++ */
590
591 /* This is the most reliable way to avoid incompatibilities
592 in available built-in functions on various systems. */
593 static void
594 # if defined (__STDC__) || defined (__cplusplus)
yymemcpy(char * yyto,const char * yyfrom,YYSIZE_T yycount)595 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
596 # else
597 yymemcpy (yyto, yyfrom, yycount)
598 char *yyto;
599 const char *yyfrom;
600 YYSIZE_T yycount;
601 # endif
602 {
603 register const char *yyf = yyfrom;
604 register char *yyt = yyto;
605 register YYSIZE_T yyi = yycount;
606
607 while (yyi-- != 0)
608 *yyt++ = *yyf++;
609 }
610 # endif
611 #endif
612
613 #ifdef YYERROR_VERBOSE
614
615 # ifndef yystrlen
616 # if defined (__GLIBC__) && defined (_STRING_H)
617 # define yystrlen strlen
618 # else
619 /* Return the length of YYSTR. */
620 static YYSIZE_T
621 # if defined (__STDC__) || defined (__cplusplus)
yystrlen(const char * yystr)622 yystrlen (const char *yystr)
623 # else
624 yystrlen (yystr)
625 const char *yystr;
626 # endif
627 {
628 register const char *yys = yystr;
629
630 while (*yys++ != '\0')
631 continue;
632
633 return yys - yystr - 1;
634 }
635 # endif
636 # endif
637
638 # ifndef yystpcpy
639 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
640 # define yystpcpy stpcpy
641 # else
642 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
643 YYDEST. */
644 static char *
645 # if defined (__STDC__) || defined (__cplusplus)
yystpcpy(char * yydest,const char * yysrc)646 yystpcpy (char *yydest, const char *yysrc)
647 # else
648 yystpcpy (yydest, yysrc)
649 char *yydest;
650 const char *yysrc;
651 # endif
652 {
653 register char *yyd = yydest;
654 register const char *yys = yysrc;
655
656 while ((*yyd++ = *yys++) != '\0')
657 continue;
658
659 return yyd - 1;
660 }
661 # endif
662 # endif
663 #endif
664
665 #line 341 "/usr/share/bison/bison.simple"
666
667
668 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
669 into yyparse. The argument should have type void *.
670 It should actually point to an object.
671 Grammar actions can access the variable by casting it
672 to the proper pointer type. */
673
674 #ifdef YYPARSE_PARAM
675 # ifdef __cplusplus
676 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
677 # define YYPARSE_PARAM_DECL
678 # else /* !__cplusplus */
679 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
680 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
681 # endif /* !__cplusplus */
682 #else /* !YYPARSE_PARAM */
683 # define YYPARSE_PARAM_ARG
684 # define YYPARSE_PARAM_DECL
685 #endif /* !YYPARSE_PARAM */
686
687 /* Prevent warning if -Wstrict-prototypes. */
688 #ifdef __GNUC__
689 # ifdef YYPARSE_PARAM
690 int yyparse (void *);
691 # else
692 int yyparse (void);
693 # endif
694 #endif
695
696 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
697 variables are global, or local to YYPARSE. */
698
699 #define YY_DECL_NON_LSP_VARIABLES \
700 /* The lookahead symbol. */ \
701 int yychar; \
702 \
703 /* The semantic value of the lookahead symbol. */ \
704 YYSTYPE yylval; \
705 \
706 /* Number of parse errors so far. */ \
707 int yynerrs;
708
709 #if YYLSP_NEEDED
710 # define YY_DECL_VARIABLES \
711 YY_DECL_NON_LSP_VARIABLES \
712 \
713 /* Location data for the lookahead symbol. */ \
714 YYLTYPE yylloc;
715 #else
716 # define YY_DECL_VARIABLES \
717 YY_DECL_NON_LSP_VARIABLES
718 #endif
719
720
721 /* If nonreentrant, generate the variables here. */
722
723 #if !YYPURE
724 YY_DECL_VARIABLES
725 #endif /* !YYPURE */
726
727 int
yyparse(YYPARSE_PARAM_ARG)728 yyparse (YYPARSE_PARAM_ARG)
729 YYPARSE_PARAM_DECL
730 {
731 /* If reentrant, generate the variables here. */
732 #if YYPURE
733 YY_DECL_VARIABLES
734 #endif /* !YYPURE */
735
736 register int yystate;
737 register int yyn;
738 int yyresult;
739 /* Number of tokens to shift before error messages enabled. */
740 int yyerrstatus;
741 /* Lookahead token as an internal (translated) token number. */
742 int yychar1 = 0;
743
744 /* Three stacks and their tools:
745 `yyss': related to states,
746 `yyvs': related to semantic values,
747 `yyls': related to locations.
748
749 Refer to the stacks thru separate pointers, to allow yyoverflow
750 to reallocate them elsewhere. */
751
752 /* The state stack. */
753 short yyssa[YYINITDEPTH];
754 short *yyss = yyssa;
755 register short *yyssp;
756
757 /* The semantic value stack. */
758 YYSTYPE yyvsa[YYINITDEPTH];
759 YYSTYPE *yyvs = yyvsa;
760 register YYSTYPE *yyvsp;
761
762 #if YYLSP_NEEDED
763 /* The location stack. */
764 YYLTYPE yylsa[YYINITDEPTH];
765 YYLTYPE *yyls = yylsa;
766 YYLTYPE *yylsp;
767 #endif
768
769 #if YYLSP_NEEDED
770 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
771 #else
772 # define YYPOPSTACK (yyvsp--, yyssp--)
773 #endif
774
775 YYSIZE_T yystacksize = YYINITDEPTH;
776
777
778 /* The variables used to return semantic value and location from the
779 action routines. */
780 YYSTYPE yyval;
781 #if YYLSP_NEEDED
782 YYLTYPE yyloc;
783 #endif
784
785 /* When reducing, the number of symbols on the RHS of the reduced
786 rule. */
787 int yylen;
788
789 YYDPRINTF ((stderr, "Starting parse\n"));
790
791 yystate = 0;
792 yyerrstatus = 0;
793 yynerrs = 0;
794 yychar = YYEMPTY; /* Cause a token to be read. */
795
796 /* Initialize stack pointers.
797 Waste one element of value and location stack
798 so that they stay on the same level as the state stack.
799 The wasted elements are never initialized. */
800
801 yyssp = yyss;
802 yyvsp = yyvs;
803 #if YYLSP_NEEDED
804 yylsp = yyls;
805 #endif
806 goto yysetstate;
807
808 /*------------------------------------------------------------.
809 | yynewstate -- Push a new state, which is found in yystate. |
810 `------------------------------------------------------------*/
811 yynewstate:
812 /* In all cases, when you get here, the value and location stacks
813 have just been pushed. so pushing a state here evens the stacks.
814 */
815 yyssp++;
816
817 yysetstate:
818 *yyssp = yystate;
819
820 if (yyssp >= yyss + yystacksize - 1)
821 {
822 /* Get the current used size of the three stacks, in elements. */
823 YYSIZE_T yysize = yyssp - yyss + 1;
824
825 #ifdef yyoverflow
826 {
827 /* Give user a chance to reallocate the stack. Use copies of
828 these so that the &'s don't force the real ones into
829 memory. */
830 YYSTYPE *yyvs1 = yyvs;
831 short *yyss1 = yyss;
832
833 /* Each stack pointer address is followed by the size of the
834 data in use in that stack, in bytes. */
835 # if YYLSP_NEEDED
836 YYLTYPE *yyls1 = yyls;
837 /* This used to be a conditional around just the two extra args,
838 but that might be undefined if yyoverflow is a macro. */
839 yyoverflow ("parser stack overflow",
840 &yyss1, yysize * sizeof (*yyssp),
841 &yyvs1, yysize * sizeof (*yyvsp),
842 &yyls1, yysize * sizeof (*yylsp),
843 &yystacksize);
844 yyls = yyls1;
845 # else
846 yyoverflow ("parser stack overflow",
847 &yyss1, yysize * sizeof (*yyssp),
848 &yyvs1, yysize * sizeof (*yyvsp),
849 &yystacksize);
850 # endif
851 yyss = yyss1;
852 yyvs = yyvs1;
853 }
854 #else /* no yyoverflow */
855 /* Extend the stack our own way. */
856 if (yystacksize >= YYMAXDEPTH)
857 goto yyoverflowlab;
858 yystacksize *= 2;
859 if (yystacksize > YYMAXDEPTH)
860 yystacksize = YYMAXDEPTH;
861
862 {
863 short *yyss1 = yyss;
864 union yyalloc *yyptr =
865 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
866 if (! yyptr)
867 goto yyoverflowlab;
868 YYSTACK_RELOCATE (short, yyss);
869 YYSTACK_RELOCATE (YYSTYPE, yyvs);
870 # if YYLSP_NEEDED
871 YYSTACK_RELOCATE (YYLTYPE, yyls);
872 # endif
873 # undef YYSTACK_RELOCATE
874 if (yyss1 != yyssa)
875 YYSTACK_FREE (yyss1);
876 }
877 #endif /* no yyoverflow */
878
879 yyssp = yyss + yysize - 1;
880 yyvsp = yyvs + yysize - 1;
881 #if YYLSP_NEEDED
882 yylsp = yyls + yysize - 1;
883 #endif
884
885 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
886 (unsigned long int) yystacksize));
887
888 if (yyssp >= yyss + yystacksize - 1)
889 YYABORT;
890 }
891
892 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
893
894 goto yybackup;
895
896
897 /*-----------.
898 | yybackup. |
899 `-----------*/
900 yybackup:
901
902 /* Do appropriate processing given the current state. */
903 /* Read a lookahead token if we need one and don't already have one. */
904 /* yyresume: */
905
906 /* First try to decide what to do without reference to lookahead token. */
907
908 yyn = yypact[yystate];
909 if (yyn == YYFLAG)
910 goto yydefault;
911
912 /* Not known => get a lookahead token if don't already have one. */
913
914 /* yychar is either YYEMPTY or YYEOF
915 or a valid token in external form. */
916
917 if (yychar == YYEMPTY)
918 {
919 YYDPRINTF ((stderr, "Reading a token: "));
920 yychar = YYLEX;
921 }
922
923 /* Convert token to internal form (in yychar1) for indexing tables with */
924
925 if (yychar <= 0) /* This means end of input. */
926 {
927 yychar1 = 0;
928 yychar = YYEOF; /* Don't call YYLEX any more */
929
930 YYDPRINTF ((stderr, "Now at end of input.\n"));
931 }
932 else
933 {
934 yychar1 = YYTRANSLATE (yychar);
935
936 #if YYDEBUG
937 /* We have to keep this `#if YYDEBUG', since we use variables
938 which are defined only if `YYDEBUG' is set. */
939 if (yydebug)
940 {
941 YYFPRINTF (stderr, "Next token is %d (%s",
942 yychar, yytname[yychar1]);
943 /* Give the individual parser a way to print the precise
944 meaning of a token, for further debugging info. */
945 # ifdef YYPRINT
946 YYPRINT (stderr, yychar, yylval);
947 # endif
948 YYFPRINTF (stderr, ")\n");
949 }
950 #endif
951 }
952
953 yyn += yychar1;
954 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
955 goto yydefault;
956
957 yyn = yytable[yyn];
958
959 /* yyn is what to do for this token type in this state.
960 Negative => reduce, -yyn is rule number.
961 Positive => shift, yyn is new state.
962 New state is final state => don't bother to shift,
963 just return success.
964 0, or most negative number => error. */
965
966 if (yyn < 0)
967 {
968 if (yyn == YYFLAG)
969 goto yyerrlab;
970 yyn = -yyn;
971 goto yyreduce;
972 }
973 else if (yyn == 0)
974 goto yyerrlab;
975
976 if (yyn == YYFINAL)
977 YYACCEPT;
978
979 /* Shift the lookahead token. */
980 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
981 yychar, yytname[yychar1]));
982
983 /* Discard the token being shifted unless it is eof. */
984 if (yychar != YYEOF)
985 yychar = YYEMPTY;
986
987 *++yyvsp = yylval;
988 #if YYLSP_NEEDED
989 *++yylsp = yylloc;
990 #endif
991
992 /* Count tokens shifted since error; after three, turn off error
993 status. */
994 if (yyerrstatus)
995 yyerrstatus--;
996
997 yystate = yyn;
998 goto yynewstate;
999
1000
1001 /*-----------------------------------------------------------.
1002 | yydefault -- do the default action for the current state. |
1003 `-----------------------------------------------------------*/
1004 yydefault:
1005 yyn = yydefact[yystate];
1006 if (yyn == 0)
1007 goto yyerrlab;
1008 goto yyreduce;
1009
1010
1011 /*-----------------------------.
1012 | yyreduce -- Do a reduction. |
1013 `-----------------------------*/
1014 yyreduce:
1015 /* yyn is the number of a rule to reduce with. */
1016 yylen = yyr2[yyn];
1017
1018 /* If YYLEN is nonzero, implement the default value of the action:
1019 `$$ = $1'.
1020
1021 Otherwise, the following line sets YYVAL to the semantic value of
1022 the lookahead token. This behavior is undocumented and Bison
1023 users should not rely upon it. Assigning to YYVAL
1024 unconditionally makes the parser a bit smaller, and it avoids a
1025 GCC warning that YYVAL may be used uninitialized. */
1026 yyval = yyvsp[1-yylen];
1027
1028 #if YYLSP_NEEDED
1029 /* Similarly for the default location. Let the user run additional
1030 commands if for instance locations are ranges. */
1031 yyloc = yylsp[1-yylen];
1032 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1033 #endif
1034
1035 #if YYDEBUG
1036 /* We have to keep this `#if YYDEBUG', since we use variables which
1037 are defined only if `YYDEBUG' is set. */
1038 if (yydebug)
1039 {
1040 int yyi;
1041
1042 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1043 yyn, yyrline[yyn]);
1044
1045 /* Print the symbols being reduced, and their result. */
1046 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
1047 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1048 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1049 }
1050 #endif
1051
1052 switch (yyn) {
1053
1054 case 1:
1055 #line 179 "plural.y"
1056 {
1057 if (yyvsp[0].exp == NULL)
1058 YYABORT;
1059 ((struct parse_args *) arg)->res = yyvsp[0].exp;
1060 }
1061 break;
1062 case 2:
1063 #line 187 "plural.y"
1064 {
1065 yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
1066 }
1067 break;
1068 case 3:
1069 #line 191 "plural.y"
1070 {
1071 yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
1072 }
1073 break;
1074 case 4:
1075 #line 195 "plural.y"
1076 {
1077 yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
1078 }
1079 break;
1080 case 5:
1081 #line 199 "plural.y"
1082 {
1083 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1084 }
1085 break;
1086 case 6:
1087 #line 203 "plural.y"
1088 {
1089 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1090 }
1091 break;
1092 case 7:
1093 #line 207 "plural.y"
1094 {
1095 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1096 }
1097 break;
1098 case 8:
1099 #line 211 "plural.y"
1100 {
1101 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
1102 }
1103 break;
1104 case 9:
1105 #line 215 "plural.y"
1106 {
1107 yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
1108 }
1109 break;
1110 case 10:
1111 #line 219 "plural.y"
1112 {
1113 yyval.exp = new_exp_0 (var);
1114 }
1115 break;
1116 case 11:
1117 #line 223 "plural.y"
1118 {
1119 if ((yyval.exp = new_exp_0 (num)) != NULL)
1120 yyval.exp->val.num = yyvsp[0].num;
1121 }
1122 break;
1123 case 12:
1124 #line 228 "plural.y"
1125 {
1126 yyval.exp = yyvsp[-1].exp;
1127 }
1128 break;
1129 }
1130
1131 #line 727 "/usr/share/bison/bison.simple"
1132
1133
1134 yyvsp -= yylen;
1135 yyssp -= yylen;
1136 #if YYLSP_NEEDED
1137 yylsp -= yylen;
1138 #endif
1139
1140 #if YYDEBUG
1141 if (yydebug)
1142 {
1143 short *yyssp1 = yyss - 1;
1144 YYFPRINTF (stderr, "state stack now");
1145 while (yyssp1 != yyssp)
1146 YYFPRINTF (stderr, " %d", *++yyssp1);
1147 YYFPRINTF (stderr, "\n");
1148 }
1149 #endif
1150
1151 *++yyvsp = yyval;
1152 #if YYLSP_NEEDED
1153 *++yylsp = yyloc;
1154 #endif
1155
1156 /* Now `shift' the result of the reduction. Determine what state
1157 that goes to, based on the state we popped back to and the rule
1158 number reduced by. */
1159
1160 yyn = yyr1[yyn];
1161
1162 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1163 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1164 yystate = yytable[yystate];
1165 else
1166 yystate = yydefgoto[yyn - YYNTBASE];
1167
1168 goto yynewstate;
1169
1170
1171 /*------------------------------------.
1172 | yyerrlab -- here on detecting error |
1173 `------------------------------------*/
1174 yyerrlab:
1175 /* If not already recovering from an error, report this error. */
1176 if (!yyerrstatus)
1177 {
1178 ++yynerrs;
1179
1180 #ifdef YYERROR_VERBOSE
1181 yyn = yypact[yystate];
1182
1183 if (yyn > YYFLAG && yyn < YYLAST)
1184 {
1185 YYSIZE_T yysize = 0;
1186 char *yymsg;
1187 int yyx, yycount;
1188
1189 yycount = 0;
1190 /* Start YYX at -YYN if negative to avoid negative indexes in
1191 YYCHECK. */
1192 for (yyx = yyn < 0 ? -yyn : 0;
1193 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1194 if (yycheck[yyx + yyn] == yyx)
1195 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1196 yysize += yystrlen ("parse error, unexpected ") + 1;
1197 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1198 yymsg = (char *) YYSTACK_ALLOC (yysize);
1199 if (yymsg != 0)
1200 {
1201 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1202 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1203
1204 if (yycount < 5)
1205 {
1206 yycount = 0;
1207 for (yyx = yyn < 0 ? -yyn : 0;
1208 yyx < (int) (sizeof (yytname) / sizeof (char *));
1209 yyx++)
1210 if (yycheck[yyx + yyn] == yyx)
1211 {
1212 const char *yyq = ! yycount ? ", expecting " : " or ";
1213 yyp = yystpcpy (yyp, yyq);
1214 yyp = yystpcpy (yyp, yytname[yyx]);
1215 yycount++;
1216 }
1217 }
1218 yyerror (yymsg);
1219 YYSTACK_FREE (yymsg);
1220 }
1221 else
1222 yyerror ("parse error; also virtual memory exhausted");
1223 }
1224 else
1225 #endif /* defined (YYERROR_VERBOSE) */
1226 yyerror ("parse error");
1227 }
1228 goto yyerrlab1;
1229
1230
1231 /*--------------------------------------------------.
1232 | yyerrlab1 -- error raised explicitly by an action |
1233 `--------------------------------------------------*/
1234 yyerrlab1:
1235 if (yyerrstatus == 3)
1236 {
1237 /* If just tried and failed to reuse lookahead token after an
1238 error, discard it. */
1239
1240 /* return failure if at end of input */
1241 if (yychar == YYEOF)
1242 YYABORT;
1243 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1244 yychar, yytname[yychar1]));
1245 yychar = YYEMPTY;
1246 }
1247
1248 /* Else will try to reuse lookahead token after shifting the error
1249 token. */
1250
1251 yyerrstatus = 3; /* Each real token shifted decrements this */
1252
1253 goto yyerrhandle;
1254
1255
1256 /*-------------------------------------------------------------------.
1257 | yyerrdefault -- current state does not do anything special for the |
1258 | error token. |
1259 `-------------------------------------------------------------------*/
1260 yyerrdefault:
1261 #if 0
1262 /* This is wrong; only states that explicitly want error tokens
1263 should shift them. */
1264
1265 /* If its default is to accept any token, ok. Otherwise pop it. */
1266 yyn = yydefact[yystate];
1267 if (yyn)
1268 goto yydefault;
1269 #endif
1270
1271
1272 /*---------------------------------------------------------------.
1273 | yyerrpop -- pop the current state because it cannot handle the |
1274 | error token |
1275 `---------------------------------------------------------------*/
1276 yyerrpop:
1277 if (yyssp == yyss)
1278 YYABORT;
1279 yyvsp--;
1280 yystate = *--yyssp;
1281 #if YYLSP_NEEDED
1282 yylsp--;
1283 #endif
1284
1285 #if YYDEBUG
1286 if (yydebug)
1287 {
1288 short *yyssp1 = yyss - 1;
1289 YYFPRINTF (stderr, "Error: state stack now");
1290 while (yyssp1 != yyssp)
1291 YYFPRINTF (stderr, " %d", *++yyssp1);
1292 YYFPRINTF (stderr, "\n");
1293 }
1294 #endif
1295
1296 /*--------------.
1297 | yyerrhandle. |
1298 `--------------*/
1299 yyerrhandle:
1300 yyn = yypact[yystate];
1301 if (yyn == YYFLAG)
1302 goto yyerrdefault;
1303
1304 yyn += YYTERROR;
1305 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1306 goto yyerrdefault;
1307
1308 yyn = yytable[yyn];
1309 if (yyn < 0)
1310 {
1311 if (yyn == YYFLAG)
1312 goto yyerrpop;
1313 yyn = -yyn;
1314 goto yyreduce;
1315 }
1316 else if (yyn == 0)
1317 goto yyerrpop;
1318
1319 if (yyn == YYFINAL)
1320 YYACCEPT;
1321
1322 YYDPRINTF ((stderr, "Shifting error token, "));
1323
1324 *++yyvsp = yylval;
1325 #if YYLSP_NEEDED
1326 *++yylsp = yylloc;
1327 #endif
1328
1329 yystate = yyn;
1330 goto yynewstate;
1331
1332
1333 /*-------------------------------------.
1334 | yyacceptlab -- YYACCEPT comes here. |
1335 `-------------------------------------*/
1336 yyacceptlab:
1337 yyresult = 0;
1338 goto yyreturn;
1339
1340 /*-----------------------------------.
1341 | yyabortlab -- YYABORT comes here. |
1342 `-----------------------------------*/
1343 yyabortlab:
1344 yyresult = 1;
1345 goto yyreturn;
1346
1347 /*---------------------------------------------.
1348 | yyoverflowab -- parser overflow comes here. |
1349 `---------------------------------------------*/
1350 yyoverflowlab:
1351 yyerror ("parser stack overflow");
1352 yyresult = 2;
1353 /* Fall through. */
1354
1355 yyreturn:
1356 #ifndef yyoverflow
1357 if (yyss != yyssa)
1358 YYSTACK_FREE (yyss);
1359 #endif
1360 return yyresult;
1361 }
1362 #line 233 "plural.y"
1363
1364
1365 void
1366 internal_function
FREE_EXPRESSION(exp)1367 FREE_EXPRESSION (exp)
1368 struct expression *exp;
1369 {
1370 if (exp == NULL)
1371 return;
1372
1373 /* Handle the recursive case. */
1374 switch (exp->nargs)
1375 {
1376 case 3:
1377 FREE_EXPRESSION (exp->val.args[2]);
1378 /* FALLTHROUGH */
1379 case 2:
1380 FREE_EXPRESSION (exp->val.args[1]);
1381 /* FALLTHROUGH */
1382 case 1:
1383 FREE_EXPRESSION (exp->val.args[0]);
1384 /* FALLTHROUGH */
1385 default:
1386 break;
1387 }
1388
1389 free (exp);
1390 }
1391
1392
1393 static int
yylex(lval,pexp)1394 yylex (lval, pexp)
1395 YYSTYPE *lval;
1396 const char **pexp;
1397 {
1398 const char *exp = *pexp;
1399 int result;
1400
1401 while (1)
1402 {
1403 if (exp[0] == '\0')
1404 {
1405 *pexp = exp;
1406 return YYEOF;
1407 }
1408
1409 if (exp[0] != ' ' && exp[0] != '\t')
1410 break;
1411
1412 ++exp;
1413 }
1414
1415 result = *exp++;
1416 switch (result)
1417 {
1418 case '0': case '1': case '2': case '3': case '4':
1419 case '5': case '6': case '7': case '8': case '9':
1420 {
1421 unsigned long int n = result - '0';
1422 while (exp[0] >= '0' && exp[0] <= '9')
1423 {
1424 n *= 10;
1425 n += exp[0] - '0';
1426 ++exp;
1427 }
1428 lval->num = n;
1429 result = NUMBER;
1430 }
1431 break;
1432
1433 case '=':
1434 if (exp[0] == '=')
1435 {
1436 ++exp;
1437 lval->op = equal;
1438 result = EQUOP2;
1439 }
1440 else
1441 result = YYERRCODE;
1442 break;
1443
1444 case '!':
1445 if (exp[0] == '=')
1446 {
1447 ++exp;
1448 lval->op = not_equal;
1449 result = EQUOP2;
1450 }
1451 break;
1452
1453 case '&':
1454 case '|':
1455 if (exp[0] == result)
1456 ++exp;
1457 else
1458 result = YYERRCODE;
1459 break;
1460
1461 case '<':
1462 if (exp[0] == '=')
1463 {
1464 ++exp;
1465 lval->op = less_or_equal;
1466 }
1467 else
1468 lval->op = less_than;
1469 result = CMPOP2;
1470 break;
1471
1472 case '>':
1473 if (exp[0] == '=')
1474 {
1475 ++exp;
1476 lval->op = greater_or_equal;
1477 }
1478 else
1479 lval->op = greater_than;
1480 result = CMPOP2;
1481 break;
1482
1483 case '*':
1484 lval->op = mult;
1485 result = MULOP2;
1486 break;
1487
1488 case '/':
1489 lval->op = divide;
1490 result = MULOP2;
1491 break;
1492
1493 case '%':
1494 lval->op = module;
1495 result = MULOP2;
1496 break;
1497
1498 case '+':
1499 lval->op = plus;
1500 result = ADDOP2;
1501 break;
1502
1503 case '-':
1504 lval->op = minus;
1505 result = ADDOP2;
1506 break;
1507
1508 case 'n':
1509 case '?':
1510 case ':':
1511 case '(':
1512 case ')':
1513 /* Nothing, just return the character. */
1514 break;
1515
1516 case ';':
1517 case '\n':
1518 case '\0':
1519 /* Be safe and let the user call this function again. */
1520 --exp;
1521 result = YYEOF;
1522 break;
1523
1524 default:
1525 result = YYERRCODE;
1526 #if YYDEBUG != 0
1527 --exp;
1528 #endif
1529 break;
1530 }
1531
1532 *pexp = exp;
1533
1534 return result;
1535 }
1536
1537
1538 static void
yyerror(str)1539 yyerror (str)
1540 const char *str;
1541 {
1542 /* Do nothing. We don't print error messages here. */
1543 }
1544