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