00001
00002
00003
00004
00005 #define YYBISON 1
00006
00007 #define yyparse __gettextparse
00008 #define yylex __gettextlex
00009 #define yyerror __gettexterror
00010 #define yylval __gettextlval
00011 #define yychar __gettextchar
00012 #define yydebug __gettextdebug
00013 #define yynerrs __gettextnerrs
00014 #define EQUOP2 257
00015 #define CMPOP2 258
00016 #define ADDOP2 259
00017 #define MULOP2 260
00018 #define NUMBER 261
00019
00020 #line 1 "plural.y"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #if defined _AIX && !defined __GNUC__
00046 #pragma alloca
00047 #endif
00048
00049 #ifdef HAVE_CONFIG_H
00050 # include <config.h>
00051 #endif
00052
00053 #include <stddef.h>
00054 #include <stdlib.h>
00055 #include "plural-exp.h"
00056
00057
00058
00059 #ifndef _LIBC
00060 # define __gettextparse PLURAL_PARSE
00061 #endif
00062
00063 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
00064 #define YYPARSE_PARAM arg
00065
00066 #line 49 "plural.y"
00067 typedef union {
00068 unsigned long int num;
00069 enum operator op;
00070 struct expression *exp;
00071 } YYSTYPE;
00072 #line 55 "plural.y"
00073
00074
00075 static struct expression *new_exp PARAMS ((int nargs, enum operator op,
00076 struct expression * const *args));
00077 static inline struct expression *new_exp_0 PARAMS ((enum operator op));
00078 static inline struct expression *new_exp_1 PARAMS ((enum operator op,
00079 struct expression *right));
00080 static struct expression *new_exp_2 PARAMS ((enum operator op,
00081 struct expression *left,
00082 struct expression *right));
00083 static inline struct expression *new_exp_3 PARAMS ((enum operator op,
00084 struct expression *bexp,
00085 struct expression *tbranch,
00086 struct expression *fbranch));
00087 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
00088 static void yyerror PARAMS ((const char *str));
00089
00090
00091
00092 static struct expression *
00093 new_exp (nargs, op, args)
00094 int nargs;
00095 enum operator op;
00096 struct expression * const *args;
00097 {
00098 int i;
00099 struct expression *newp;
00100
00101
00102 for (i = nargs - 1; i >= 0; i--)
00103 if (args[i] == NULL)
00104 goto fail;
00105
00106
00107 newp = (struct expression *) malloc (sizeof (*newp));
00108 if (newp != NULL)
00109 {
00110 newp->nargs = nargs;
00111 newp->operation = op;
00112 for (i = nargs - 1; i >= 0; i--)
00113 newp->val.args[i] = args[i];
00114 return newp;
00115 }
00116
00117 fail:
00118 for (i = nargs - 1; i >= 0; i--)
00119 FREE_EXPRESSION (args[i]);
00120
00121 return NULL;
00122 }
00123
00124 static inline struct expression *
00125 new_exp_0 (op)
00126 enum operator op;
00127 {
00128 return new_exp (0, op, NULL);
00129 }
00130
00131 static inline struct expression *
00132 new_exp_1 (op, right)
00133 enum operator op;
00134 struct expression *right;
00135 {
00136 struct expression *args[1];
00137
00138 args[0] = right;
00139 return new_exp (1, op, args);
00140 }
00141
00142 static struct expression *
00143 new_exp_2 (op, left, right)
00144 enum operator op;
00145 struct expression *left;
00146 struct expression *right;
00147 {
00148 struct expression *args[2];
00149
00150 args[0] = left;
00151 args[1] = right;
00152 return new_exp (2, op, args);
00153 }
00154
00155 static inline struct expression *
00156 new_exp_3 (op, bexp, tbranch, fbranch)
00157 enum operator op;
00158 struct expression *bexp;
00159 struct expression *tbranch;
00160 struct expression *fbranch;
00161 {
00162 struct expression *args[3];
00163
00164 args[0] = bexp;
00165 args[1] = tbranch;
00166 args[2] = fbranch;
00167 return new_exp (3, op, args);
00168 }
00169
00170 #include <stdio.h>
00171
00172 #ifndef __cplusplus
00173 #ifndef __STDC__
00174 #define const
00175 #endif
00176 #endif
00177
00178
00179
00180 #define YYFINAL 27
00181 #define YYFLAG -32768
00182 #define YYNTBASE 16
00183
00184 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
00185
00186 static const char yytranslate[] = { 0,
00187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00190 2, 2, 10, 2, 2, 2, 2, 5, 2, 14,
00191 15, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00192 2, 2, 2, 2, 2, 2, 2, 12, 2, 2,
00193 2, 2, 3, 2, 2, 2, 2, 2, 2, 2,
00194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00197 2, 2, 2, 2, 2, 2, 2, 2, 2, 13,
00198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00199 2, 2, 2, 4, 2, 2, 2, 2, 2, 2,
00200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00212 2, 2, 2, 2, 2, 1, 6, 7, 8, 9,
00213 11
00214 };
00215
00216 #if YYDEBUG != 0
00217 static const short yyprhs[] = { 0,
00218 0, 2, 8, 12, 16, 20, 24, 28, 32, 35,
00219 37, 39
00220 };
00221
00222 static const short yyrhs[] = { 17,
00223 0, 17, 3, 17, 12, 17, 0, 17, 4, 17,
00224 0, 17, 5, 17, 0, 17, 6, 17, 0, 17,
00225 7, 17, 0, 17, 8, 17, 0, 17, 9, 17,
00226 0, 10, 17, 0, 13, 0, 11, 0, 14, 17,
00227 15, 0
00228 };
00229
00230 #endif
00231
00232 #if YYDEBUG != 0
00233 static const short yyrline[] = { 0,
00234 174, 182, 186, 190, 194, 198, 202, 206, 210, 214,
00235 218, 223
00236 };
00237 #endif
00238
00239
00240 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
00241
00242 static const char * const yytname[] = { "$","error","$undefined.","'?'","'|'",
00243 "'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'",
00244 "start","exp", NULL
00245 };
00246 #endif
00247
00248 static const short yyr1[] = { 0,
00249 16, 17, 17, 17, 17, 17, 17, 17, 17, 17,
00250 17, 17
00251 };
00252
00253 static const short yyr2[] = { 0,
00254 1, 5, 3, 3, 3, 3, 3, 3, 2, 1,
00255 1, 3
00256 };
00257
00258 static const short yydefact[] = { 0,
00259 0, 11, 10, 0, 1, 9, 0, 0, 0, 0,
00260 0, 0, 0, 0, 12, 0, 3, 4, 5, 6,
00261 7, 8, 0, 2, 0, 0, 0
00262 };
00263
00264 static const short yydefgoto[] = { 25,
00265 5
00266 };
00267
00268 static const short yypact[] = { -9,
00269 -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9,
00270 -9, -9, -9, -9,-32768, 24, 39, 43, 16, 26,
00271 -3,-32768, -9, 34, 21, 53,-32768
00272 };
00273
00274 static const short yypgoto[] = {-32768,
00275 -1
00276 };
00277
00278
00279 #define YYLAST 53
00280
00281
00282 static const short yytable[] = { 6,
00283 1, 2, 7, 3, 4, 14, 16, 17, 18, 19,
00284 20, 21, 22, 8, 9, 10, 11, 12, 13, 14,
00285 26, 24, 12, 13, 14, 15, 8, 9, 10, 11,
00286 12, 13, 14, 13, 14, 23, 8, 9, 10, 11,
00287 12, 13, 14, 10, 11, 12, 13, 14, 11, 12,
00288 13, 14, 27
00289 };
00290
00291 static const short yycheck[] = { 1,
00292 10, 11, 4, 13, 14, 9, 8, 9, 10, 11,
00293 12, 13, 14, 3, 4, 5, 6, 7, 8, 9,
00294 0, 23, 7, 8, 9, 15, 3, 4, 5, 6,
00295 7, 8, 9, 8, 9, 12, 3, 4, 5, 6,
00296 7, 8, 9, 5, 6, 7, 8, 9, 6, 7,
00297 8, 9, 0
00298 };
00299 #define YYPURE 1
00300
00301
00302 #line 3 "/usr/local/share/bison.simple"
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333 #ifndef YYSTACK_USE_ALLOCA
00334 #ifdef alloca
00335 #define YYSTACK_USE_ALLOCA
00336 #else
00337 #ifdef __GNUC__
00338 #define YYSTACK_USE_ALLOCA
00339 #define alloca __builtin_alloca
00340 #else
00341 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
00342 #define YYSTACK_USE_ALLOCA
00343 #include <alloca.h>
00344 #else
00345
00346
00347
00348 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
00349 #if 0
00350
00351 #include <malloc.h>
00352 #endif
00353 #else
00354 #if defined(_AIX)
00355
00356
00357
00358 #pragma alloca
00359 #define YYSTACK_USE_ALLOCA
00360 #else
00361 #if 0
00362 #ifdef __hpux
00363
00364 #define YYSTACK_USE_ALLOCA
00365 #define alloca __builtin_alloca
00366 #endif
00367 #endif
00368 #endif
00369 #endif
00370 #endif
00371 #endif
00372 #endif
00373 #endif
00374
00375 #ifdef YYSTACK_USE_ALLOCA
00376 #define YYSTACK_ALLOC alloca
00377 #else
00378 #define YYSTACK_ALLOC malloc
00379 #endif
00380
00381
00382
00383
00384
00385 #define yyerrok (yyerrstatus = 0)
00386 #define yyclearin (yychar = YYEMPTY)
00387 #define YYEMPTY -2
00388 #define YYEOF 0
00389 #define YYACCEPT goto yyacceptlab
00390 #define YYABORT goto yyabortlab
00391 #define YYERROR goto yyerrlab1
00392
00393
00394
00395
00396 #define YYFAIL goto yyerrlab
00397 #define YYRECOVERING() (!!yyerrstatus)
00398 #define YYBACKUP(token, value) \
00399 do \
00400 if (yychar == YYEMPTY && yylen == 1) \
00401 { yychar = (token), yylval = (value); \
00402 yychar1 = YYTRANSLATE (yychar); \
00403 YYPOPSTACK; \
00404 goto yybackup; \
00405 } \
00406 else \
00407 { yyerror ("syntax error: cannot back up"); YYERROR; } \
00408 while (0)
00409
00410 #define YYTERROR 1
00411 #define YYERRCODE 256
00412
00413 #ifndef YYPURE
00414 #define YYLEX yylex()
00415 #endif
00416
00417 #ifdef YYPURE
00418 #ifdef YYLSP_NEEDED
00419 #ifdef YYLEX_PARAM
00420 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
00421 #else
00422 #define YYLEX yylex(&yylval, &yylloc)
00423 #endif
00424 #else
00425 #ifdef YYLEX_PARAM
00426 #define YYLEX yylex(&yylval, YYLEX_PARAM)
00427 #else
00428 #define YYLEX yylex(&yylval)
00429 #endif
00430 #endif
00431 #endif
00432
00433
00434
00435 #ifndef YYPURE
00436
00437 int yychar;
00438 YYSTYPE yylval;
00439
00440
00441 #ifdef YYLSP_NEEDED
00442 YYLTYPE yylloc;
00443
00444 #endif
00445
00446 int yynerrs;
00447 #endif
00448
00449 #if YYDEBUG != 0
00450 int yydebug;
00451
00452
00453 #endif
00454
00455
00456
00457 #ifndef YYINITDEPTH
00458 #define YYINITDEPTH 200
00459 #endif
00460
00461
00462
00463
00464 #if YYMAXDEPTH == 0
00465 #undef YYMAXDEPTH
00466 #endif
00467
00468 #ifndef YYMAXDEPTH
00469 #define YYMAXDEPTH 10000
00470 #endif
00471
00472
00473
00474
00475
00476
00477 #if __GNUC__ > 1
00478 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
00479 #else
00480 #ifndef __cplusplus
00481
00482
00483
00484 static void
00485 __yy_memcpy (to, from, count)
00486 char *to;
00487 char *from;
00488 unsigned int count;
00489 {
00490 register char *f = from;
00491 register char *t = to;
00492 register int i = count;
00493
00494 while (i-- > 0)
00495 *t++ = *f++;
00496 }
00497
00498 #else
00499
00500
00501
00502 static void
00503 __yy_memcpy (char *to, char *from, unsigned int count)
00504 {
00505 register char *t = to;
00506 register char *f = from;
00507 register int i = count;
00508
00509 while (i-- > 0)
00510 *t++ = *f++;
00511 }
00512
00513 #endif
00514 #endif
00515
00516 #line 217 "/usr/local/share/bison.simple"
00517
00518
00519
00520
00521
00522
00523
00524 #ifdef YYPARSE_PARAM
00525 #ifdef __cplusplus
00526 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
00527 #define YYPARSE_PARAM_DECL
00528 #else
00529 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
00530 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
00531 #endif
00532 #else
00533 #define YYPARSE_PARAM_ARG
00534 #define YYPARSE_PARAM_DECL
00535 #endif
00536
00537
00538 #ifdef __GNUC__
00539 #ifdef YYPARSE_PARAM
00540 int yyparse (void *);
00541 #else
00542 int yyparse (void);
00543 #endif
00544 #endif
00545
00546 int
00547 yyparse(YYPARSE_PARAM_ARG)
00548 YYPARSE_PARAM_DECL
00549 {
00550 register int yystate;
00551 register int yyn;
00552 register short *yyssp;
00553 register YYSTYPE *yyvsp;
00554 int yyerrstatus;
00555 int yychar1 = 0;
00556
00557 short yyssa[YYINITDEPTH];
00558 YYSTYPE yyvsa[YYINITDEPTH];
00559
00560 short *yyss = yyssa;
00561 YYSTYPE *yyvs = yyvsa;
00562
00563 #ifdef YYLSP_NEEDED
00564 YYLTYPE yylsa[YYINITDEPTH];
00565 YYLTYPE *yyls = yylsa;
00566 YYLTYPE *yylsp;
00567
00568 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
00569 #else
00570 #define YYPOPSTACK (yyvsp--, yyssp--)
00571 #endif
00572
00573 int yystacksize = YYINITDEPTH;
00574 int yyfree_stacks = 0;
00575
00576 #ifdef YYPURE
00577 int yychar;
00578 YYSTYPE yylval;
00579 int yynerrs;
00580 #ifdef YYLSP_NEEDED
00581 YYLTYPE yylloc;
00582 #endif
00583 #endif
00584
00585 YYSTYPE yyval;
00586
00587
00588
00589 int yylen;
00590
00591 #if YYDEBUG != 0
00592 if (yydebug)
00593 fprintf(stderr, "Starting parse\n");
00594 #endif
00595
00596 yystate = 0;
00597 yyerrstatus = 0;
00598 yynerrs = 0;
00599 yychar = YYEMPTY;
00600
00601
00602
00603
00604
00605
00606 yyssp = yyss - 1;
00607 yyvsp = yyvs;
00608 #ifdef YYLSP_NEEDED
00609 yylsp = yyls;
00610 #endif
00611
00612
00613
00614
00615 yynewstate:
00616
00617 *++yyssp = yystate;
00618
00619 if (yyssp >= yyss + yystacksize - 1)
00620 {
00621
00622
00623 YYSTYPE *yyvs1 = yyvs;
00624 short *yyss1 = yyss;
00625 #ifdef YYLSP_NEEDED
00626 YYLTYPE *yyls1 = yyls;
00627 #endif
00628
00629
00630 int size = yyssp - yyss + 1;
00631
00632 #ifdef yyoverflow
00633
00634
00635 #ifdef YYLSP_NEEDED
00636
00637
00638 yyoverflow("parser stack overflow",
00639 &yyss1, size * sizeof (*yyssp),
00640 &yyvs1, size * sizeof (*yyvsp),
00641 &yyls1, size * sizeof (*yylsp),
00642 &yystacksize);
00643 #else
00644 yyoverflow("parser stack overflow",
00645 &yyss1, size * sizeof (*yyssp),
00646 &yyvs1, size * sizeof (*yyvsp),
00647 &yystacksize);
00648 #endif
00649
00650 yyss = yyss1; yyvs = yyvs1;
00651 #ifdef YYLSP_NEEDED
00652 yyls = yyls1;
00653 #endif
00654 #else
00655
00656 if (yystacksize >= YYMAXDEPTH)
00657 {
00658 yyerror("parser stack overflow");
00659 if (yyfree_stacks)
00660 {
00661 free (yyss);
00662 free (yyvs);
00663 #ifdef YYLSP_NEEDED
00664 free (yyls);
00665 #endif
00666 }
00667 return 2;
00668 }
00669 yystacksize *= 2;
00670 if (yystacksize > YYMAXDEPTH)
00671 yystacksize = YYMAXDEPTH;
00672 #ifndef YYSTACK_USE_ALLOCA
00673 yyfree_stacks = 1;
00674 #endif
00675 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
00676 __yy_memcpy ((char *)yyss, (char *)yyss1,
00677 size * (unsigned int) sizeof (*yyssp));
00678 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
00679 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
00680 size * (unsigned int) sizeof (*yyvsp));
00681 #ifdef YYLSP_NEEDED
00682 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
00683 __yy_memcpy ((char *)yyls, (char *)yyls1,
00684 size * (unsigned int) sizeof (*yylsp));
00685 #endif
00686 #endif
00687
00688 yyssp = yyss + size - 1;
00689 yyvsp = yyvs + size - 1;
00690 #ifdef YYLSP_NEEDED
00691 yylsp = yyls + size - 1;
00692 #endif
00693
00694 #if YYDEBUG != 0
00695 if (yydebug)
00696 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
00697 #endif
00698
00699 if (yyssp >= yyss + yystacksize - 1)
00700 YYABORT;
00701 }
00702
00703 #if YYDEBUG != 0
00704 if (yydebug)
00705 fprintf(stderr, "Entering state %d\n", yystate);
00706 #endif
00707
00708 goto yybackup;
00709 yybackup:
00710
00711
00712
00713
00714
00715
00716
00717 yyn = yypact[yystate];
00718 if (yyn == YYFLAG)
00719 goto yydefault;
00720
00721
00722
00723
00724
00725
00726 if (yychar == YYEMPTY)
00727 {
00728 #if YYDEBUG != 0
00729 if (yydebug)
00730 fprintf(stderr, "Reading a token: ");
00731 #endif
00732 yychar = YYLEX;
00733 }
00734
00735
00736
00737 if (yychar <= 0)
00738 {
00739 yychar1 = 0;
00740 yychar = YYEOF;
00741
00742 #if YYDEBUG != 0
00743 if (yydebug)
00744 fprintf(stderr, "Now at end of input.\n");
00745 #endif
00746 }
00747 else
00748 {
00749 yychar1 = YYTRANSLATE(yychar);
00750
00751 #if YYDEBUG != 0
00752 if (yydebug)
00753 {
00754 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
00755
00756
00757 #ifdef YYPRINT
00758 YYPRINT (stderr, yychar, yylval);
00759 #endif
00760 fprintf (stderr, ")\n");
00761 }
00762 #endif
00763 }
00764
00765 yyn += yychar1;
00766 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00767 goto yydefault;
00768
00769 yyn = yytable[yyn];
00770
00771
00772
00773
00774
00775
00776
00777
00778 if (yyn < 0)
00779 {
00780 if (yyn == YYFLAG)
00781 goto yyerrlab;
00782 yyn = -yyn;
00783 goto yyreduce;
00784 }
00785 else if (yyn == 0)
00786 goto yyerrlab;
00787
00788 if (yyn == YYFINAL)
00789 YYACCEPT;
00790
00791
00792
00793 #if YYDEBUG != 0
00794 if (yydebug)
00795 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
00796 #endif
00797
00798
00799 if (yychar != YYEOF)
00800 yychar = YYEMPTY;
00801
00802 *++yyvsp = yylval;
00803 #ifdef YYLSP_NEEDED
00804 *++yylsp = yylloc;
00805 #endif
00806
00807
00808 if (yyerrstatus) yyerrstatus--;
00809
00810 yystate = yyn;
00811 goto yynewstate;
00812
00813
00814 yydefault:
00815
00816 yyn = yydefact[yystate];
00817 if (yyn == 0)
00818 goto yyerrlab;
00819
00820
00821 yyreduce:
00822 yylen = yyr2[yyn];
00823 if (yylen > 0)
00824 yyval = yyvsp[1-yylen];
00825
00826 #if YYDEBUG != 0
00827 if (yydebug)
00828 {
00829 int i;
00830
00831 fprintf (stderr, "Reducing via rule %d (line %d), ",
00832 yyn, yyrline[yyn]);
00833
00834
00835 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
00836 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
00837 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
00838 }
00839 #endif
00840
00841
00842 switch (yyn) {
00843
00844 case 1:
00845 #line 175 "plural.y"
00846 {
00847 if (yyvsp[0].exp == NULL)
00848 YYABORT;
00849 ((struct parse_args *) arg)->res = yyvsp[0].exp;
00850 ;
00851 break;}
00852 case 2:
00853 #line 183 "plural.y"
00854 {
00855 yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
00856 ;
00857 break;}
00858 case 3:
00859 #line 187 "plural.y"
00860 {
00861 yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
00862 ;
00863 break;}
00864 case 4:
00865 #line 191 "plural.y"
00866 {
00867 yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
00868 ;
00869 break;}
00870 case 5:
00871 #line 195 "plural.y"
00872 {
00873 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
00874 ;
00875 break;}
00876 case 6:
00877 #line 199 "plural.y"
00878 {
00879 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
00880 ;
00881 break;}
00882 case 7:
00883 #line 203 "plural.y"
00884 {
00885 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
00886 ;
00887 break;}
00888 case 8:
00889 #line 207 "plural.y"
00890 {
00891 yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
00892 ;
00893 break;}
00894 case 9:
00895 #line 211 "plural.y"
00896 {
00897 yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
00898 ;
00899 break;}
00900 case 10:
00901 #line 215 "plural.y"
00902 {
00903 yyval.exp = new_exp_0 (var);
00904 ;
00905 break;}
00906 case 11:
00907 #line 219 "plural.y"
00908 {
00909 if ((yyval.exp = new_exp_0 (num)) != NULL)
00910 yyval.exp->val.num = yyvsp[0].num;
00911 ;
00912 break;}
00913 case 12:
00914 #line 224 "plural.y"
00915 {
00916 yyval.exp = yyvsp[-1].exp;
00917 ;
00918 break;}
00919 }
00920
00921 #line 543 "/usr/local/share/bison.simple"
00922
00923 yyvsp -= yylen;
00924 yyssp -= yylen;
00925 #ifdef YYLSP_NEEDED
00926 yylsp -= yylen;
00927 #endif
00928
00929 #if YYDEBUG != 0
00930 if (yydebug)
00931 {
00932 short *ssp1 = yyss - 1;
00933 fprintf (stderr, "state stack now");
00934 while (ssp1 != yyssp)
00935 fprintf (stderr, " %d", *++ssp1);
00936 fprintf (stderr, "\n");
00937 }
00938 #endif
00939
00940 *++yyvsp = yyval;
00941
00942 #ifdef YYLSP_NEEDED
00943 yylsp++;
00944 if (yylen == 0)
00945 {
00946 yylsp->first_line = yylloc.first_line;
00947 yylsp->first_column = yylloc.first_column;
00948 yylsp->last_line = (yylsp-1)->last_line;
00949 yylsp->last_column = (yylsp-1)->last_column;
00950 yylsp->text = 0;
00951 }
00952 else
00953 {
00954 yylsp->last_line = (yylsp+yylen-1)->last_line;
00955 yylsp->last_column = (yylsp+yylen-1)->last_column;
00956 }
00957 #endif
00958
00959
00960
00961
00962
00963
00964 yyn = yyr1[yyn];
00965
00966 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
00967 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
00968 yystate = yytable[yystate];
00969 else
00970 yystate = yydefgoto[yyn - YYNTBASE];
00971
00972 goto yynewstate;
00973
00974 yyerrlab:
00975
00976 if (! yyerrstatus)
00977
00978 {
00979 ++yynerrs;
00980
00981 #ifdef YYERROR_VERBOSE
00982 yyn = yypact[yystate];
00983
00984 if (yyn > YYFLAG && yyn < YYLAST)
00985 {
00986 int size = 0;
00987 char *msg;
00988 int x, count;
00989
00990 count = 0;
00991
00992 for (x = (yyn < 0 ? -yyn : 0);
00993 x < (sizeof(yytname) / sizeof(char *)); x++)
00994 if (yycheck[x + yyn] == x)
00995 size += strlen(yytname[x]) + 15, count++;
00996 msg = (char *) malloc(size + 15);
00997 if (msg != 0)
00998 {
00999 strcpy(msg, "parse error");
01000
01001 if (count < 5)
01002 {
01003 count = 0;
01004 for (x = (yyn < 0 ? -yyn : 0);
01005 x < (sizeof(yytname) / sizeof(char *)); x++)
01006 if (yycheck[x + yyn] == x)
01007 {
01008 strcat(msg, count == 0 ? ", expecting `" : " or `");
01009 strcat(msg, yytname[x]);
01010 strcat(msg, "'");
01011 count++;
01012 }
01013 }
01014 yyerror(msg);
01015 free(msg);
01016 }
01017 else
01018 yyerror ("parse error; also virtual memory exceeded");
01019 }
01020 else
01021 #endif
01022 yyerror("parse error");
01023 }
01024
01025 goto yyerrlab1;
01026 yyerrlab1:
01027
01028 if (yyerrstatus == 3)
01029 {
01030
01031
01032
01033 if (yychar == YYEOF)
01034 YYABORT;
01035
01036 #if YYDEBUG != 0
01037 if (yydebug)
01038 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
01039 #endif
01040
01041 yychar = YYEMPTY;
01042 }
01043
01044
01045
01046
01047 yyerrstatus = 3;
01048
01049 goto yyerrhandle;
01050
01051 yyerrdefault:
01052
01053 #if 0
01054
01055
01056 yyn = yydefact[yystate];
01057 if (yyn) goto yydefault;
01058 #endif
01059
01060 yyerrpop:
01061
01062 if (yyssp == yyss) YYABORT;
01063 yyvsp--;
01064 yystate = *--yyssp;
01065 #ifdef YYLSP_NEEDED
01066 yylsp--;
01067 #endif
01068
01069 #if YYDEBUG != 0
01070 if (yydebug)
01071 {
01072 short *ssp1 = yyss - 1;
01073 fprintf (stderr, "Error: state stack now");
01074 while (ssp1 != yyssp)
01075 fprintf (stderr, " %d", *++ssp1);
01076 fprintf (stderr, "\n");
01077 }
01078 #endif
01079
01080 yyerrhandle:
01081
01082 yyn = yypact[yystate];
01083 if (yyn == YYFLAG)
01084 goto yyerrdefault;
01085
01086 yyn += YYTERROR;
01087 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01088 goto yyerrdefault;
01089
01090 yyn = yytable[yyn];
01091 if (yyn < 0)
01092 {
01093 if (yyn == YYFLAG)
01094 goto yyerrpop;
01095 yyn = -yyn;
01096 goto yyreduce;
01097 }
01098 else if (yyn == 0)
01099 goto yyerrpop;
01100
01101 if (yyn == YYFINAL)
01102 YYACCEPT;
01103
01104 #if YYDEBUG != 0
01105 if (yydebug)
01106 fprintf(stderr, "Shifting error token, ");
01107 #endif
01108
01109 *++yyvsp = yylval;
01110 #ifdef YYLSP_NEEDED
01111 *++yylsp = yylloc;
01112 #endif
01113
01114 yystate = yyn;
01115 goto yynewstate;
01116
01117 yyacceptlab:
01118
01119 if (yyfree_stacks)
01120 {
01121 free (yyss);
01122 free (yyvs);
01123 #ifdef YYLSP_NEEDED
01124 free (yyls);
01125 #endif
01126 }
01127 return 0;
01128
01129 yyabortlab:
01130
01131 if (yyfree_stacks)
01132 {
01133 free (yyss);
01134 free (yyvs);
01135 #ifdef YYLSP_NEEDED
01136 free (yyls);
01137 #endif
01138 }
01139 return 1;
01140 }
01141 #line 229 "plural.y"
01142
01143
01144 void
01145 internal_function
01146 FREE_EXPRESSION (exp)
01147 struct expression *exp;
01148 {
01149 if (exp == NULL)
01150 return;
01151
01152
01153 switch (exp->nargs)
01154 {
01155 case 3:
01156 FREE_EXPRESSION (exp->val.args[2]);
01157
01158 case 2:
01159 FREE_EXPRESSION (exp->val.args[1]);
01160
01161 case 1:
01162 FREE_EXPRESSION (exp->val.args[0]);
01163
01164 default:
01165 break;
01166 }
01167
01168 free (exp);
01169 }
01170
01171
01172 static int
01173 yylex (lval, pexp)
01174 YYSTYPE *lval;
01175 const char **pexp;
01176 {
01177 const char *exp = *pexp;
01178 int result;
01179
01180 while (1)
01181 {
01182 if (exp[0] == '\0')
01183 {
01184 *pexp = exp;
01185 return YYEOF;
01186 }
01187
01188 if (exp[0] != ' ' && exp[0] != '\t')
01189 break;
01190
01191 ++exp;
01192 }
01193
01194 result = *exp++;
01195 switch (result)
01196 {
01197 case '0': case '1': case '2': case '3': case '4':
01198 case '5': case '6': case '7': case '8': case '9':
01199 {
01200 unsigned long int n = result - '0';
01201 while (exp[0] >= '0' && exp[0] <= '9')
01202 {
01203 n *= 10;
01204 n += exp[0] - '0';
01205 ++exp;
01206 }
01207 lval->num = n;
01208 result = NUMBER;
01209 }
01210 break;
01211
01212 case '=':
01213 if (exp[0] == '=')
01214 {
01215 ++exp;
01216 lval->op = equal;
01217 result = EQUOP2;
01218 }
01219 else
01220 result = YYERRCODE;
01221 break;
01222
01223 case '!':
01224 if (exp[0] == '=')
01225 {
01226 ++exp;
01227 lval->op = not_equal;
01228 result = EQUOP2;
01229 }
01230 break;
01231
01232 case '&':
01233 case '|':
01234 if (exp[0] == result)
01235 ++exp;
01236 else
01237 result = YYERRCODE;
01238 break;
01239
01240 case '<':
01241 if (exp[0] == '=')
01242 {
01243 ++exp;
01244 lval->op = less_or_equal;
01245 }
01246 else
01247 lval->op = less_than;
01248 result = CMPOP2;
01249 break;
01250
01251 case '>':
01252 if (exp[0] == '=')
01253 {
01254 ++exp;
01255 lval->op = greater_or_equal;
01256 }
01257 else
01258 lval->op = greater_than;
01259 result = CMPOP2;
01260 break;
01261
01262 case '*':
01263 lval->op = mult;
01264 result = MULOP2;
01265 break;
01266
01267 case '/':
01268 lval->op = divide;
01269 result = MULOP2;
01270 break;
01271
01272 case '%':
01273 lval->op = module;
01274 result = MULOP2;
01275 break;
01276
01277 case '+':
01278 lval->op = plus;
01279 result = ADDOP2;
01280 break;
01281
01282 case '-':
01283 lval->op = minus;
01284 result = ADDOP2;
01285 break;
01286
01287 case 'n':
01288 case '?':
01289 case ':':
01290 case '(':
01291 case ')':
01292
01293 break;
01294
01295 case ';':
01296 case '\n':
01297 case '\0':
01298
01299 --exp;
01300 result = YYEOF;
01301 break;
01302
01303 default:
01304 result = YYERRCODE;
01305 #if YYDEBUG != 0
01306 --exp;
01307 #endif
01308 break;
01309 }
01310
01311 *pexp = exp;
01312
01313 return result;
01314 }
01315
01316
01317 static void
01318 yyerror (str)
01319 const char *str;
01320 {
01321
01322 }