1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse __gettextparse
63 #define yylex __gettextlex
64 #define yyerror __gettexterror
65 #define yylval __gettextlval
66 #define yychar __gettextchar
67 #define yydebug __gettextdebug
68 #define yynerrs __gettextnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
94 /* Copy the first part of user declarations. */
95 #line 1 "../../lyx-devel/intl/plural.y"
97 /* Expression parsing for plural form selection.
98 Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc.
99 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
101 This program is free software; you can redistribute it and/or modify it
102 under the terms of the GNU Library General Public License as published
103 by the Free Software Foundation; either version 2, or (at your option)
106 This program is distributed in the hope that it will be useful,
107 but WITHOUT ANY WARRANTY; without even the implied warranty of
108 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
109 Library General Public License for more details.
111 You should have received a copy of the GNU Library General Public
112 License along with this program; if not, write to the Free Software
113 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
116 /* For bison < 2.0, the bison generated parser uses alloca. AIX 3 forces us
117 to put this declaration at the beginning of the file. The declaration in
118 bison's skeleton file comes too late. This must come before <config.h>
119 because <config.h> may include arbitrary system headers.
120 This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0. */
121 #if defined _AIX && !defined __GNUC__
132 #include "plural-exp.h"
134 /* The main function generated by the parser is called __gettextparse,
135 but we want it to be called PLURAL_PARSE. */
137 # define __gettextparse PLURAL_PARSE
140 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
141 #define YYPARSE_PARAM arg
144 /* Enabling traces. */
149 /* Enabling verbose error messages. */
150 #ifdef YYERROR_VERBOSE
151 # undef YYERROR_VERBOSE
152 # define YYERROR_VERBOSE 1
154 # define YYERROR_VERBOSE 0
157 /* Enabling the token table. */
158 #ifndef YYTOKEN_TABLE
159 # define YYTOKEN_TABLE 0
162 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
163 typedef union YYSTYPE
164 #line 51 "../../lyx-devel/intl/plural.y"
166 unsigned long int num;
168 struct expression *exp;
170 /* Line 187 of yacc.c. */
171 #line 172 "../../lyx-devel/intl/plural.c"
173 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
174 # define YYSTYPE_IS_DECLARED 1
175 # define YYSTYPE_IS_TRIVIAL 1
180 /* Copy the second part of user declarations. */
181 #line 57 "../../lyx-devel/intl/plural.y"
183 /* Prototypes for local functions. */
184 static int yylex (YYSTYPE *lval, const char **pexp);
185 static void yyerror (const char *str);
187 /* Allocation of expressions. */
189 static struct expression *
190 new_exp (int nargs, enum operator op, struct expression * const *args)
193 struct expression *newp;
195 /* If any of the argument could not be malloc'ed, just return NULL. */
196 for (i = nargs - 1; i >= 0; i--)
200 /* Allocate a new expression. */
201 newp = (struct expression *) malloc (sizeof (*newp));
205 newp->operation = op;
206 for (i = nargs - 1; i >= 0; i--)
207 newp->val.args[i] = args[i];
212 for (i = nargs - 1; i >= 0; i--)
213 FREE_EXPRESSION (args[i]);
218 static inline struct expression *
219 new_exp_0 (enum operator op)
221 return new_exp (0, op, NULL);
224 static inline struct expression *
225 new_exp_1 (enum operator op, struct expression *right)
227 struct expression *args[1];
230 return new_exp (1, op, args);
233 static struct expression *
234 new_exp_2 (enum operator op, struct expression *left, struct expression *right)
236 struct expression *args[2];
240 return new_exp (2, op, args);
243 static inline struct expression *
244 new_exp_3 (enum operator op, struct expression *bexp,
245 struct expression *tbranch, struct expression *fbranch)
247 struct expression *args[3];
252 return new_exp (3, op, args);
257 /* Line 216 of yacc.c. */
258 #line 259 "../../lyx-devel/intl/plural.c"
265 typedef YYTYPE_UINT8 yytype_uint8;
267 typedef unsigned char yytype_uint8;
271 typedef YYTYPE_INT8 yytype_int8;
272 #elif (defined __STDC__ || defined __C99__FUNC__ \
273 || defined __cplusplus || defined _MSC_VER)
274 typedef signed char yytype_int8;
276 typedef short int yytype_int8;
280 typedef YYTYPE_UINT16 yytype_uint16;
282 typedef unsigned short int yytype_uint16;
286 typedef YYTYPE_INT16 yytype_int16;
288 typedef short int yytype_int16;
292 # ifdef __SIZE_TYPE__
293 # define YYSIZE_T __SIZE_TYPE__
294 # elif defined size_t
295 # define YYSIZE_T size_t
296 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
297 || defined __cplusplus || defined _MSC_VER)
298 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
299 # define YYSIZE_T size_t
301 # define YYSIZE_T unsigned int
305 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
310 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
311 # define YY_(msgid) dgettext ("bison-runtime", msgid)
315 # define YY_(msgid) msgid
319 /* Suppress unused-variable warnings by "using" E. */
320 #if ! defined lint || defined __GNUC__
321 # define YYUSE(e) ((void) (e))
323 # define YYUSE(e) /* empty */
326 /* Identity function, used to suppress warnings about constant conditions. */
330 #if (defined __STDC__ || defined __C99__FUNC__ \
331 || defined __cplusplus || defined _MSC_VER)
344 #if ! defined yyoverflow || YYERROR_VERBOSE
346 /* The parser invokes alloca or malloc; define the necessary symbols. */
348 # ifdef YYSTACK_USE_ALLOCA
349 # if YYSTACK_USE_ALLOCA
351 # define YYSTACK_ALLOC __builtin_alloca
352 # elif defined __BUILTIN_VA_ARG_INCR
353 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
355 # define YYSTACK_ALLOC __alloca
356 # elif defined _MSC_VER
357 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
358 # define alloca _alloca
360 # define YYSTACK_ALLOC alloca
361 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
362 || defined __cplusplus || defined _MSC_VER)
363 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
372 # ifdef YYSTACK_ALLOC
373 /* Pacify GCC's `empty if-body' warning. */
374 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
375 # ifndef YYSTACK_ALLOC_MAXIMUM
376 /* The OS might guarantee only one guard page at the bottom of the stack,
377 and a page size can be as small as 4096 bytes. So we cannot safely
378 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
379 to allow for a few compiler-allocated temporary stack slots. */
380 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
383 # define YYSTACK_ALLOC YYMALLOC
384 # define YYSTACK_FREE YYFREE
385 # ifndef YYSTACK_ALLOC_MAXIMUM
386 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
388 # if (defined __cplusplus && ! defined _STDLIB_H \
389 && ! ((defined YYMALLOC || defined malloc) \
390 && (defined YYFREE || defined free)))
391 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
397 # define YYMALLOC malloc
398 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
399 || defined __cplusplus || defined _MSC_VER)
400 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
405 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
406 || defined __cplusplus || defined _MSC_VER)
407 void free (void *); /* INFRINGES ON USER NAME SPACE */
411 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
414 #if (! defined yyoverflow \
415 && (! defined __cplusplus \
416 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
418 /* A type that is properly aligned for any stack member. */
425 /* The size of the maximum gap between one aligned stack and the next. */
426 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
428 /* The size of an array large to enough to hold all stacks, each with
430 # define YYSTACK_BYTES(N) \
431 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
432 + YYSTACK_GAP_MAXIMUM)
434 /* Copy COUNT objects from FROM to TO. The source and destination do
437 # if defined __GNUC__ && 1 < __GNUC__
438 # define YYCOPY(To, From, Count) \
439 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
441 # define YYCOPY(To, From, Count) \
445 for (yyi = 0; yyi < (Count); yyi++) \
446 (To)[yyi] = (From)[yyi]; \
452 /* Relocate STACK from its old location to the new one. The
453 local variables YYSIZE and YYSTACKSIZE give the old and new number of
454 elements in the stack, and YYPTR gives the new location of the
455 stack. Advance YYPTR to a properly aligned location for the next
457 # define YYSTACK_RELOCATE(Stack) \
460 YYSIZE_T yynewbytes; \
461 YYCOPY (&yyptr->Stack, Stack, yysize); \
462 Stack = &yyptr->Stack; \
463 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
464 yyptr += yynewbytes / sizeof (*yyptr); \
470 /* YYFINAL -- State number of the termination state. */
472 /* YYLAST -- Last index in YYTABLE. */
475 /* YYNTOKENS -- Number of terminals. */
477 /* YYNNTS -- Number of nonterminals. */
479 /* YYNRULES -- Number of rules. */
481 /* YYNRULES -- Number of states. */
484 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
486 #define YYMAXUTOK 262
488 #define YYTRANSLATE(YYX) \
489 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
491 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
492 static const yytype_uint8 yytranslate[] =
494 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
498 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
500 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
524 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
526 static const yytype_uint8 yyprhs[] =
528 0, 0, 3, 5, 11, 15, 19, 23, 27, 31,
532 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
533 static const yytype_int8 yyrhs[] =
535 17, 0, -1, 18, -1, 18, 3, 18, 12, 18,
536 -1, 18, 4, 18, -1, 18, 5, 18, -1, 18,
537 6, 18, -1, 18, 7, 18, -1, 18, 8, 18,
538 -1, 18, 9, 18, -1, 10, 18, -1, 13, -1,
539 11, -1, 14, 18, 15, -1
542 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
543 static const yytype_uint8 yyrline[] =
545 0, 152, 152, 160, 164, 168, 172, 176, 180, 184,
550 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
551 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
552 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
553 static const char *const yytname[] =
555 "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
556 "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
557 "$accept", "start", "exp", 0
562 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
564 static const yytype_uint16 yytoknum[] =
566 0, 256, 257, 63, 124, 38, 258, 259, 260, 261,
567 33, 262, 58, 110, 40, 41
571 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
572 static const yytype_uint8 yyr1[] =
574 0, 16, 17, 18, 18, 18, 18, 18, 18, 18,
578 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
579 static const yytype_uint8 yyr2[] =
581 0, 2, 1, 5, 3, 3, 3, 3, 3, 3,
585 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
586 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
587 means the default is an error. */
588 static const yytype_uint8 yydefact[] =
590 0, 0, 12, 11, 0, 0, 2, 10, 0, 1,
591 0, 0, 0, 0, 0, 0, 0, 13, 0, 4,
595 /* YYDEFGOTO[NTERM-NUM]. */
596 static const yytype_int8 yydefgoto[] =
601 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
603 #define YYPACT_NINF -10
604 static const yytype_int8 yypact[] =
606 -9, -9, -10, -10, -9, 8, 36, -10, 13, -10,
607 -9, -9, -9, -9, -9, -9, -9, -10, 26, 41,
608 45, 18, -2, 14, -10, -9, 36
611 /* YYPGOTO[NTERM-NUM]. */
612 static const yytype_int8 yypgoto[] =
617 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
618 positive, shift that token. If negative, reduce the rule which
619 number is the opposite. If zero, do what YYDEFACT says.
620 If YYTABLE_NINF, syntax error. */
621 #define YYTABLE_NINF -1
622 static const yytype_uint8 yytable[] =
624 7, 1, 2, 8, 3, 4, 15, 16, 9, 18,
625 19, 20, 21, 22, 23, 24, 10, 11, 12, 13,
626 14, 15, 16, 16, 26, 14, 15, 16, 17, 10,
627 11, 12, 13, 14, 15, 16, 0, 0, 25, 10,
628 11, 12, 13, 14, 15, 16, 12, 13, 14, 15,
632 static const yytype_int8 yycheck[] =
634 1, 10, 11, 4, 13, 14, 8, 9, 0, 10,
635 11, 12, 13, 14, 15, 16, 3, 4, 5, 6,
636 7, 8, 9, 9, 25, 7, 8, 9, 15, 3,
637 4, 5, 6, 7, 8, 9, -1, -1, 12, 3,
638 4, 5, 6, 7, 8, 9, 5, 6, 7, 8,
642 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
643 symbol of state STATE-NUM. */
644 static const yytype_uint8 yystos[] =
646 0, 10, 11, 13, 14, 17, 18, 18, 18, 0,
647 3, 4, 5, 6, 7, 8, 9, 15, 18, 18,
648 18, 18, 18, 18, 18, 12, 18
651 #define yyerrok (yyerrstatus = 0)
652 #define yyclearin (yychar = YYEMPTY)
656 #define YYACCEPT goto yyacceptlab
657 #define YYABORT goto yyabortlab
658 #define YYERROR goto yyerrorlab
661 /* Like YYERROR except do call yyerror. This remains here temporarily
662 to ease the transition to the new meaning of YYERROR, for GCC.
663 Once GCC version 2 has supplanted version 1, this can go. */
665 #define YYFAIL goto yyerrlab
667 #define YYRECOVERING() (!!yyerrstatus)
669 #define YYBACKUP(Token, Value) \
671 if (yychar == YYEMPTY && yylen == 1) \
675 yytoken = YYTRANSLATE (yychar); \
681 yyerror (YY_("syntax error: cannot back up")); \
688 #define YYERRCODE 256
691 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
692 If N is 0, then set CURRENT to the empty location which ends
693 the previous symbol: RHS[0] (always defined). */
695 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
696 #ifndef YYLLOC_DEFAULT
697 # define YYLLOC_DEFAULT(Current, Rhs, N) \
701 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
702 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
703 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
704 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
708 (Current).first_line = (Current).last_line = \
709 YYRHSLOC (Rhs, 0).last_line; \
710 (Current).first_column = (Current).last_column = \
711 YYRHSLOC (Rhs, 0).last_column; \
717 /* YY_LOCATION_PRINT -- Print the location on the stream.
718 This macro was not mandated originally: define only if we know
719 we won't break user code: when these are the locations we know. */
721 #ifndef YY_LOCATION_PRINT
722 # if YYLTYPE_IS_TRIVIAL
723 # define YY_LOCATION_PRINT(File, Loc) \
724 fprintf (File, "%d.%d-%d.%d", \
725 (Loc).first_line, (Loc).first_column, \
726 (Loc).last_line, (Loc).last_column)
728 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
733 /* YYLEX -- calling `yylex' with the right arguments. */
736 # define YYLEX yylex (&yylval, YYLEX_PARAM)
738 # define YYLEX yylex (&yylval)
741 /* Enable debugging if requested. */
745 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
746 # define YYFPRINTF fprintf
749 # define YYDPRINTF(Args) \
755 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
759 YYFPRINTF (stderr, "%s ", Title); \
760 yy_symbol_print (stderr, \
762 YYFPRINTF (stderr, "\n"); \
767 /*--------------------------------.
768 | Print this symbol on YYOUTPUT. |
769 `--------------------------------*/
772 #if (defined __STDC__ || defined __C99__FUNC__ \
773 || defined __cplusplus || defined _MSC_VER)
775 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
778 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
781 YYSTYPE const * const yyvaluep;
787 if (yytype < YYNTOKENS)
788 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
800 /*--------------------------------.
801 | Print this symbol on YYOUTPUT. |
802 `--------------------------------*/
804 #if (defined __STDC__ || defined __C99__FUNC__ \
805 || defined __cplusplus || defined _MSC_VER)
807 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
810 yy_symbol_print (yyoutput, yytype, yyvaluep)
813 YYSTYPE const * const yyvaluep;
816 if (yytype < YYNTOKENS)
817 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
819 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
821 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
822 YYFPRINTF (yyoutput, ")");
825 /*------------------------------------------------------------------.
826 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
828 `------------------------------------------------------------------*/
830 #if (defined __STDC__ || defined __C99__FUNC__ \
831 || defined __cplusplus || defined _MSC_VER)
833 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
836 yy_stack_print (bottom, top)
837 yytype_int16 *bottom;
841 YYFPRINTF (stderr, "Stack now");
842 for (; bottom <= top; ++bottom)
843 YYFPRINTF (stderr, " %d", *bottom);
844 YYFPRINTF (stderr, "\n");
847 # define YY_STACK_PRINT(Bottom, Top) \
850 yy_stack_print ((Bottom), (Top)); \
854 /*------------------------------------------------.
855 | Report that the YYRULE is going to be reduced. |
856 `------------------------------------------------*/
858 #if (defined __STDC__ || defined __C99__FUNC__ \
859 || defined __cplusplus || defined _MSC_VER)
861 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
864 yy_reduce_print (yyvsp, yyrule)
869 int yynrhs = yyr2[yyrule];
871 unsigned long int yylno = yyrline[yyrule];
872 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
874 /* The symbols being reduced. */
875 for (yyi = 0; yyi < yynrhs; yyi++)
877 fprintf (stderr, " $%d = ", yyi + 1);
878 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
879 &(yyvsp[(yyi + 1) - (yynrhs)])
881 fprintf (stderr, "\n");
885 # define YY_REDUCE_PRINT(Rule) \
888 yy_reduce_print (yyvsp, Rule); \
891 /* Nonzero means print parse trace. It is left uninitialized so that
892 multiple parsers can coexist. */
895 # define YYDPRINTF(Args)
896 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
897 # define YY_STACK_PRINT(Bottom, Top)
898 # define YY_REDUCE_PRINT(Rule)
899 #endif /* !YYDEBUG */
902 /* YYINITDEPTH -- initial size of the parser's stacks. */
904 # define YYINITDEPTH 200
907 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
908 if the built-in stack extension method is used).
910 Do not make this value too large; the results are undefined if
911 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
912 evaluated with infinite-precision integer arithmetic. */
915 # define YYMAXDEPTH 10000
923 # if defined __GLIBC__ && defined _STRING_H
924 # define yystrlen strlen
926 /* Return the length of YYSTR. */
927 #if (defined __STDC__ || defined __C99__FUNC__ \
928 || defined __cplusplus || defined _MSC_VER)
930 yystrlen (const char *yystr)
938 for (yylen = 0; yystr[yylen]; yylen++)
946 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
947 # define yystpcpy stpcpy
949 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
951 #if (defined __STDC__ || defined __C99__FUNC__ \
952 || defined __cplusplus || defined _MSC_VER)
954 yystpcpy (char *yydest, const char *yysrc)
957 yystpcpy (yydest, yysrc)
963 const char *yys = yysrc;
965 while ((*yyd++ = *yys++) != '\0')
974 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
975 quotes and backslashes, so that it's suitable for yyerror. The
976 heuristic is that double-quoting is unnecessary unless the string
977 contains an apostrophe, a comma, or backslash (other than
978 backslash-backslash). YYSTR is taken from yytname. If YYRES is
979 null, do not copy; instead, return the length of what the result
982 yytnamerr (char *yyres, const char *yystr)
987 char const *yyp = yystr;
994 goto do_not_strip_quotes;
998 goto do_not_strip_quotes;
1011 do_not_strip_quotes: ;
1015 return yystrlen (yystr);
1017 return yystpcpy (yyres, yystr) - yyres;
1021 /* Copy into YYRESULT an error message about the unexpected token
1022 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1023 including the terminating null byte. If YYRESULT is null, do not
1024 copy anything; just return the number of bytes that would be
1025 copied. As a special case, return 0 if an ordinary "syntax error"
1026 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1027 size calculation. */
1029 yysyntax_error (char *yyresult, int yystate, int yychar)
1031 int yyn = yypact[yystate];
1033 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1037 int yytype = YYTRANSLATE (yychar);
1038 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1039 YYSIZE_T yysize = yysize0;
1041 int yysize_overflow = 0;
1042 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1043 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1047 /* This is so xgettext sees the translatable formats that are
1048 constructed on the fly. */
1049 YY_("syntax error, unexpected %s");
1050 YY_("syntax error, unexpected %s, expecting %s");
1051 YY_("syntax error, unexpected %s, expecting %s or %s");
1052 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1053 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1057 static char const yyunexpected[] = "syntax error, unexpected %s";
1058 static char const yyexpecting[] = ", expecting %s";
1059 static char const yyor[] = " or %s";
1060 char yyformat[sizeof yyunexpected
1061 + sizeof yyexpecting - 1
1062 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1063 * (sizeof yyor - 1))];
1064 char const *yyprefix = yyexpecting;
1066 /* Start YYX at -YYN if negative to avoid negative indexes in
1068 int yyxbegin = yyn < 0 ? -yyn : 0;
1070 /* Stay within bounds of both yycheck and yytname. */
1071 int yychecklim = YYLAST - yyn + 1;
1072 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1075 yyarg[0] = yytname[yytype];
1076 yyfmt = yystpcpy (yyformat, yyunexpected);
1078 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1079 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1081 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1085 yyformat[sizeof yyunexpected - 1] = '\0';
1088 yyarg[yycount++] = yytname[yyx];
1089 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1090 yysize_overflow |= (yysize1 < yysize);
1092 yyfmt = yystpcpy (yyfmt, yyprefix);
1096 yyf = YY_(yyformat);
1097 yysize1 = yysize + yystrlen (yyf);
1098 yysize_overflow |= (yysize1 < yysize);
1101 if (yysize_overflow)
1102 return YYSIZE_MAXIMUM;
1106 /* Avoid sprintf, as that infringes on the user's name space.
1107 Don't have undefined behavior even if the translation
1108 produced a string with the wrong number of "%s"s. */
1109 char *yyp = yyresult;
1111 while ((*yyp = *yyf) != '\0')
1113 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1115 yyp += yytnamerr (yyp, yyarg[yyi++]);
1128 #endif /* YYERROR_VERBOSE */
1131 /*-----------------------------------------------.
1132 | Release the memory associated to this symbol. |
1133 `-----------------------------------------------*/
1136 #if (defined __STDC__ || defined __C99__FUNC__ \
1137 || defined __cplusplus || defined _MSC_VER)
1139 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1142 yydestruct (yymsg, yytype, yyvaluep)
1152 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1163 /* Prevent warnings from -Wmissing-prototypes. */
1165 #ifdef YYPARSE_PARAM
1166 #if defined __STDC__ || defined __cplusplus
1167 int yyparse (void *YYPARSE_PARAM);
1171 #else /* ! YYPARSE_PARAM */
1172 #if defined __STDC__ || defined __cplusplus
1177 #endif /* ! YYPARSE_PARAM */
1188 #ifdef YYPARSE_PARAM
1189 #if (defined __STDC__ || defined __C99__FUNC__ \
1190 || defined __cplusplus || defined _MSC_VER)
1192 yyparse (void *YYPARSE_PARAM)
1195 yyparse (YYPARSE_PARAM)
1196 void *YYPARSE_PARAM;
1198 #else /* ! YYPARSE_PARAM */
1199 #if (defined __STDC__ || defined __C99__FUNC__ \
1200 || defined __cplusplus || defined _MSC_VER)
1210 /* The look-ahead symbol. */
1213 /* The semantic value of the look-ahead symbol. */
1216 /* Number of syntax errors so far. */
1222 /* Number of tokens to shift before error messages enabled. */
1224 /* Look-ahead token as an internal (translated) token number. */
1227 /* Buffer for error messages, and its allocated size. */
1229 char *yymsg = yymsgbuf;
1230 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1233 /* Three stacks and their tools:
1234 `yyss': related to states,
1235 `yyvs': related to semantic values,
1236 `yyls': related to locations.
1238 Refer to the stacks thru separate pointers, to allow yyoverflow
1239 to reallocate them elsewhere. */
1241 /* The state stack. */
1242 yytype_int16 yyssa[YYINITDEPTH];
1243 yytype_int16 *yyss = yyssa;
1244 yytype_int16 *yyssp;
1246 /* The semantic value stack. */
1247 YYSTYPE yyvsa[YYINITDEPTH];
1248 YYSTYPE *yyvs = yyvsa;
1253 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1255 YYSIZE_T yystacksize = YYINITDEPTH;
1257 /* The variables used to return semantic value and location from the
1262 /* The number of symbols on the RHS of the reduced rule.
1263 Keep to zero when no symbol should be popped. */
1266 YYDPRINTF ((stderr, "Starting parse\n"));
1271 yychar = YYEMPTY; /* Cause a token to be read. */
1273 /* Initialize stack pointers.
1274 Waste one element of value and location stack
1275 so that they stay on the same level as the state stack.
1276 The wasted elements are never initialized. */
1283 /*------------------------------------------------------------.
1284 | yynewstate -- Push a new state, which is found in yystate. |
1285 `------------------------------------------------------------*/
1287 /* In all cases, when you get here, the value and location stacks
1288 have just been pushed. So pushing a state here evens the stacks. */
1294 if (yyss + yystacksize - 1 <= yyssp)
1296 /* Get the current used size of the three stacks, in elements. */
1297 YYSIZE_T yysize = yyssp - yyss + 1;
1301 /* Give user a chance to reallocate the stack. Use copies of
1302 these so that the &'s don't force the real ones into
1304 YYSTYPE *yyvs1 = yyvs;
1305 yytype_int16 *yyss1 = yyss;
1308 /* Each stack pointer address is followed by the size of the
1309 data in use in that stack, in bytes. This used to be a
1310 conditional around just the two extra args, but that might
1311 be undefined if yyoverflow is a macro. */
1312 yyoverflow (YY_("memory exhausted"),
1313 &yyss1, yysize * sizeof (*yyssp),
1314 &yyvs1, yysize * sizeof (*yyvsp),
1321 #else /* no yyoverflow */
1322 # ifndef YYSTACK_RELOCATE
1323 goto yyexhaustedlab;
1325 /* Extend the stack our own way. */
1326 if (YYMAXDEPTH <= yystacksize)
1327 goto yyexhaustedlab;
1329 if (YYMAXDEPTH < yystacksize)
1330 yystacksize = YYMAXDEPTH;
1333 yytype_int16 *yyss1 = yyss;
1334 union yyalloc *yyptr =
1335 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1337 goto yyexhaustedlab;
1338 YYSTACK_RELOCATE (yyss);
1339 YYSTACK_RELOCATE (yyvs);
1341 # undef YYSTACK_RELOCATE
1343 YYSTACK_FREE (yyss1);
1346 #endif /* no yyoverflow */
1348 yyssp = yyss + yysize - 1;
1349 yyvsp = yyvs + yysize - 1;
1352 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1353 (unsigned long int) yystacksize));
1355 if (yyss + yystacksize - 1 <= yyssp)
1359 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1368 /* Do appropriate processing given the current state. Read a
1369 look-ahead token if we need one and don't already have one. */
1371 /* First try to decide what to do without reference to look-ahead token. */
1372 yyn = yypact[yystate];
1373 if (yyn == YYPACT_NINF)
1376 /* Not known => get a look-ahead token if don't already have one. */
1378 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1379 if (yychar == YYEMPTY)
1381 YYDPRINTF ((stderr, "Reading a token: "));
1385 if (yychar <= YYEOF)
1387 yychar = yytoken = YYEOF;
1388 YYDPRINTF ((stderr, "Now at end of input.\n"));
1392 yytoken = YYTRANSLATE (yychar);
1393 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1396 /* If the proper action on seeing token YYTOKEN is to reduce or to
1397 detect an error, take that action. */
1399 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1404 if (yyn == 0 || yyn == YYTABLE_NINF)
1413 /* Count tokens shifted since error; after three, turn off error
1418 /* Shift the look-ahead token. */
1419 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1421 /* Discard the shifted token unless it is eof. */
1422 if (yychar != YYEOF)
1431 /*-----------------------------------------------------------.
1432 | yydefault -- do the default action for the current state. |
1433 `-----------------------------------------------------------*/
1435 yyn = yydefact[yystate];
1441 /*-----------------------------.
1442 | yyreduce -- Do a reduction. |
1443 `-----------------------------*/
1445 /* yyn is the number of a rule to reduce with. */
1448 /* If YYLEN is nonzero, implement the default value of the action:
1451 Otherwise, the following line sets YYVAL to garbage.
1452 This behavior is undocumented and Bison
1453 users should not rely upon it. Assigning to YYVAL
1454 unconditionally makes the parser a bit smaller, and it avoids a
1455 GCC warning that YYVAL may be used uninitialized. */
1456 yyval = yyvsp[1-yylen];
1459 YY_REDUCE_PRINT (yyn);
1463 #line 153 "../../lyx-devel/intl/plural.y"
1465 if ((yyvsp[(1) - (1)].exp) == NULL)
1467 ((struct parse_args *) arg)->res = (yyvsp[(1) - (1)].exp);
1472 #line 161 "../../lyx-devel/intl/plural.y"
1474 (yyval.exp) = new_exp_3 (qmop, (yyvsp[(1) - (5)].exp), (yyvsp[(3) - (5)].exp), (yyvsp[(5) - (5)].exp));
1479 #line 165 "../../lyx-devel/intl/plural.y"
1481 (yyval.exp) = new_exp_2 (lor, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1486 #line 169 "../../lyx-devel/intl/plural.y"
1488 (yyval.exp) = new_exp_2 (land, (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1493 #line 173 "../../lyx-devel/intl/plural.y"
1495 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1500 #line 177 "../../lyx-devel/intl/plural.y"
1502 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1507 #line 181 "../../lyx-devel/intl/plural.y"
1509 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1514 #line 185 "../../lyx-devel/intl/plural.y"
1516 (yyval.exp) = new_exp_2 ((yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].exp), (yyvsp[(3) - (3)].exp));
1521 #line 189 "../../lyx-devel/intl/plural.y"
1523 (yyval.exp) = new_exp_1 (lnot, (yyvsp[(2) - (2)].exp));
1528 #line 193 "../../lyx-devel/intl/plural.y"
1530 (yyval.exp) = new_exp_0 (var);
1535 #line 197 "../../lyx-devel/intl/plural.y"
1537 if (((yyval.exp) = new_exp_0 (num)) != NULL)
1538 (yyval.exp)->val.num = (yyvsp[(1) - (1)].num);
1543 #line 202 "../../lyx-devel/intl/plural.y"
1545 (yyval.exp) = (yyvsp[(2) - (3)].exp);
1550 /* Line 1267 of yacc.c. */
1551 #line 1552 "../../lyx-devel/intl/plural.c"
1554 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1558 YY_STACK_PRINT (yyss, yyssp);
1563 /* Now `shift' the result of the reduction. Determine what state
1564 that goes to, based on the state we popped back to and the rule
1565 number reduced by. */
1569 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1570 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1571 yystate = yytable[yystate];
1573 yystate = yydefgoto[yyn - YYNTOKENS];
1578 /*------------------------------------.
1579 | yyerrlab -- here on detecting error |
1580 `------------------------------------*/
1582 /* If not already recovering from an error, report this error. */
1586 #if ! YYERROR_VERBOSE
1587 yyerror (YY_("syntax error"));
1590 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1591 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1593 YYSIZE_T yyalloc = 2 * yysize;
1594 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1595 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1596 if (yymsg != yymsgbuf)
1597 YYSTACK_FREE (yymsg);
1598 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1600 yymsg_alloc = yyalloc;
1604 yymsg_alloc = sizeof yymsgbuf;
1608 if (0 < yysize && yysize <= yymsg_alloc)
1610 (void) yysyntax_error (yymsg, yystate, yychar);
1615 yyerror (YY_("syntax error"));
1617 goto yyexhaustedlab;
1625 if (yyerrstatus == 3)
1627 /* If just tried and failed to reuse look-ahead token after an
1628 error, discard it. */
1630 if (yychar <= YYEOF)
1632 /* Return failure if at end of input. */
1633 if (yychar == YYEOF)
1638 yydestruct ("Error: discarding",
1644 /* Else will try to reuse look-ahead token after shifting the error
1649 /*---------------------------------------------------.
1650 | yyerrorlab -- error raised explicitly by YYERROR. |
1651 `---------------------------------------------------*/
1654 /* Pacify compilers like GCC when the user code never invokes
1655 YYERROR and the label yyerrorlab therefore never appears in user
1657 if (/*CONSTCOND*/ 0)
1660 /* Do not reclaim the symbols of the rule which action triggered
1664 YY_STACK_PRINT (yyss, yyssp);
1669 /*-------------------------------------------------------------.
1670 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1671 `-------------------------------------------------------------*/
1673 yyerrstatus = 3; /* Each real token shifted decrements this. */
1677 yyn = yypact[yystate];
1678 if (yyn != YYPACT_NINF)
1681 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1689 /* Pop the current state because it cannot handle the error token. */
1694 yydestruct ("Error: popping",
1695 yystos[yystate], yyvsp);
1698 YY_STACK_PRINT (yyss, yyssp);
1707 /* Shift the error token. */
1708 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1714 /*-------------------------------------.
1715 | yyacceptlab -- YYACCEPT comes here. |
1716 `-------------------------------------*/
1721 /*-----------------------------------.
1722 | yyabortlab -- YYABORT comes here. |
1723 `-----------------------------------*/
1729 /*-------------------------------------------------.
1730 | yyexhaustedlab -- memory exhaustion comes here. |
1731 `-------------------------------------------------*/
1733 yyerror (YY_("memory exhausted"));
1739 if (yychar != YYEOF && yychar != YYEMPTY)
1740 yydestruct ("Cleanup: discarding lookahead",
1742 /* Do not reclaim the symbols of the rule which action triggered
1743 this YYABORT or YYACCEPT. */
1745 YY_STACK_PRINT (yyss, yyssp);
1746 while (yyssp != yyss)
1748 yydestruct ("Cleanup: popping",
1749 yystos[*yyssp], yyvsp);
1754 YYSTACK_FREE (yyss);
1757 if (yymsg != yymsgbuf)
1758 YYSTACK_FREE (yymsg);
1760 /* Make sure YYID is used. */
1761 return YYID (yyresult);
1765 #line 207 "../../lyx-devel/intl/plural.y"
1770 FREE_EXPRESSION (struct expression *exp)
1775 /* Handle the recursive case. */
1779 FREE_EXPRESSION (exp->val.args[2]);
1782 FREE_EXPRESSION (exp->val.args[1]);
1785 FREE_EXPRESSION (exp->val.args[0]);
1796 yylex (YYSTYPE *lval, const char **pexp)
1798 const char *exp = *pexp;
1809 if (exp[0] != ' ' && exp[0] != '\t')
1818 case '0': case '1': case '2': case '3': case '4':
1819 case '5': case '6': case '7': case '8': case '9':
1821 unsigned long int n = result - '0';
1822 while (exp[0] >= '0' && exp[0] <= '9')
1848 lval->op = not_equal;
1855 if (exp[0] == result)
1865 lval->op = less_or_equal;
1868 lval->op = less_than;
1876 lval->op = greater_or_equal;
1879 lval->op = greater_than;
1913 /* Nothing, just return the character. */
1919 /* Be safe and let the user call this function again. */
1939 yyerror (const char *str)
1941 /* Do nothing. We don't print error messages here. */