00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #define YYBISON 1
00038
00039
00040 #define YYBISON_VERSION "2.1"
00041
00042
00043 #define YYSKELETON_NAME "yacc.c"
00044
00045
00046 #define YYPURE 1
00047
00048
00049 #define YYLSP_NEEDED 0
00050
00051
00052 #define yyparse __gettextparse
00053 #define yylex __gettextlex
00054 #define yyerror __gettexterror
00055 #define yylval __gettextlval
00056 #define yychar __gettextchar
00057 #define yydebug __gettextdebug
00058 #define yynerrs __gettextnerrs
00059
00060
00061
00062 #ifndef YYTOKENTYPE
00063 # define YYTOKENTYPE
00064
00065
00066 enum yytokentype {
00067 EQUOP2 = 258,
00068 CMPOP2 = 259,
00069 ADDOP2 = 260,
00070 MULOP2 = 261,
00071 NUMBER = 262
00072 };
00073 #endif
00074
00075 #define EQUOP2 258
00076 #define CMPOP2 259
00077 #define ADDOP2 260
00078 #define MULOP2 261
00079 #define NUMBER 262
00080
00081
00082
00083
00084
00085 #line 1 "plural.y"
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 #if defined _AIX && !defined __GNUC__
00111 #pragma alloca
00112 #endif
00113
00114 #ifdef HAVE_CONFIG_H
00115 # include <config.h>
00116 #endif
00117
00118 #include <stddef.h>
00119 #include <stdlib.h>
00120 #include "plural-exp.h"
00121
00122
00123
00124 #ifndef _LIBC
00125 # define __gettextparse PLURAL_PARSE
00126 #endif
00127
00128 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
00129 #define YYPARSE_PARAM arg
00130
00131
00132
00133 #ifndef YYDEBUG
00134 # define YYDEBUG 0
00135 #endif
00136
00137
00138 #ifdef YYERROR_VERBOSE
00139 # undef YYERROR_VERBOSE
00140 # define YYERROR_VERBOSE 1
00141 #else
00142 # define YYERROR_VERBOSE 0
00143 #endif
00144
00145
00146 #ifndef YYTOKEN_TABLE
00147 # define YYTOKEN_TABLE 0
00148 #endif
00149
00150 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
00151 #line 49 "plural.y"
00152 typedef union YYSTYPE {
00153 unsigned long int num;
00154 enum operator op;
00155 struct expression *exp;
00156 } YYSTYPE;
00157
00158 #line 159 "plural.c"
00159 # define yystype YYSTYPE
00160 # define YYSTYPE_IS_DECLARED 1
00161 # define YYSTYPE_IS_TRIVIAL 1
00162 #endif
00163
00164
00165
00166
00167 #line 55 "plural.y"
00168
00169
00170 static struct expression *new_exp PARAMS ((int nargs, enum operator op,
00171 struct expression * const *args));
00172 static inline struct expression *new_exp_0 PARAMS ((enum operator op));
00173 static inline struct expression *new_exp_1 PARAMS ((enum operator op,
00174 struct expression *right));
00175 static struct expression *new_exp_2 PARAMS ((enum operator op,
00176 struct expression *left,
00177 struct expression *right));
00178 static inline struct expression *new_exp_3 PARAMS ((enum operator op,
00179 struct expression *bexp,
00180 struct expression *tbranch,
00181 struct expression *fbranch));
00182 static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
00183 static void yyerror PARAMS ((const char *str));
00184
00185
00186
00187 static struct expression *
00188 new_exp (nargs, op, args)
00189 int nargs;
00190 enum operator op;
00191 struct expression * const *args;
00192 {
00193 int i;
00194 struct expression *newp;
00195
00196
00197 for (i = nargs - 1; i >= 0; i--)
00198 if (args[i] == NULL)
00199 goto fail;
00200
00201
00202 newp = (struct expression *) malloc (sizeof (*newp));
00203 if (newp != NULL)
00204 {
00205 newp->nargs = nargs;
00206 newp->operation = op;
00207 for (i = nargs - 1; i >= 0; i--)
00208 newp->val.args[i] = args[i];
00209 return newp;
00210 }
00211
00212 fail:
00213 for (i = nargs - 1; i >= 0; i--)
00214 FREE_EXPRESSION (args[i]);
00215
00216 return NULL;
00217 }
00218
00219 static inline struct expression *
00220 new_exp_0 (op)
00221 enum operator op;
00222 {
00223 return new_exp (0, op, NULL);
00224 }
00225
00226 static inline struct expression *
00227 new_exp_1 (op, right)
00228 enum operator op;
00229 struct expression *right;
00230 {
00231 struct expression *args[1];
00232
00233 args[0] = right;
00234 return new_exp (1, op, args);
00235 }
00236
00237 static struct expression *
00238 new_exp_2 (op, left, right)
00239 enum operator op;
00240 struct expression *left;
00241 struct expression *right;
00242 {
00243 struct expression *args[2];
00244
00245 args[0] = left;
00246 args[1] = right;
00247 return new_exp (2, op, args);
00248 }
00249
00250 static inline struct expression *
00251 new_exp_3 (op, bexp, tbranch, fbranch)
00252 enum operator op;
00253 struct expression *bexp;
00254 struct expression *tbranch;
00255 struct expression *fbranch;
00256 {
00257 struct expression *args[3];
00258
00259 args[0] = bexp;
00260 args[1] = tbranch;
00261 args[2] = fbranch;
00262 return new_exp (3, op, args);
00263 }
00264
00265
00266
00267
00268 #line 269 "plural.c"
00269
00270 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
00271 # define YYSIZE_T __SIZE_TYPE__
00272 #endif
00273 #if ! defined (YYSIZE_T) && defined (size_t)
00274 # define YYSIZE_T size_t
00275 #endif
00276 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
00277 # include <stddef.h>
00278 # define YYSIZE_T size_t
00279 #endif
00280 #if ! defined (YYSIZE_T)
00281 # define YYSIZE_T unsigned int
00282 #endif
00283
00284 #ifndef YY_
00285 # if YYENABLE_NLS
00286 # if ENABLE_NLS
00287 # include <libintl.h>
00288 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00289 # endif
00290 # endif
00291 # ifndef YY_
00292 # define YY_(msgid) msgid
00293 # endif
00294 #endif
00295
00296 #if ! defined (yyoverflow) || YYERROR_VERBOSE
00297
00298
00299
00300 # ifdef YYSTACK_USE_ALLOCA
00301 # if YYSTACK_USE_ALLOCA
00302 # ifdef __GNUC__
00303 # define YYSTACK_ALLOC __builtin_alloca
00304 # else
00305 # define YYSTACK_ALLOC alloca
00306 # if defined (__STDC__) || defined (__cplusplus)
00307 # include <stdlib.h>
00308 # define YYINCLUDED_STDLIB_H
00309 # endif
00310 # endif
00311 # endif
00312 # endif
00313
00314 # ifdef YYSTACK_ALLOC
00315
00316 # define YYSTACK_FREE(Ptr) do { ; } while (0)
00317 # ifndef YYSTACK_ALLOC_MAXIMUM
00318
00319
00320
00321
00322 # define YYSTACK_ALLOC_MAXIMUM 4032
00323 # endif
00324 # else
00325 # define YYSTACK_ALLOC YYMALLOC
00326 # define YYSTACK_FREE YYFREE
00327 # ifndef YYSTACK_ALLOC_MAXIMUM
00328 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
00329 # endif
00330 # ifdef __cplusplus
00331 extern "C" {
00332 # endif
00333 # ifndef YYMALLOC
00334 # define YYMALLOC malloc
00335 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
00336 && (defined (__STDC__) || defined (__cplusplus)))
00337 void *malloc (YYSIZE_T);
00338 # endif
00339 # endif
00340 # ifndef YYFREE
00341 # define YYFREE free
00342 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
00343 && (defined (__STDC__) || defined (__cplusplus)))
00344 void free (void *);
00345 # endif
00346 # endif
00347 # ifdef __cplusplus
00348 }
00349 # endif
00350 # endif
00351 #endif
00352
00353
00354 #if (! defined (yyoverflow) \
00355 && (! defined (__cplusplus) \
00356 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
00357
00358
00359 union yyalloc
00360 {
00361 short int yyss;
00362 YYSTYPE yyvs;
00363 };
00364
00365
00366 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00367
00368
00369
00370 # define YYSTACK_BYTES(N) \
00371 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
00372 + YYSTACK_GAP_MAXIMUM)
00373
00374
00375
00376 # ifndef YYCOPY
00377 # if defined (__GNUC__) && 1 < __GNUC__
00378 # define YYCOPY(To, From, Count) \
00379 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00380 # else
00381 # define YYCOPY(To, From, Count) \
00382 do \
00383 { \
00384 YYSIZE_T yyi; \
00385 for (yyi = 0; yyi < (Count); yyi++) \
00386 (To)[yyi] = (From)[yyi]; \
00387 } \
00388 while (0)
00389 # endif
00390 # endif
00391
00392
00393
00394
00395
00396
00397 # define YYSTACK_RELOCATE(Stack) \
00398 do \
00399 { \
00400 YYSIZE_T yynewbytes; \
00401 YYCOPY (&yyptr->Stack, Stack, yysize); \
00402 Stack = &yyptr->Stack; \
00403 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00404 yyptr += yynewbytes / sizeof (*yyptr); \
00405 } \
00406 while (0)
00407
00408 #endif
00409
00410 #if defined (__STDC__) || defined (__cplusplus)
00411 typedef signed char yysigned_char;
00412 #else
00413 typedef short int yysigned_char;
00414 #endif
00415
00416
00417 #define YYFINAL 9
00418
00419 #define YYLAST 54
00420
00421
00422 #define YYNTOKENS 16
00423
00424 #define YYNNTS 3
00425
00426 #define YYNRULES 13
00427
00428 #define YYNSTATES 27
00429
00430
00431 #define YYUNDEFTOK 2
00432 #define YYMAXUTOK 262
00433
00434 #define YYTRANSLATE(YYX) \
00435 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00436
00437
00438 static const unsigned char yytranslate[] =
00439 {
00440 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00443 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
00444 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
00445 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
00446 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
00447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00451 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00452 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
00453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00465 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
00466 8, 9, 11
00467 };
00468
00469 #if YYDEBUG
00470
00471
00472 static const unsigned char yyprhs[] =
00473 {
00474 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
00475 35, 38, 40, 42
00476 };
00477
00478
00479 static const yysigned_char yyrhs[] =
00480 {
00481 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
00482 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
00483 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
00484 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
00485 11, -1, 14, 18, 15, -1
00486 };
00487
00488
00489 static const unsigned char yyrline[] =
00490 {
00491 0, 174, 174, 182, 186, 190, 194, 198, 202, 206,
00492 210, 214, 218, 223
00493 };
00494 #endif
00495
00496 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00497
00498
00499 static const char *const yytname[] =
00500 {
00501 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
00502 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
00503 "$accept", "start", "exp", 0
00504 };
00505 #endif
00506
00507 # ifdef YYPRINT
00508
00509
00510 static const unsigned short int yytoknum[] =
00511 {
00512 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
00513 33, 262, 58, 110, 40, 41
00514 };
00515 # endif
00516
00517
00518 static const unsigned char yyr1[] =
00519 {
00520 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
00521 18, 18, 18, 18
00522 };
00523
00524
00525 static const unsigned char yyr2[] =
00526 {
00527 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
00528 2, 1, 1, 3
00529 };
00530
00531
00532
00533
00534 static const unsigned char yydefact[] =
00535 {
00536 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
00537 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
00538 5, 6, 7, 8, 9, 0, 3
00539 };
00540
00541
00542 static const yysigned_char yydefgoto[] =
00543 {
00544 -1, 5, 6
00545 };
00546
00547
00548
00549 #define YYPACT_NINF -10
00550 static const yysigned_char yypact[] =
00551 {
00552 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
00553 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
00554 45, 18, -2, 14, -10, -9, 36
00555 };
00556
00557
00558 static const yysigned_char yypgoto[] =
00559 {
00560 -10, -10, -1
00561 };
00562
00563
00564
00565
00566
00567 #define YYTABLE_NINF -1
00568 static const unsigned char yytable[] =
00569 {
00570 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
00571 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
00572 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
00573 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
00574 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
00575 16, 13, 14, 15, 16
00576 };
00577
00578 static const yysigned_char yycheck[] =
00579 {
00580 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
00581 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
00582 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
00583 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
00584 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
00585 9, 6, 7, 8, 9
00586 };
00587
00588
00589
00590 static const unsigned char yystos[] =
00591 {
00592 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
00593 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
00594 18, 18, 18, 18, 18, 12, 18
00595 };
00596
00597 #define yyerrok (yyerrstatus = 0)
00598 #define yyclearin (yychar = YYEMPTY)
00599 #define YYEMPTY (-2)
00600 #define YYEOF 0
00601
00602 #define YYACCEPT goto yyacceptlab
00603 #define YYABORT goto yyabortlab
00604 #define YYERROR goto yyerrorlab
00605
00606
00607
00608
00609
00610
00611 #define YYFAIL goto yyerrlab
00612
00613 #define YYRECOVERING() (!!yyerrstatus)
00614
00615 #define YYBACKUP(Token, Value) \
00616 do \
00617 if (yychar == YYEMPTY && yylen == 1) \
00618 { \
00619 yychar = (Token); \
00620 yylval = (Value); \
00621 yytoken = YYTRANSLATE (yychar); \
00622 YYPOPSTACK; \
00623 goto yybackup; \
00624 } \
00625 else \
00626 { \
00627 yyerror (YY_("syntax error: cannot back up")); \
00628 YYERROR; \
00629 } \
00630 while (0)
00631
00632
00633 #define YYTERROR 1
00634 #define YYERRCODE 256
00635
00636
00637
00638
00639
00640
00641 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00642 #ifndef YYLLOC_DEFAULT
00643 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00644 do \
00645 if (N) \
00646 { \
00647 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
00648 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
00649 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
00650 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
00651 } \
00652 else \
00653 { \
00654 (Current).first_line = (Current).last_line = \
00655 YYRHSLOC (Rhs, 0).last_line; \
00656 (Current).first_column = (Current).last_column = \
00657 YYRHSLOC (Rhs, 0).last_column; \
00658 } \
00659 while (0)
00660 #endif
00661
00662
00663
00664
00665
00666
00667 #ifndef YY_LOCATION_PRINT
00668 # if YYLTYPE_IS_TRIVIAL
00669 # define YY_LOCATION_PRINT(File, Loc) \
00670 fprintf (File, "%d.%d-%d.%d", \
00671 (Loc).first_line, (Loc).first_column, \
00672 (Loc).last_line, (Loc).last_column)
00673 # else
00674 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00675 # endif
00676 #endif
00677
00678
00679
00680
00681 #ifdef YYLEX_PARAM
00682 # define YYLEX yylex (&yylval, YYLEX_PARAM)
00683 #else
00684 # define YYLEX yylex (&yylval)
00685 #endif
00686
00687
00688 #if YYDEBUG
00689
00690 # ifndef YYFPRINTF
00691 # include <stdio.h>
00692 # define YYFPRINTF fprintf
00693 # endif
00694
00695 # define YYDPRINTF(Args) \
00696 do { \
00697 if (yydebug) \
00698 YYFPRINTF Args; \
00699 } while (0)
00700
00701 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
00702 do { \
00703 if (yydebug) \
00704 { \
00705 YYFPRINTF (stderr, "%s ", Title); \
00706 yysymprint (stderr, \
00707 Type, Value); \
00708 YYFPRINTF (stderr, "\n"); \
00709 } \
00710 } while (0)
00711
00712
00713
00714
00715
00716
00717 #if defined (__STDC__) || defined (__cplusplus)
00718 static void
00719 yy_stack_print (short int *bottom, short int *top)
00720 #else
00721 static void
00722 yy_stack_print (bottom, top)
00723 short int *bottom;
00724 short int *top;
00725 #endif
00726 {
00727 YYFPRINTF (stderr, "Stack now");
00728 for (; bottom <= top; ++bottom)
00729 YYFPRINTF (stderr, " %d", *bottom);
00730 YYFPRINTF (stderr, "\n");
00731 }
00732
00733 # define YY_STACK_PRINT(Bottom, Top) \
00734 do { \
00735 if (yydebug) \
00736 yy_stack_print ((Bottom), (Top)); \
00737 } while (0)
00738
00739
00740
00741
00742
00743
00744 #if defined (__STDC__) || defined (__cplusplus)
00745 static void
00746 yy_reduce_print (int yyrule)
00747 #else
00748 static void
00749 yy_reduce_print (yyrule)
00750 int yyrule;
00751 #endif
00752 {
00753 int yyi;
00754 unsigned long int yylno = yyrline[yyrule];
00755 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
00756 yyrule - 1, yylno);
00757
00758 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
00759 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
00760 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
00761 }
00762
00763 # define YY_REDUCE_PRINT(Rule) \
00764 do { \
00765 if (yydebug) \
00766 yy_reduce_print (Rule); \
00767 } while (0)
00768
00769
00770
00771 int yydebug;
00772 #else
00773 # define YYDPRINTF(Args)
00774 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
00775 # define YY_STACK_PRINT(Bottom, Top)
00776 # define YY_REDUCE_PRINT(Rule)
00777 #endif
00778
00779
00780
00781 #ifndef YYINITDEPTH
00782 # define YYINITDEPTH 200
00783 #endif
00784
00785
00786
00787
00788
00789
00790
00791
00792 #ifndef YYMAXDEPTH
00793 # define YYMAXDEPTH 10000
00794 #endif
00795
00796
00797
00798 #if YYERROR_VERBOSE
00799
00800 # ifndef yystrlen
00801 # if defined (__GLIBC__) && defined (_STRING_H)
00802 # define yystrlen strlen
00803 # else
00804
00805 static YYSIZE_T
00806 # if defined (__STDC__) || defined (__cplusplus)
00807 yystrlen (const char *yystr)
00808 # else
00809 yystrlen (yystr)
00810 const char *yystr;
00811 # endif
00812 {
00813 const char *yys = yystr;
00814
00815 while (*yys++ != '\0')
00816 continue;
00817
00818 return yys - yystr - 1;
00819 }
00820 # endif
00821 # endif
00822
00823 # ifndef yystpcpy
00824 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
00825 # define yystpcpy stpcpy
00826 # else
00827
00828
00829 static char *
00830 # if defined (__STDC__) || defined (__cplusplus)
00831 yystpcpy (char *yydest, const char *yysrc)
00832 # else
00833 yystpcpy (yydest, yysrc)
00834 char *yydest;
00835 const char *yysrc;
00836 # endif
00837 {
00838 char *yyd = yydest;
00839 const char *yys = yysrc;
00840
00841 while ((*yyd++ = *yys++) != '\0')
00842 continue;
00843
00844 return yyd - 1;
00845 }
00846 # endif
00847 # endif
00848
00849 # ifndef yytnamerr
00850
00851
00852
00853
00854
00855
00856
00857 static YYSIZE_T
00858 yytnamerr (char *yyres, const char *yystr)
00859 {
00860 if (*yystr == '"')
00861 {
00862 size_t yyn = 0;
00863 char const *yyp = yystr;
00864
00865 for (;;)
00866 switch (*++yyp)
00867 {
00868 case '\'':
00869 case ',':
00870 goto do_not_strip_quotes;
00871
00872 case '\\':
00873 if (*++yyp != '\\')
00874 goto do_not_strip_quotes;
00875
00876 default:
00877 if (yyres)
00878 yyres[yyn] = *yyp;
00879 yyn++;
00880 break;
00881
00882 case '"':
00883 if (yyres)
00884 yyres[yyn] = '\0';
00885 return yyn;
00886 }
00887 do_not_strip_quotes: ;
00888 }
00889
00890 if (! yyres)
00891 return yystrlen (yystr);
00892
00893 return yystpcpy (yyres, yystr) - yyres;
00894 }
00895 # endif
00896
00897 #endif
00898
00899
00900
00901 #if YYDEBUG
00902
00903
00904
00905
00906 #if defined (__STDC__) || defined (__cplusplus)
00907 static void
00908 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
00909 #else
00910 static void
00911 yysymprint (yyoutput, yytype, yyvaluep)
00912 FILE *yyoutput;
00913 int yytype;
00914 YYSTYPE *yyvaluep;
00915 #endif
00916 {
00917
00918 (void) yyvaluep;
00919
00920 if (yytype < YYNTOKENS)
00921 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00922 else
00923 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00924
00925
00926 # ifdef YYPRINT
00927 if (yytype < YYNTOKENS)
00928 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00929 # endif
00930 switch (yytype)
00931 {
00932 default:
00933 break;
00934 }
00935 YYFPRINTF (yyoutput, ")");
00936 }
00937
00938 #endif
00939
00940
00941
00942
00943 #if defined (__STDC__) || defined (__cplusplus)
00944 static void
00945 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
00946 #else
00947 static void
00948 yydestruct (yymsg, yytype, yyvaluep)
00949 const char *yymsg;
00950 int yytype;
00951 YYSTYPE *yyvaluep;
00952 #endif
00953 {
00954
00955 (void) yyvaluep;
00956
00957 if (!yymsg)
00958 yymsg = "Deleting";
00959 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
00960
00961 switch (yytype)
00962 {
00963
00964 default:
00965 break;
00966 }
00967 }
00968
00969
00970
00971
00972 #ifdef YYPARSE_PARAM
00973 # if defined (__STDC__) || defined (__cplusplus)
00974 int yyparse (void *YYPARSE_PARAM);
00975 # else
00976 int yyparse ();
00977 # endif
00978 #else
00979 #if defined (__STDC__) || defined (__cplusplus)
00980 int yyparse (void);
00981 #else
00982 int yyparse ();
00983 #endif
00984 #endif
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995 #ifdef YYPARSE_PARAM
00996 # if defined (__STDC__) || defined (__cplusplus)
00997 int yyparse (void *YYPARSE_PARAM)
00998 # else
00999 int yyparse (YYPARSE_PARAM)
01000 void *YYPARSE_PARAM;
01001 # endif
01002 #else
01003 #if defined (__STDC__) || defined (__cplusplus)
01004 int
01005 yyparse (void)
01006 #else
01007 int
01008 yyparse ()
01009 ;
01010 #endif
01011 #endif
01012 {
01013
01014 int yychar;
01015
01016
01017 YYSTYPE yylval;
01018
01019
01020 int yynerrs;
01021
01022 int yystate;
01023 int yyn;
01024 int yyresult;
01025
01026 int yyerrstatus;
01027
01028 int yytoken = 0;
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039 short int yyssa[YYINITDEPTH];
01040 short int *yyss = yyssa;
01041 short int *yyssp;
01042
01043
01044 YYSTYPE yyvsa[YYINITDEPTH];
01045 YYSTYPE *yyvs = yyvsa;
01046 YYSTYPE *yyvsp;
01047
01048
01049
01050 #define YYPOPSTACK (yyvsp--, yyssp--)
01051
01052 YYSIZE_T yystacksize = YYINITDEPTH;
01053
01054
01055
01056 YYSTYPE yyval;
01057
01058
01059
01060
01061 int yylen;
01062
01063 YYDPRINTF ((stderr, "Starting parse\n"));
01064
01065 yystate = 0;
01066 yyerrstatus = 0;
01067 yynerrs = 0;
01068 yychar = YYEMPTY;
01069
01070
01071
01072
01073
01074
01075 yyssp = yyss;
01076 yyvsp = yyvs;
01077
01078 goto yysetstate;
01079
01080
01081
01082
01083 yynewstate:
01084
01085
01086
01087 yyssp++;
01088
01089 yysetstate:
01090 *yyssp = yystate;
01091
01092 if (yyss + yystacksize - 1 <= yyssp)
01093 {
01094
01095 YYSIZE_T yysize = yyssp - yyss + 1;
01096
01097 #ifdef yyoverflow
01098 {
01099
01100
01101
01102 YYSTYPE *yyvs1 = yyvs;
01103 short int *yyss1 = yyss;
01104
01105
01106
01107
01108
01109
01110 yyoverflow (YY_("memory exhausted"),
01111 &yyss1, yysize * sizeof (*yyssp),
01112 &yyvs1, yysize * sizeof (*yyvsp),
01113
01114 &yystacksize);
01115
01116 yyss = yyss1;
01117 yyvs = yyvs1;
01118 }
01119 #else
01120 # ifndef YYSTACK_RELOCATE
01121 goto yyexhaustedlab;
01122 # else
01123
01124 if (YYMAXDEPTH <= yystacksize)
01125 goto yyexhaustedlab;
01126 yystacksize *= 2;
01127 if (YYMAXDEPTH < yystacksize)
01128 yystacksize = YYMAXDEPTH;
01129
01130 {
01131 short int *yyss1 = yyss;
01132 union yyalloc *yyptr =
01133 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01134 if (! yyptr)
01135 goto yyexhaustedlab;
01136 YYSTACK_RELOCATE (yyss);
01137 YYSTACK_RELOCATE (yyvs);
01138
01139 # undef YYSTACK_RELOCATE
01140 if (yyss1 != yyssa)
01141 YYSTACK_FREE (yyss1);
01142 }
01143 # endif
01144 #endif
01145
01146 yyssp = yyss + yysize - 1;
01147 yyvsp = yyvs + yysize - 1;
01148
01149
01150 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01151 (unsigned long int) yystacksize));
01152
01153 if (yyss + yystacksize - 1 <= yyssp)
01154 YYABORT;
01155 }
01156
01157 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01158
01159 goto yybackup;
01160
01161
01162
01163
01164 yybackup:
01165
01166
01167
01168
01169
01170
01171
01172 yyn = yypact[yystate];
01173 if (yyn == YYPACT_NINF)
01174 goto yydefault;
01175
01176
01177
01178
01179 if (yychar == YYEMPTY)
01180 {
01181 YYDPRINTF ((stderr, "Reading a token: "));
01182 yychar = YYLEX;
01183 }
01184
01185 if (yychar <= YYEOF)
01186 {
01187 yychar = yytoken = YYEOF;
01188 YYDPRINTF ((stderr, "Now at end of input.\n"));
01189 }
01190 else
01191 {
01192 yytoken = YYTRANSLATE (yychar);
01193 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01194 }
01195
01196
01197
01198 yyn += yytoken;
01199 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01200 goto yydefault;
01201 yyn = yytable[yyn];
01202 if (yyn <= 0)
01203 {
01204 if (yyn == 0 || yyn == YYTABLE_NINF)
01205 goto yyerrlab;
01206 yyn = -yyn;
01207 goto yyreduce;
01208 }
01209
01210 if (yyn == YYFINAL)
01211 YYACCEPT;
01212
01213
01214 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01215
01216
01217 if (yychar != YYEOF)
01218 yychar = YYEMPTY;
01219
01220 *++yyvsp = yylval;
01221
01222
01223
01224
01225 if (yyerrstatus)
01226 yyerrstatus--;
01227
01228 yystate = yyn;
01229 goto yynewstate;
01230
01231
01232
01233
01234
01235 yydefault:
01236 yyn = yydefact[yystate];
01237 if (yyn == 0)
01238 goto yyerrlab;
01239 goto yyreduce;
01240
01241
01242
01243
01244
01245 yyreduce:
01246
01247 yylen = yyr2[yyn];
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257 yyval = yyvsp[1-yylen];
01258
01259
01260 YY_REDUCE_PRINT (yyn);
01261 switch (yyn)
01262 {
01263 case 2:
01264 #line 175 "plural.y"
01265 {
01266 if ((yyvsp[0].exp) == NULL)
01267 YYABORT;
01268 ((struct parse_args *) arg)->res = (yyvsp[0].exp);
01269 }
01270 break;
01271
01272 case 3:
01273 #line 183 "plural.y"
01274 {
01275 (yyval.exp) = new_exp_3 (qmop, (yyvsp[-4].exp), (yyvsp[-2].exp), (yyvsp[0].exp));
01276 }
01277 break;
01278
01279 case 4:
01280 #line 187 "plural.y"
01281 {
01282 (yyval.exp) = new_exp_2 (lor, (yyvsp[-2].exp), (yyvsp[0].exp));
01283 }
01284 break;
01285
01286 case 5:
01287 #line 191 "plural.y"
01288 {
01289 (yyval.exp) = new_exp_2 (land, (yyvsp[-2].exp), (yyvsp[0].exp));
01290 }
01291 break;
01292
01293 case 6:
01294 #line 195 "plural.y"
01295 {
01296 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
01297 }
01298 break;
01299
01300 case 7:
01301 #line 199 "plural.y"
01302 {
01303 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
01304 }
01305 break;
01306
01307 case 8:
01308 #line 203 "plural.y"
01309 {
01310 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
01311 }
01312 break;
01313
01314 case 9:
01315 #line 207 "plural.y"
01316 {
01317 (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp));
01318 }
01319 break;
01320
01321 case 10:
01322 #line 211 "plural.y"
01323 {
01324 (yyval.exp) = new_exp_1 (lnot, (yyvsp[0].exp));
01325 }
01326 break;
01327
01328 case 11:
01329 #line 215 "plural.y"
01330 {
01331 (yyval.exp) = new_exp_0 (var);
01332 }
01333 break;
01334
01335 case 12:
01336 #line 219 "plural.y"
01337 {
01338 if (((yyval.exp) = new_exp_0 (num)) != NULL)
01339 (yyval.exp)->val.num = (yyvsp[0].num);
01340 }
01341 break;
01342
01343 case 13:
01344 #line 224 "plural.y"
01345 {
01346 (yyval.exp) = (yyvsp[-1].exp);
01347 }
01348 break;
01349
01350
01351 default: break;
01352 }
01353
01354
01355 #line 1356 "plural.c"
01356
01357 yyvsp -= yylen;
01358 yyssp -= yylen;
01359
01360
01361 YY_STACK_PRINT (yyss, yyssp);
01362
01363 *++yyvsp = yyval;
01364
01365
01366
01367
01368
01369
01370 yyn = yyr1[yyn];
01371
01372 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01373 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01374 yystate = yytable[yystate];
01375 else
01376 yystate = yydefgoto[yyn - YYNTOKENS];
01377
01378 goto yynewstate;
01379
01380
01381
01382
01383
01384 yyerrlab:
01385
01386 if (!yyerrstatus)
01387 {
01388 ++yynerrs;
01389 #if YYERROR_VERBOSE
01390 yyn = yypact[yystate];
01391
01392 if (YYPACT_NINF < yyn && yyn < YYLAST)
01393 {
01394 int yytype = YYTRANSLATE (yychar);
01395 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01396 YYSIZE_T yysize = yysize0;
01397 YYSIZE_T yysize1;
01398 int yysize_overflow = 0;
01399 char *yymsg = 0;
01400 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
01401 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01402 int yyx;
01403
01404 #if 0
01405
01406
01407 YY_("syntax error, unexpected %s");
01408 YY_("syntax error, unexpected %s, expecting %s");
01409 YY_("syntax error, unexpected %s, expecting %s or %s");
01410 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01411 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01412 #endif
01413 char *yyfmt;
01414 char const *yyf;
01415 static char const yyunexpected[] = "syntax error, unexpected %s";
01416 static char const yyexpecting[] = ", expecting %s";
01417 static char const yyor[] = " or %s";
01418 char yyformat[sizeof yyunexpected
01419 + sizeof yyexpecting - 1
01420 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01421 * (sizeof yyor - 1))];
01422 char const *yyprefix = yyexpecting;
01423
01424
01425
01426 int yyxbegin = yyn < 0 ? -yyn : 0;
01427
01428
01429 int yychecklim = YYLAST - yyn;
01430 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01431 int yycount = 1;
01432
01433 yyarg[0] = yytname[yytype];
01434 yyfmt = yystpcpy (yyformat, yyunexpected);
01435
01436 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01437 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01438 {
01439 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01440 {
01441 yycount = 1;
01442 yysize = yysize0;
01443 yyformat[sizeof yyunexpected - 1] = '\0';
01444 break;
01445 }
01446 yyarg[yycount++] = yytname[yyx];
01447 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01448 yysize_overflow |= yysize1 < yysize;
01449 yysize = yysize1;
01450 yyfmt = yystpcpy (yyfmt, yyprefix);
01451 yyprefix = yyor;
01452 }
01453
01454 yyf = YY_(yyformat);
01455 yysize1 = yysize + yystrlen (yyf);
01456 yysize_overflow |= yysize1 < yysize;
01457 yysize = yysize1;
01458
01459 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
01460 yymsg = (char *) YYSTACK_ALLOC (yysize);
01461 if (yymsg)
01462 {
01463
01464
01465
01466 char *yyp = yymsg;
01467 int yyi = 0;
01468 while ((*yyp = *yyf))
01469 {
01470 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01471 {
01472 yyp += yytnamerr (yyp, yyarg[yyi++]);
01473 yyf += 2;
01474 }
01475 else
01476 {
01477 yyp++;
01478 yyf++;
01479 }
01480 }
01481 yyerror (yymsg);
01482 YYSTACK_FREE (yymsg);
01483 }
01484 else
01485 {
01486 yyerror (YY_("syntax error"));
01487 goto yyexhaustedlab;
01488 }
01489 }
01490 else
01491 #endif
01492 yyerror (YY_("syntax error"));
01493 }
01494
01495
01496
01497 if (yyerrstatus == 3)
01498 {
01499
01500
01501
01502 if (yychar <= YYEOF)
01503 {
01504
01505 if (yychar == YYEOF)
01506 YYABORT;
01507 }
01508 else
01509 {
01510 yydestruct ("Error: discarding", yytoken, &yylval);
01511 yychar = YYEMPTY;
01512 }
01513 }
01514
01515
01516
01517 goto yyerrlab1;
01518
01519
01520
01521
01522
01523 yyerrorlab:
01524
01525
01526
01527
01528 if (0)
01529 goto yyerrorlab;
01530
01531 yyvsp -= yylen;
01532 yyssp -= yylen;
01533 yystate = *yyssp;
01534 goto yyerrlab1;
01535
01536
01537
01538
01539
01540 yyerrlab1:
01541 yyerrstatus = 3;
01542
01543 for (;;)
01544 {
01545 yyn = yypact[yystate];
01546 if (yyn != YYPACT_NINF)
01547 {
01548 yyn += YYTERROR;
01549 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01550 {
01551 yyn = yytable[yyn];
01552 if (0 < yyn)
01553 break;
01554 }
01555 }
01556
01557
01558 if (yyssp == yyss)
01559 YYABORT;
01560
01561
01562 yydestruct ("Error: popping", yystos[yystate], yyvsp);
01563 YYPOPSTACK;
01564 yystate = *yyssp;
01565 YY_STACK_PRINT (yyss, yyssp);
01566 }
01567
01568 if (yyn == YYFINAL)
01569 YYACCEPT;
01570
01571 *++yyvsp = yylval;
01572
01573
01574
01575 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
01576
01577 yystate = yyn;
01578 goto yynewstate;
01579
01580
01581
01582
01583
01584 yyacceptlab:
01585 yyresult = 0;
01586 goto yyreturn;
01587
01588
01589
01590
01591 yyabortlab:
01592 yyresult = 1;
01593 goto yyreturn;
01594
01595 #ifndef yyoverflow
01596
01597
01598
01599 yyexhaustedlab:
01600 yyerror (YY_("memory exhausted"));
01601 yyresult = 2;
01602
01603 #endif
01604
01605 yyreturn:
01606 if (yychar != YYEOF && yychar != YYEMPTY)
01607 yydestruct ("Cleanup: discarding lookahead",
01608 yytoken, &yylval);
01609 while (yyssp != yyss)
01610 {
01611 yydestruct ("Cleanup: popping",
01612 yystos[*yyssp], yyvsp);
01613 YYPOPSTACK;
01614 }
01615 #ifndef yyoverflow
01616 if (yyss != yyssa)
01617 YYSTACK_FREE (yyss);
01618 #endif
01619 return yyresult;
01620 }
01621
01622
01623 #line 229 "plural.y"
01624
01625
01626 void
01627 internal_function
01628 FREE_EXPRESSION (exp)
01629 struct expression *exp;
01630 {
01631 if (exp == NULL)
01632 return;
01633
01634
01635 switch (exp->nargs)
01636 {
01637 case 3:
01638 FREE_EXPRESSION (exp->val.args[2]);
01639
01640 case 2:
01641 FREE_EXPRESSION (exp->val.args[1]);
01642
01643 case 1:
01644 FREE_EXPRESSION (exp->val.args[0]);
01645
01646 default:
01647 break;
01648 }
01649
01650 free (exp);
01651 }
01652
01653
01654 static int
01655 yylex (lval, pexp)
01656 YYSTYPE *lval;
01657 const char **pexp;
01658 {
01659 const char *exp = *pexp;
01660 int result;
01661
01662 while (1)
01663 {
01664 if (exp[0] == '\0')
01665 {
01666 *pexp = exp;
01667 return YYEOF;
01668 }
01669
01670 if (exp[0] != ' ' && exp[0] != '\t')
01671 break;
01672
01673 ++exp;
01674 }
01675
01676 result = *exp++;
01677 switch (result)
01678 {
01679 case '0': case '1': case '2': case '3': case '4':
01680 case '5': case '6': case '7': case '8': case '9':
01681 {
01682 unsigned long int n = result - '0';
01683 while (exp[0] >= '0' && exp[0] <= '9')
01684 {
01685 n *= 10;
01686 n += exp[0] - '0';
01687 ++exp;
01688 }
01689 lval->num = n;
01690 result = NUMBER;
01691 }
01692 break;
01693
01694 case '=':
01695 if (exp[0] == '=')
01696 {
01697 ++exp;
01698 lval->op = equal;
01699 result = EQUOP2;
01700 }
01701 else
01702 result = YYERRCODE;
01703 break;
01704
01705 case '!':
01706 if (exp[0] == '=')
01707 {
01708 ++exp;
01709 lval->op = not_equal;
01710 result = EQUOP2;
01711 }
01712 break;
01713
01714 case '&':
01715 case '|':
01716 if (exp[0] == result)
01717 ++exp;
01718 else
01719 result = YYERRCODE;
01720 break;
01721
01722 case '<':
01723 if (exp[0] == '=')
01724 {
01725 ++exp;
01726 lval->op = less_or_equal;
01727 }
01728 else
01729 lval->op = less_than;
01730 result = CMPOP2;
01731 break;
01732
01733 case '>':
01734 if (exp[0] == '=')
01735 {
01736 ++exp;
01737 lval->op = greater_or_equal;
01738 }
01739 else
01740 lval->op = greater_than;
01741 result = CMPOP2;
01742 break;
01743
01744 case '*':
01745 lval->op = mult;
01746 result = MULOP2;
01747 break;
01748
01749 case '/':
01750 lval->op = divide;
01751 result = MULOP2;
01752 break;
01753
01754 case '%':
01755 lval->op = module;
01756 result = MULOP2;
01757 break;
01758
01759 case '+':
01760 lval->op = plus;
01761 result = ADDOP2;
01762 break;
01763
01764 case '-':
01765 lval->op = minus;
01766 result = ADDOP2;
01767 break;
01768
01769 case 'n':
01770 case '?':
01771 case ':':
01772 case '(':
01773 case ')':
01774
01775 break;
01776
01777 case ';':
01778 case '\n':
01779 case '\0':
01780
01781 --exp;
01782 result = YYEOF;
01783 break;
01784
01785 default:
01786 result = YYERRCODE;
01787 #if YYDEBUG != 0
01788 --exp;
01789 #endif
01790 break;
01791 }
01792
01793 *pexp = exp;
01794
01795 return result;
01796 }
01797
01798
01799 static void
01800 yyerror (str)
01801 const char *str;
01802 {
01803
01804 }
01805