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