⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plural.c

📁 一个扑克牌游戏集合的源码,包含了很多基本c-c++语言应用
💻 C
📖 第 1 页 / 共 3 页
字号:
/* A Bison parser, made by GNU Bison 2.1.  *//* Skeleton parser for Yacc-like parsing with Bison,   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2, or (at your option)   any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 51 Franklin Street, Fifth Floor,   Boston, MA 02110-1301, USA.  *//* As a special exception, when this file is copied by Bison into a   Bison output file, you may use that output file without restriction.   This special exception was added by the Free Software Foundation   in version 1.24 of Bison.  *//* Written by Richard Stallman by simplifying the original so called   ``semantic'' parser.  *//* All symbols defined below should begin with yy or YY, to avoid   infringing on user name space.  This should be done even for local   variables, as they might otherwise be expanded by user macros.   There are some unavoidable exceptions within include files to   define necessary library symbols; they are noted "INFRINGES ON   USER NAME SPACE" below.  *//* Identify Bison output.  */#define YYBISON 1/* Bison version.  */#define YYBISON_VERSION "2.1"/* Skeleton name.  */#define YYSKELETON_NAME "yacc.c"/* Pure parsers.  */#define YYPURE 1/* Using locations.  */#define YYLSP_NEEDED 0/* Substitute the variable and function names.  */#define yyparse __gettextparse#define yylex   __gettextlex#define yyerror __gettexterror#define yylval  __gettextlval#define yychar  __gettextchar#define yydebug __gettextdebug#define yynerrs __gettextnerrs/* Tokens.  */#ifndef YYTOKENTYPE# define YYTOKENTYPE   /* Put the tokens into the symbol table, so that GDB and other debuggers      know about them.  */   enum yytokentype {     EQUOP2 = 258,     CMPOP2 = 259,     ADDOP2 = 260,     MULOP2 = 261,     NUMBER = 262   };#endif/* Tokens.  */#define EQUOP2 258#define CMPOP2 259#define ADDOP2 260#define MULOP2 261#define NUMBER 262/* Copy the first part of user declarations.  */#line 1 "plural.y"/* Expression parsing for plural form selection.   Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.   Written by Ulrich Drepper <drepper@cygnus.com>, 2000.   This program is free software; you can redistribute it and/or modify it   under the terms of the GNU Library General Public License as published   by the Free Software Foundation; either version 2, or (at your option)   any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   Library General Public License for more details.   You should have received a copy of the GNU Library General Public   License along with this program; if not, write to the Free Software   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,   USA.  *//* The bison generated parser uses alloca.  AIX 3 forces us to put this   declaration at the beginning of the file.  The declaration in bison's   skeleton file comes too late.  This must come before <config.h>   because <config.h> may include arbitrary system headers.  */#if defined _AIX && !defined __GNUC__ #pragma alloca#endif#ifdef HAVE_CONFIG_H# include <config.h>#endif#include <stddef.h>#include <stdlib.h>#include "plural-exp.h"/* The main function generated by the parser is called __gettextparse,   but we want it to be called PLURAL_PARSE.  */#ifndef _LIBC# define __gettextparse PLURAL_PARSE#endif#define YYLEX_PARAM	&((struct parse_args *) arg)->cp#define YYPARSE_PARAM	arg/* Enabling traces.  */#ifndef YYDEBUG# define YYDEBUG 0#endif/* Enabling verbose error messages.  */#ifdef YYERROR_VERBOSE# undef YYERROR_VERBOSE# define YYERROR_VERBOSE 1#else# define YYERROR_VERBOSE 0#endif/* Enabling the token table.  */#ifndef YYTOKEN_TABLE# define YYTOKEN_TABLE 0#endif#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)#line 49 "plural.y"typedef union YYSTYPE {  unsigned long int num;  enum operator op;  struct expression *exp;} YYSTYPE;/* Line 196 of yacc.c.  */#line 159 "plural.c"# define yystype YYSTYPE /* obsolescent; will be withdrawn */# define YYSTYPE_IS_DECLARED 1# define YYSTYPE_IS_TRIVIAL 1#endif/* Copy the second part of user declarations.  */#line 55 "plural.y"/* Prototypes for local functions.  */static int yylex (YYSTYPE *lval, const char **pexp);static void yyerror (const char *str);/* Allocation of expressions.  */static struct expression *new_exp (int nargs, enum operator op, struct expression * const *args){  int i;  struct expression *newp;  /* If any of the argument could not be malloc'ed, just return NULL.  */  for (i = nargs - 1; i >= 0; i--)    if (args[i] == NULL)      goto fail;  /* Allocate a new expression.  */  newp = (struct expression *) malloc (sizeof (*newp));  if (newp != NULL)    {      newp->nargs = nargs;      newp->operation = op;      for (i = nargs - 1; i >= 0; i--)	newp->val.args[i] = args[i];      return newp;    } fail:  for (i = nargs - 1; i >= 0; i--)    FREE_EXPRESSION (args[i]);  return NULL;}static inline struct expression *new_exp_0 (enum operator op){  return new_exp (0, op, NULL);}static inline struct expression *new_exp_1 (enum operator op, struct expression *right){  struct expression *args[1];  args[0] = right;  return new_exp (1, op, args);}static struct expression *new_exp_2 (enum operator op, struct expression *left, struct expression *right){  struct expression *args[2];  args[0] = left;  args[1] = right;  return new_exp (2, op, args);}static inline struct expression *new_exp_3 (enum operator op, struct expression *bexp,	   struct expression *tbranch, struct expression *fbranch){  struct expression *args[3];  args[0] = bexp;  args[1] = tbranch;  args[2] = fbranch;  return new_exp (3, op, args);}/* Line 219 of yacc.c.  */#line 245 "plural.c"#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)# define YYSIZE_T __SIZE_TYPE__#endif#if ! defined (YYSIZE_T) && defined (size_t)# define YYSIZE_T size_t#endif#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))# include <stddef.h> /* INFRINGES ON USER NAME SPACE */# define YYSIZE_T size_t#endif#if ! defined (YYSIZE_T)# define YYSIZE_T unsigned int#endif#ifndef YY_# if YYENABLE_NLS#  if ENABLE_NLS#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */#   define YY_(msgid) dgettext ("bison-runtime", msgid)#  endif# endif# ifndef YY_#  define YY_(msgid) msgid# endif#endif#if ! defined (yyoverflow) || YYERROR_VERBOSE/* The parser invokes alloca or malloc; define the necessary symbols.  */# ifdef YYSTACK_USE_ALLOCA#  if YYSTACK_USE_ALLOCA#   ifdef __GNUC__#    define YYSTACK_ALLOC __builtin_alloca#   else#    define YYSTACK_ALLOC alloca#    if defined (__STDC__) || defined (__cplusplus)#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */#     define YYINCLUDED_STDLIB_H#    endif#   endif#  endif# endif# ifdef YYSTACK_ALLOC   /* Pacify GCC's `empty if-body' warning. */#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)#  ifndef YYSTACK_ALLOC_MAXIMUM    /* The OS might guarantee only one guard page at the bottom of the stack,       and a page size can be as small as 4096 bytes.  So we cannot safely       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number       to allow for a few compiler-allocated temporary stack slots.  */#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */#  endif# else#  define YYSTACK_ALLOC YYMALLOC#  define YYSTACK_FREE YYFREE#  ifndef YYSTACK_ALLOC_MAXIMUM#   define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)#  endif#  ifdef __cplusplusextern "C" {#  endif#  ifndef YYMALLOC#   define YYMALLOC malloc#   if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \	&& (defined (__STDC__) || defined (__cplusplus)))void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */#   endif#  endif#  ifndef YYFREE#   define YYFREE free#   if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \	&& (defined (__STDC__) || defined (__cplusplus)))void free (void *); /* INFRINGES ON USER NAME SPACE */#   endif#  endif#  ifdef __cplusplus}#  endif# endif#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */#if (! defined (yyoverflow) \     && (! defined (__cplusplus) \	 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member.  */union yyalloc{  short int yyss;  YYSTYPE yyvs;  };/* The size of the maximum gap between one aligned stack and the next.  */# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)/* The size of an array large to enough to hold all stacks, each with   N elements.  */# define YYSTACK_BYTES(N) \     ((N) * (sizeof (short int) + sizeof (YYSTYPE))			\      + YYSTACK_GAP_MAXIMUM)/* Copy COUNT objects from FROM to TO.  The source and destination do   not overlap.  */# ifndef YYCOPY#  if defined (__GNUC__) && 1 < __GNUC__#   define YYCOPY(To, From, Count) \      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))#  else#   define YYCOPY(To, From, Count)		\      do					\	{					\	  YYSIZE_T yyi;				\	  for (yyi = 0; yyi < (Count); yyi++)	\	    (To)[yyi] = (From)[yyi];		\	}					\      while (0)#  endif# endif/* Relocate STACK from its old location to the new one.  The   local variables YYSIZE and YYSTACKSIZE give the old and new number of   elements in the stack, and YYPTR gives the new location of the   stack.  Advance YYPTR to a properly aligned location for the next   stack.  */# define YYSTACK_RELOCATE(Stack)					\    do									\      {									\	YYSIZE_T yynewbytes;						\	YYCOPY (&yyptr->Stack, Stack, yysize);				\	Stack = &yyptr->Stack;						\	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \	yyptr += yynewbytes / sizeof (*yyptr);				\      }									\    while (0)#endif#if defined (__STDC__) || defined (__cplusplus)   typedef signed char yysigned_char;#else   typedef short int yysigned_char;#endif/* YYFINAL -- State number of the termination state. */#define YYFINAL  9/* YYLAST -- Last index in YYTABLE.  */#define YYLAST   54/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS  16/* YYNNTS -- Number of nonterminals. */#define YYNNTS  3/* YYNRULES -- Number of rules. */#define YYNRULES  13/* YYNRULES -- Number of states. */#define YYNSTATES  27/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */#define YYUNDEFTOK  2#define YYMAXUTOK   262#define YYTRANSLATE(YYX)						\  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */static const unsigned char yytranslate[] ={       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,    10,     2,     2,     2,     2,     5,     2,      14,    15,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,    12,     2,       2,     2,     2,     3,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,      13,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     4,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     2,     2,     2,     2,     1,     2,     6,     7,       8,     9,    11};#if YYDEBUG/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in   YYRHS.  */static const unsigned char yyprhs[] ={       0,     0,     3,     5,    11,    15,    19,    23,    27,    31,      35,    38,    40,    42};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const yysigned_char yyrhs[] ={      17,     0,    -1,    18,    -1,    18,     3,    18,    12,    18,      -1,    18,     4,    18,    -1,    18,     5,    18,    -1,    18,       6,    18,    -1,    18,     7,    18,    -1,    18,     8,    18,      -1,    18,     9,    18,    -1,    10,    18,    -1,    13,    -1,      11,    -1,    14,    18,    15,    -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */static const unsigned char yyrline[] ={       0,   150,   150,   158,   162,   166,   170,   174,   178,   182,     186,   190,   194,   199};#endif#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.   First, the terminals, then, starting at YYNTOKENS, nonterminals. */static const char *const yytname[] ={  "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",  "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",  "$accept", "start", "exp", 0};#endif# ifdef YYPRINT/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to   token YYLEX-NUM.  */static const unsigned short int yytoknum[] ={       0,   256,   257,    63,   124,    38,   258,   259,   260,   261,      33,   262,    58,   110,    40,    41};# endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */static const unsigned char yyr1[] ={       0,    16,    17,    18,    18,    18,    18,    18,    18,    18,      18,    18,    18,    18};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */static const unsigned char yyr2[] ={       0,     2,     1,     5,     3,     3,     3,     3,     3,     3,       2,     1,     1,     3};/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero   means the default is an error.  */static const unsigned char yydefact[] ={       0,     0,    12,    11,     0,     0,     2,    10,     0,     1,       0,     0,     0,     0,     0,     0,     0,    13,     0,     4,       5,     6,     7,     8,     9,     0,     3};/* YYDEFGOTO[NTERM-NUM]. */static const yysigned_char yydefgoto[] ={      -1,     5,     6};/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing   STATE-NUM.  */#define YYPACT_NINF -10static const yysigned_char yypact[] ={      -9,    -9,   -10,   -10,    -9,     8,    36,   -10,    13,   -10,      -9,    -9,    -9,    -9,    -9,    -9,    -9,   -10,    26,    41,      45,    18,    -2,    14,   -10,    -9,    36};/* YYPGOTO[NTERM-NUM].  */static const yysigned_char yypgoto[] ={     -10,   -10,    -1};/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If   positive, shift that token.  If negative, reduce the rule which   number is the opposite.  If zero, do what YYDEFACT says.   If YYTABLE_NINF, syntax error.  */#define YYTABLE_NINF -1static const unsigned char yytable[] ={       7,     1,     2,     8,     3,     4,    15,    16,     9,    18,      19,    20,    21,    22,    23,    24,    10,    11,    12,    13,      14,    15,    16,    16,    26,    14,    15,    16,    17,    10,      11,    12,    13,    14,    15,    16,     0,     0,    25,    10,      11,    12,    13,    14,    15,    16,    12,    13,    14,    15,      16,    13,    14,    15,    16};static const yysigned_char yycheck[] ={       1,    10,    11,     4,    13,    14,     8,     9,     0,    10,      11,    12,    13,    14,    15,    16,     3,     4,     5,     6,       7,     8,     9,     9,    25,     7,     8,     9,    15,     3,       4,     5,     6,     7,     8,     9,    -1,    -1,    12,     3,       4,     5,     6,     7,     8,     9,     5,     6,     7,     8,       9,     6,     7,     8,     9};/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing   symbol of state STATE-NUM.  */static const unsigned char yystos[] ={       0,    10,    11,    13,    14,    17,    18,    18,    18,     0,       3,     4,     5,     6,     7,     8,     9,    15,    18,    18,      18,    18,    18,    18,    18,    12,    18};#define yyerrok		(yyerrstatus = 0)#define yyclearin	(yychar = YYEMPTY)#define YYEMPTY		(-2)#define YYEOF		0#define YYACCEPT	goto yyacceptlab#define YYABORT		goto yyabortlab#define YYERROR		goto yyerrorlab/* Like YYERROR except do call yyerror.  This remains here temporarily   to ease the transition to the new meaning of YYERROR, for GCC.   Once GCC version 2 has supplanted version 1, this can go.  */#define YYFAIL		goto yyerrlab#define YYRECOVERING()  (!!yyerrstatus)#define YYBACKUP(Token, Value)					\do								\  if (yychar == YYEMPTY && yylen == 1)				\

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -