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

📄 arith.c

📁 Android 一些工具
💻 C
📖 第 1 页 / 共 3 页
字号:
/* A Bison parser, made by GNU Bison 1.875d.  *//* Skeleton parser for Yacc-like parsing with Bison,   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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., 59 Temple Place - Suite 330,   Boston, MA 02111-1307, 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/* Skeleton name.  */#define YYSKELETON_NAME "yacc.c"/* Pure parsers.  */#define YYPURE 0/* Using locations.  */#define YYLSP_NEEDED 0/* Tokens.  */#ifndef YYTOKENTYPE# define YYTOKENTYPE   /* Put the tokens into the symbol table, so that GDB and other debuggers      know about them.  */   enum yytokentype {     ARITH_NUM = 258,     ARITH_LPAREN = 259,     ARITH_RPAREN = 260,     ARITH_OR = 261,     ARITH_AND = 262,     ARITH_BOR = 263,     ARITH_BXOR = 264,     ARITH_BAND = 265,     ARITH_NE = 266,     ARITH_EQ = 267,     ARITH_LE = 268,     ARITH_GE = 269,     ARITH_GT = 270,     ARITH_LT = 271,     ARITH_RSHIFT = 272,     ARITH_LSHIFT = 273,     ARITH_SUB = 274,     ARITH_ADD = 275,     ARITH_REM = 276,     ARITH_DIV = 277,     ARITH_MUL = 278,     ARITH_BNOT = 279,     ARITH_NOT = 280,     ARITH_UNARYPLUS = 281,     ARITH_UNARYMINUS = 282   };#endif#define ARITH_NUM 258#define ARITH_LPAREN 259#define ARITH_RPAREN 260#define ARITH_OR 261#define ARITH_AND 262#define ARITH_BOR 263#define ARITH_BXOR 264#define ARITH_BAND 265#define ARITH_NE 266#define ARITH_EQ 267#define ARITH_LE 268#define ARITH_GE 269#define ARITH_GT 270#define ARITH_LT 271#define ARITH_RSHIFT 272#define ARITH_LSHIFT 273#define ARITH_SUB 274#define ARITH_ADD 275#define ARITH_REM 276#define ARITH_DIV 277#define ARITH_MUL 278#define ARITH_BNOT 279#define ARITH_NOT 280#define ARITH_UNARYPLUS 281#define ARITH_UNARYMINUS 282/* Copy the first part of user declarations.  */#line 1 "arith.y"/*	$NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $	*//*- * Copyright (c) 1993 *	The Regents of the University of California.  All rights reserved. * * This code is derived from software contributed to Berkeley by * Kenneth Almquist. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */#include <sys/cdefs.h>#ifndef lint#if 0static char sccsid[] = "@(#)arith.y	8.3 (Berkeley) 5/4/95";#else__RCSID("$NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $");#endif#endif /* not lint */#include <stdlib.h>#include "expand.h"#include "shell.h"#include "error.h"#include "output.h"#include "memalloc.h"const char *arith_buf, *arith_startbuf;void yyerror(const char *);#ifdef TESTARITHint main(int , char *[]);int error(char *);#endif/* 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#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)typedef int YYSTYPE;# 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 214 of yacc.c.  */#line 202 "arith.c"#if ! defined (yyoverflow) || YYERROR_VERBOSE# ifndef YYFREE#  define YYFREE free# endif# ifndef YYMALLOC#  define YYMALLOC malloc# endif/* The parser invokes alloca or malloc; define the necessary symbols.  */# ifdef YYSTACK_USE_ALLOCA#  if YYSTACK_USE_ALLOCA#   define YYSTACK_ALLOC alloca#  endif# else#  if defined (alloca) || defined (_ALLOCA_H)#   define YYSTACK_ALLOC alloca#  else#   ifdef __GNUC__#    define YYSTACK_ALLOC __builtin_alloca#   endif#  endif# endif# ifdef YYSTACK_ALLOC   /* Pacify GCC's `empty if-body' warning. */#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else#  if defined (__STDC__) || defined (__cplusplus)#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */#   define YYSIZE_T size_t#  endif#  define YYSTACK_ALLOC YYMALLOC#  define YYSTACK_FREE YYFREE# 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					\	{					\	  register 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  14/* YYLAST -- Last index in YYTABLE.  */#define YYLAST   170/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS  28/* YYNNTS -- Number of nonterminals. */#define YYNNTS  3/* YYNRULES -- Number of rules. */#define YYNRULES  26/* YYNRULES -- Number of states. */#define YYNSTATES  52/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */#define YYUNDEFTOK  2#define YYMAXUTOK   282#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,     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,     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,     3,     4,       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,      25,    26,    27};#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,     9,    13,    17,    21,    25,    29,      33,    37,    41,    45,    49,    53,    57,    61,    65,    69,      73,    77,    81,    84,    87,    90,    93};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const yysigned_char yyrhs[] ={      29,     0,    -1,    30,    -1,     4,    30,     5,    -1,    30,       6,    30,    -1,    30,     7,    30,    -1,    30,     8,    30,      -1,    30,     9,    30,    -1,    30,    10,    30,    -1,    30,      12,    30,    -1,    30,    15,    30,    -1,    30,    14,    30,      -1,    30,    16,    30,    -1,    30,    13,    30,    -1,    30,      11,    30,    -1,    30,    18,    30,    -1,    30,    17,    30,      -1,    30,    20,    30,    -1,    30,    19,    30,    -1,    30,      23,    30,    -1,    30,    22,    30,    -1,    30,    21,    30,      -1,    25,    30,    -1,    24,    30,    -1,    19,    30,    -1,      20,    30,    -1,     3,    -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */static const unsigned char yyrline[] ={       0,    76,    76,    82,    83,    84,    85,    86,    87,    88,      89,    90,    91,    92,    93,    94,    95,    96,    97,    98,      99,   104,   109,   110,   111,   112,   113};#endif#if YYDEBUG || YYERROR_VERBOSE/* YYTNME[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", "ARITH_NUM", "ARITH_LPAREN",  "ARITH_RPAREN", "ARITH_OR", "ARITH_AND", "ARITH_BOR", "ARITH_BXOR",  "ARITH_BAND", "ARITH_NE", "ARITH_EQ", "ARITH_LE", "ARITH_GE", "ARITH_GT",  "ARITH_LT", "ARITH_RSHIFT", "ARITH_LSHIFT", "ARITH_SUB", "ARITH_ADD",  "ARITH_REM", "ARITH_DIV", "ARITH_MUL", "ARITH_BNOT", "ARITH_NOT",  "ARITH_UNARYPLUS", "ARITH_UNARYMINUS", "$accept", "exp", "expr", 0};#endif# ifdef YYPRINT/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to   token YYLEX-NUM.  */static const unsigned short int yytoknum[] ={       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,     275,   276,   277,   278,   279,   280,   281,   282};# endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */static const unsigned char yyr1[] ={       0,    28,    29,    30,    30,    30,    30,    30,    30,    30,      30,    30,    30,    30,    30,    30,    30,    30,    30,    30,      30,    30,    30,    30,    30,    30,    30};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */static const unsigned char yyr2[] ={       0,     2,     1,     3,     3,     3,     3,     3,     3,     3,       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,       3,     3,     2,     2,     2,     2,     1};/* 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,    26,     0,     0,     0,     0,     0,     0,     2,     0,      24,    25,    23,    22,     1,     0,     0,     0,     0,     0,       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,       0,     0,     0,     3,     4,     5,     6,     7,     8,    14,       9,    13,    11,    10,    12,    16,    15,    18,    17,    21,      20,    19};/* YYDEFGOTO[NTERM-NUM]. */static const yysigned_char yydefgoto[] ={      -1,     7,     8};/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing   STATE-NUM.  */#define YYPACT_NINF -13static const short int yypact[] ={      28,   -13,    28,    28,    28,    28,    28,    12,    67,    49,     -13,   -13,   -13,   -13,   -13,    28,    28,    28,    28,    28,      28,    28,    28,    28,    28,    28,    28,    28,    28,    28,      28,    28,    28,   -13,    84,   100,   115,    23,   128,   139,     139,   -12,   -12,   -12,   -12,   144,   144,   147,   147,   -13,     -13,   -13};/* YYPGOTO[NTERM-NUM].  */static const yysigned_char yypgoto[] ={     -13,   -13,    -2};/* 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[] ={       9,    10,    11,    12,    13,    26,    27,    28,    29,    30,      31,    32,    14,    34,    35,    36,    37,    38,    39,    40,      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,      51,     1,     2,    19,    20,    21,    22,    23,    24,    25,      26,    27,    28,    29,    30,    31,    32,     3,     4,     0,       0,     0,     5,     6,    33,    15,    16,    17,    18,    19,      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,      30,    31,    32,    15,    16,    17,    18,    19,    20,    21,      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,      32,    16,    17,    18,    19,    20,    21,    22,    23,    24,      25,    26,    27,    28,    29,    30,    31,    32,    17,    18,      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,      29,    30,    31,    32,    18,    19,    20,    21,    22,    23,      24,    25,    26,    27,    28,    29,    30,    31,    32,    20,      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,      31,    32,    22,    23,    24,    25,    26,    27,    28,    29,      30,    31,    32,    28,    29,    30,    31,    32,    30,    31,      32};static const yysigned_char yycheck[] ={       2,     3,     4,     5,     6,    17,    18,    19,    20,    21,      22,    23,     0,    15,    16,    17,    18,    19,    20,    21,      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,      32,     3,     4,    10,    11,    12,    13,    14,    15,    16,      17,    18,    19,    20,    21,    22,    23,    19,    20,    -1,      -1,    -1,    24,    25,     5,     6,     7,     8,     9,    10,      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,      21,    22,    23,     6,     7,     8,     9,    10,    11,    12,      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,      23,     7,     8,     9,    10,    11,    12,    13,    14,    15,      16,    17,    18,    19,    20,    21,    22,    23,     8,     9,      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,      20,    21,    22,    23,     9,    10,    11,    12,    13,    14,      15,    16,    17,    18,    19,    20,    21,    22,    23,    11,      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,      22,    23,    13,    14,    15,    16,    17,    18,    19,    20,      21,    22,    23,    19,    20,    21,    22,    23,    21,    22,      23};/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing   symbol of state STATE-NUM.  */static const unsigned char yystos[] ={       0,     3,     4,    19,    20,    24,    25,    29,    30,    30,      30,    30,    30,    30,     0,     6,     7,     8,     9,    10,      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,      21,    22,    23,     5,    30,    30,    30,    30,    30,    30,      30,    30,    30,    30,    30,    30,    30,    30,    30,    30,      30,    30

⌨️ 快捷键说明

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