GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/* A Bison parser, made by GNU Bison 2.7.12-4996. */12/* Bison implementation for Yacc-like parsers in C34Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.56This program is free software: you can redistribute it and/or modify7it under the terms of the GNU General Public License as published by8the Free Software Foundation, either version 3 of the License, or9(at your option) any later version.1011This program is distributed in the hope that it will be useful,12but WITHOUT ANY WARRANTY; without even the implied warranty of13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14GNU General Public License for more details.1516You should have received a copy of the GNU General Public License17along with this program. If not, see <http://www.gnu.org/licenses/>. */1819/* As a special exception, you may create a larger work that contains20part or all of the Bison parser skeleton and distribute that work21under terms of your choice, so long as that work isn't itself a22parser generator using the skeleton or a modified version thereof23as a parser skeleton. Alternatively, if you modify or redistribute24the parser skeleton itself, you may (at your option) remove this25special exception, which will cause the skeleton and the resulting26Bison output files to be licensed under the GNU General Public27License without this special exception.2829This special exception was added by the Free Software Foundation in30version 2.2 of Bison. */3132/* C LALR(1) parser skeleton written by Richard Stallman, by33simplifying the original so-called "semantic" parser. */3435/* All symbols defined below should begin with yy or YY, to avoid36infringing on user name space. This should be done even for local37variables, as they might otherwise be expanded by user macros.38There are some unavoidable exceptions within include files to39define necessary library symbols; they are noted "INFRINGES ON40USER NAME SPACE" below. */4142/* Identify Bison output. */43#define YYBISON 14445/* Bison version. */46#define YYBISON_VERSION "2.7.12-4996"4748/* Skeleton name. */49#define YYSKELETON_NAME "yacc.c"5051/* Pure parsers. */52#define YYPURE 05354/* Push parsers. */55#define YYPUSH 05657/* Pull parsers. */58#define YYPULL 15960616263/* Copy the first part of user declarations. */64/* Line 371 of yacc.c */65#line 1 "calc.y"6667/* A simple integer desk calculator using yacc and gmp.6869Copyright 2000-2002 Free Software Foundation, Inc.7071This file is part of the GNU MP Library.7273This program is free software; you can redistribute it and/or modify it under74the terms of the GNU General Public License as published by the Free Software75Foundation; either version 3 of the License, or (at your option) any later76version.7778This program is distributed in the hope that it will be useful, but WITHOUT ANY79WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A80PARTICULAR PURPOSE. See the GNU General Public License for more details.8182You should have received a copy of the GNU General Public License along with83this program. If not, see https://www.gnu.org/licenses/. */848586/* This is a simple program, meant only to show one way to use GMP for this87sort of thing. There's few features, and error checking is minimal.88Standard input is read, calc_help() below shows the inputs accepted.8990Expressions are evaluated as they're read. If user defined functions91were wanted it'd be necessary to build a parse tree like pexpr.c does, or92a list of operations for a stack based evaluator. That would also make93it possible to detect and optimize evaluations "mod m" like pexpr.c does.9495A stack is used for intermediate values in the expression evaluation,96separate from the yacc parser stack. This is simple, makes error97recovery easy, minimizes the junk around mpz calls in the rules, and98saves initializing or clearing "mpz_t"s during a calculation. A99disadvantage though is that variables must be copied to the stack to be100worked on. A more sophisticated calculator or language system might be101able to avoid that when executing a compiled or semi-compiled form.102103Avoiding repeated initializing and clearing of "mpz_t"s is important. In104this program the time spent parsing is obviously much greater than any105possible saving from this, but a proper calculator or language should106take some trouble over it. Don't be surprised if an init/clear takes 3107or more times as long as a 10 limb addition, depending on the system (see108the mpz_init_realloc_clear example in tune/README). */109110111#include <stdio.h>112#include <stdlib.h>113#include <string.h>114#include "gmp.h"115#define NO_CALC_H /* because it conflicts with normal calc.c stuff */116#include "calc-common.h"117118119#define numberof(x) (sizeof (x) / sizeof ((x)[0]))120121122void123calc_help (void)124{125printf ("Examples:\n");126printf (" 2+3*4 expressions are evaluated\n");127printf (" x=5^6 variables a to z can be set and used\n");128printf ("Operators:\n");129printf (" + - * arithmetic\n");130printf (" / %% division and remainder (rounding towards negative infinity)\n");131printf (" ^ exponentiation\n");132printf (" ! factorial\n");133printf (" << >> left and right shifts\n");134printf (" <= >= > \\ comparisons, giving 1 if true, 0 if false\n");135printf (" == != < /\n");136printf (" && || logical and/or, giving 1 if true, 0 if false\n");137printf ("Functions:\n");138printf (" abs(n) absolute value\n");139printf (" bin(n,m) binomial coefficient\n");140printf (" fib(n) fibonacci number\n");141printf (" gcd(a,b,..) greatest common divisor\n");142printf (" kron(a,b) kronecker symbol\n");143printf (" lcm(a,b,..) least common multiple\n");144printf (" lucnum(n) lucas number\n");145printf (" nextprime(n) next prime after n\n");146printf (" powm(b,e,m) modulo powering, b^e%%m\n");147printf (" root(n,r) r-th root\n");148printf (" sqrt(n) square root\n");149printf ("Other:\n");150printf (" hex \\ set hex or decimal for input and output\n");151printf (" decimal / (\"0x\" can be used for hex too)\n");152printf (" quit exit program (EOF works too)\n");153printf (" ; statements are separated with a ; or newline\n");154printf (" \\ continue expressions with \\ before newline\n");155printf (" # xxx comments are # though to newline\n");156printf ("Hex numbers must be entered in upper case, to distinguish them from the\n");157printf ("variables a to f (like in bc).\n");158}159160161int ibase = 0;162int obase = 10;163164165/* The stack is a fixed size, which means there's a limit on the nesting166allowed in expressions. A more sophisticated program could let it grow167dynamically. */168169mpz_t stack[100];170mpz_ptr sp = stack[0];171172#define CHECK_OVERFLOW() \173if (sp >= stack[numberof(stack)]) /* FIXME */ \174{ \175fprintf (stderr, \176"Value stack overflow, too much nesting in expression\n"); \177YYERROR; \178}179180#define CHECK_EMPTY() \181if (sp != stack[0]) \182{ \183fprintf (stderr, "Oops, expected the value stack to be empty\n"); \184sp = stack[0]; \185}186187188mpz_t variable[26];189190#define CHECK_VARIABLE(var) \191if ((var) < 0 || (var) >= numberof (variable)) \192{ \193fprintf (stderr, "Oops, bad variable somehow: %d\n", var); \194YYERROR; \195}196197198#define CHECK_UI(name,z) \199if (! mpz_fits_ulong_p (z)) \200{ \201fprintf (stderr, "%s too big\n", name); \202YYERROR; \203}204205206/* Line 371 of yacc.c */207#line 209 "calc.c"208209# ifndef YY_NULL210# if defined __cplusplus && 201103L <= __cplusplus211# define YY_NULL nullptr212# else213# define YY_NULL 0214# endif215# endif216217/* Enabling verbose error messages. */218#ifdef YYERROR_VERBOSE219# undef YYERROR_VERBOSE220# define YYERROR_VERBOSE 1221#else222# define YYERROR_VERBOSE 0223#endif224225/* In a future release of Bison, this section will be replaced226by #include "y.tab.h". */227#ifndef YY_YY_Y_TAB_H_INCLUDED228# define YY_YY_Y_TAB_H_INCLUDED229/* Enabling traces. */230#ifndef YYDEBUG231# define YYDEBUG 0232#endif233#if YYDEBUG234extern int yydebug;235#endif236237/* Tokens. */238#ifndef YYTOKENTYPE239# define YYTOKENTYPE240/* Put the tokens into the symbol table, so that GDB and other debuggers241know about them. */242enum yytokentype {243EOS = 258,244BAD = 259,245HELP = 260,246HEX = 261,247DECIMAL = 262,248QUIT = 263,249ABS = 264,250BIN = 265,251FIB = 266,252GCD = 267,253KRON = 268,254LCM = 269,255LUCNUM = 270,256NEXTPRIME = 271,257POWM = 272,258ROOT = 273,259SQRT = 274,260NUMBER = 275,261VARIABLE = 276,262LOR = 277,263LAND = 278,264GE = 279,265LE = 280,266NE = 281,267EQ = 282,268RSHIFT = 283,269LSHIFT = 284,270UMINUS = 285271};272#endif273/* Tokens. */274#define EOS 258275#define BAD 259276#define HELP 260277#define HEX 261278#define DECIMAL 262279#define QUIT 263280#define ABS 264281#define BIN 265282#define FIB 266283#define GCD 267284#define KRON 268285#define LCM 269286#define LUCNUM 270287#define NEXTPRIME 271288#define POWM 272289#define ROOT 273290#define SQRT 274291#define NUMBER 275292#define VARIABLE 276293#define LOR 277294#define LAND 278295#define GE 279296#define LE 280297#define NE 281298#define EQ 282299#define RSHIFT 283300#define LSHIFT 284301#define UMINUS 285302303304305#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED306typedef union YYSTYPE307{308/* Line 387 of yacc.c */309#line 142 "calc.y"310311char *str;312int var;313314315/* Line 387 of yacc.c */316#line 318 "calc.c"317} YYSTYPE;318# define YYSTYPE_IS_TRIVIAL 1319# define yystype YYSTYPE /* obsolescent; will be withdrawn */320# define YYSTYPE_IS_DECLARED 1321#endif322323extern YYSTYPE yylval;324325#ifdef YYPARSE_PARAM326#if defined __STDC__ || defined __cplusplus327int yyparse (void *YYPARSE_PARAM);328#else329int yyparse ();330#endif331#else /* ! YYPARSE_PARAM */332#if defined __STDC__ || defined __cplusplus333int yyparse (void);334#else335int yyparse ();336#endif337#endif /* ! YYPARSE_PARAM */338339#endif /* !YY_YY_Y_TAB_H_INCLUDED */340341/* Copy the second part of user declarations. */342343/* Line 390 of yacc.c */344#line 346 "calc.c"345346#ifdef short347# undef short348#endif349350#ifdef YYTYPE_UINT8351typedef YYTYPE_UINT8 yytype_uint8;352#else353typedef unsigned char yytype_uint8;354#endif355356#ifdef YYTYPE_INT8357typedef YYTYPE_INT8 yytype_int8;358#elif (defined __STDC__ || defined __C99__FUNC__ \359|| defined __cplusplus || defined _MSC_VER)360typedef signed char yytype_int8;361#else362typedef short int yytype_int8;363#endif364365#ifdef YYTYPE_UINT16366typedef YYTYPE_UINT16 yytype_uint16;367#else368typedef unsigned short int yytype_uint16;369#endif370371#ifdef YYTYPE_INT16372typedef YYTYPE_INT16 yytype_int16;373#else374typedef short int yytype_int16;375#endif376377#ifndef YYSIZE_T378# ifdef __SIZE_TYPE__379# define YYSIZE_T __SIZE_TYPE__380# elif defined size_t381# define YYSIZE_T size_t382# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \383|| defined __cplusplus || defined _MSC_VER)384# include <stddef.h> /* INFRINGES ON USER NAME SPACE */385# define YYSIZE_T size_t386# else387# define YYSIZE_T unsigned int388# endif389#endif390391#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)392393#ifndef YY_394# if defined YYENABLE_NLS && YYENABLE_NLS395# if ENABLE_NLS396# include <libintl.h> /* INFRINGES ON USER NAME SPACE */397# define YY_(Msgid) dgettext ("bison-runtime", Msgid)398# endif399# endif400# ifndef YY_401# define YY_(Msgid) Msgid402# endif403#endif404405#ifndef __attribute__406/* This feature is available in gcc versions 2.5 and later. */407# if (! defined __GNUC__ || __GNUC__ < 2 \408|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))409# define __attribute__(Spec) /* empty */410# endif411#endif412413/* Suppress unused-variable warnings by "using" E. */414#if ! defined lint || defined __GNUC__415# define YYUSE(E) ((void) (E))416#else417# define YYUSE(E) /* empty */418#endif419420421/* Identity function, used to suppress warnings about constant conditions. */422#ifndef lint423# define YYID(N) (N)424#else425#if (defined __STDC__ || defined __C99__FUNC__ \426|| defined __cplusplus || defined _MSC_VER)427static int428YYID (int yyi)429#else430static int431YYID (yyi)432int yyi;433#endif434{435return yyi;436}437#endif438439#if ! defined yyoverflow || YYERROR_VERBOSE440441/* The parser invokes alloca or malloc; define the necessary symbols. */442443# ifdef YYSTACK_USE_ALLOCA444# if YYSTACK_USE_ALLOCA445# ifdef __GNUC__446# define YYSTACK_ALLOC __builtin_alloca447# elif defined __BUILTIN_VA_ARG_INCR448# include <alloca.h> /* INFRINGES ON USER NAME SPACE */449# elif defined _AIX450# define YYSTACK_ALLOC __alloca451# elif defined _MSC_VER452# include <malloc.h> /* INFRINGES ON USER NAME SPACE */453# define alloca _alloca454# else455# define YYSTACK_ALLOC alloca456# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \457|| defined __cplusplus || defined _MSC_VER)458# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */459/* Use EXIT_SUCCESS as a witness for stdlib.h. */460# ifndef EXIT_SUCCESS461# define EXIT_SUCCESS 0462# endif463# endif464# endif465# endif466# endif467468# ifdef YYSTACK_ALLOC469/* Pacify GCC's `empty if-body' warning. */470# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))471# ifndef YYSTACK_ALLOC_MAXIMUM472/* The OS might guarantee only one guard page at the bottom of the stack,473and a page size can be as small as 4096 bytes. So we cannot safely474invoke alloca (N) if N exceeds 4096. Use a slightly smaller number475to allow for a few compiler-allocated temporary stack slots. */476# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */477# endif478# else479# define YYSTACK_ALLOC YYMALLOC480# define YYSTACK_FREE YYFREE481# ifndef YYSTACK_ALLOC_MAXIMUM482# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM483# endif484# if (defined __cplusplus && ! defined EXIT_SUCCESS \485&& ! ((defined YYMALLOC || defined malloc) \486&& (defined YYFREE || defined free)))487# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */488# ifndef EXIT_SUCCESS489# define EXIT_SUCCESS 0490# endif491# endif492# ifndef YYMALLOC493# define YYMALLOC malloc494# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \495|| defined __cplusplus || defined _MSC_VER)496void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */497# endif498# endif499# ifndef YYFREE500# define YYFREE free501# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \502|| defined __cplusplus || defined _MSC_VER)503void free (void *); /* INFRINGES ON USER NAME SPACE */504# endif505# endif506# endif507#endif /* ! defined yyoverflow || YYERROR_VERBOSE */508509510#if (! defined yyoverflow \511&& (! defined __cplusplus \512|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))513514/* A type that is properly aligned for any stack member. */515union yyalloc516{517yytype_int16 yyss_alloc;518YYSTYPE yyvs_alloc;519};520521/* The size of the maximum gap between one aligned stack and the next. */522# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)523524/* The size of an array large to enough to hold all stacks, each with525N elements. */526# define YYSTACK_BYTES(N) \527((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \528+ YYSTACK_GAP_MAXIMUM)529530# define YYCOPY_NEEDED 1531532/* Relocate STACK from its old location to the new one. The533local variables YYSIZE and YYSTACKSIZE give the old and new number of534elements in the stack, and YYPTR gives the new location of the535stack. Advance YYPTR to a properly aligned location for the next536stack. */537# define YYSTACK_RELOCATE(Stack_alloc, Stack) \538do \539{ \540YYSIZE_T yynewbytes; \541YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \542Stack = &yyptr->Stack_alloc; \543yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \544yyptr += yynewbytes / sizeof (*yyptr); \545} \546while (YYID (0))547548#endif549550#if defined YYCOPY_NEEDED && YYCOPY_NEEDED551/* Copy COUNT objects from SRC to DST. The source and destination do552not overlap. */553# ifndef YYCOPY554# if defined __GNUC__ && 1 < __GNUC__555# define YYCOPY(Dst, Src, Count) \556__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))557# else558# define YYCOPY(Dst, Src, Count) \559do \560{ \561YYSIZE_T yyi; \562for (yyi = 0; yyi < (Count); yyi++) \563(Dst)[yyi] = (Src)[yyi]; \564} \565while (YYID (0))566# endif567# endif568#endif /* !YYCOPY_NEEDED */569570/* YYFINAL -- State number of the termination state. */571#define YYFINAL 41572/* YYLAST -- Last index in YYTABLE. */573#define YYLAST 552574575/* YYNTOKENS -- Number of terminals. */576#define YYNTOKENS 44577/* YYNNTS -- Number of nonterminals. */578#define YYNNTS 7579/* YYNRULES -- Number of rules. */580#define YYNRULES 49581/* YYNRULES -- Number of states. */582#define YYNSTATES 118583584/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */585#define YYUNDEFTOK 2586#define YYMAXUTOK 285587588#define YYTRANSLATE(YYX) \589((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)590591/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */592static const yytype_uint8 yytranslate[] =593{5940, 2, 2, 2, 2, 2, 2, 2, 2, 2,5952, 2, 2, 2, 2, 2, 2, 2, 2, 2,5962, 2, 2, 2, 2, 2, 2, 2, 2, 2,5972, 2, 2, 39, 2, 2, 2, 36, 2, 2,59841, 42, 34, 32, 43, 33, 2, 35, 2, 2,5992, 2, 2, 2, 2, 2, 2, 2, 2, 2,60024, 40, 25, 2, 2, 2, 2, 2, 2, 2,6012, 2, 2, 2, 2, 2, 2, 2, 2, 2,6022, 2, 2, 2, 2, 2, 2, 2, 2, 2,6032, 2, 2, 2, 38, 2, 2, 2, 2, 2,6042, 2, 2, 2, 2, 2, 2, 2, 2, 2,6052, 2, 2, 2, 2, 2, 2, 2, 2, 2,6062, 2, 2, 2, 2, 2, 2, 2, 2, 2,6072, 2, 2, 2, 2, 2, 2, 2, 2, 2,6082, 2, 2, 2, 2, 2, 2, 2, 2, 2,6092, 2, 2, 2, 2, 2, 2, 2, 2, 2,6102, 2, 2, 2, 2, 2, 2, 2, 2, 2,6112, 2, 2, 2, 2, 2, 2, 2, 2, 2,6122, 2, 2, 2, 2, 2, 2, 2, 2, 2,6132, 2, 2, 2, 2, 2, 2, 2, 2, 2,6142, 2, 2, 2, 2, 2, 2, 2, 2, 2,6152, 2, 2, 2, 2, 2, 2, 2, 2, 2,6162, 2, 2, 2, 2, 2, 2, 2, 2, 2,6172, 2, 2, 2, 2, 2, 2, 2, 2, 2,6182, 2, 2, 2, 2, 2, 2, 2, 2, 2,6192, 2, 2, 2, 2, 2, 1, 2, 3, 4,6205, 6, 7, 8, 9, 10, 11, 12, 13, 14,62115, 16, 17, 18, 19, 20, 21, 22, 23, 26,62227, 28, 29, 30, 31, 37623};624625#if YYDEBUG626/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in627YYRHS. */628static const yytype_uint8 yyprhs[] =629{6300, 0, 3, 5, 8, 11, 15, 18, 19, 21,63125, 27, 29, 31, 33, 37, 41, 45, 49, 53,63257, 61, 65, 69, 72, 75, 79, 83, 87, 91,63395, 99, 103, 107, 112, 119, 124, 129, 136, 141,634146, 151, 160, 167, 172, 174, 176, 178, 182, 184635};636637/* YYRHS -- A `-1'-separated list of the rules' RHS. */638static const yytype_int8 yyrhs[] =639{64045, 0, -1, 47, -1, 46, 47, -1, 47, 3,641-1, 46, 47, 3, -1, 1, 3, -1, -1, 48,642-1, 21, 40, 48, -1, 5, -1, 6, -1, 7,643-1, 8, -1, 41, 48, 42, -1, 48, 32, 48,644-1, 48, 33, 48, -1, 48, 34, 48, -1, 48,64535, 48, -1, 48, 36, 48, -1, 48, 38, 48,646-1, 48, 31, 48, -1, 48, 30, 48, -1, 48,64739, -1, 33, 48, -1, 48, 24, 48, -1, 48,64827, 48, -1, 48, 29, 48, -1, 48, 28, 48,649-1, 48, 26, 48, -1, 48, 25, 48, -1, 48,65023, 48, -1, 48, 22, 48, -1, 9, 41, 48,65142, -1, 10, 41, 48, 43, 48, 42, -1, 11,65241, 48, 42, -1, 12, 41, 49, 42, -1, 13,65341, 48, 43, 48, 42, -1, 14, 41, 50, 42,654-1, 15, 41, 48, 42, -1, 16, 41, 48, 42,655-1, 17, 41, 48, 43, 48, 43, 48, 42, -1,65618, 41, 48, 43, 48, 42, -1, 19, 41, 48,65742, -1, 21, -1, 20, -1, 48, -1, 49, 43,65848, -1, 48, -1, 50, 43, 48, -1659};660661/* YYRLINE[YYN] -- source line where rule number YYN was defined. */662static const yytype_uint16 yyrline[] =663{6640, 167, 167, 168, 171, 172, 173, 175, 177, 182,665188, 189, 190, 191, 197, 198, 199, 200, 201, 202,666203, 205, 207, 209, 211, 213, 214, 215, 216, 217,667218, 220, 221, 223, 224, 226, 228, 229, 231, 232,668234, 235, 236, 238, 240, 246, 257, 258, 261, 262669};670#endif671672#if YYDEBUG || YYERROR_VERBOSE || 0673/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.674First, the terminals, then, starting at YYNTOKENS, nonterminals. */675static const char *const yytname[] =676{677"$end", "error", "$undefined", "EOS", "BAD", "HELP", "HEX", "DECIMAL",678"QUIT", "ABS", "BIN", "FIB", "GCD", "KRON", "LCM", "LUCNUM", "NEXTPRIME",679"POWM", "ROOT", "SQRT", "NUMBER", "VARIABLE", "LOR", "LAND", "'<'",680"'>'", "GE", "LE", "NE", "EQ", "RSHIFT", "LSHIFT", "'+'", "'-'", "'*'",681"'/'", "'%'", "UMINUS", "'^'", "'!'", "'='", "'('", "')'", "','",682"$accept", "top", "statements", "statement", "e", "gcdlist", "lcmlist", YY_NULL683};684#endif685686# ifdef YYPRINT687/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to688token YYLEX-NUM. */689static const yytype_uint16 yytoknum[] =690{6910, 256, 257, 258, 259, 260, 261, 262, 263, 264,692265, 266, 267, 268, 269, 270, 271, 272, 273, 274,693275, 276, 277, 278, 60, 62, 279, 280, 281, 282,694283, 284, 43, 45, 42, 47, 37, 285, 94, 33,69561, 40, 41, 44696};697# endif698699/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */700static const yytype_uint8 yyr1[] =701{7020, 44, 45, 45, 46, 46, 46, 47, 47, 47,70347, 47, 47, 47, 48, 48, 48, 48, 48, 48,70448, 48, 48, 48, 48, 48, 48, 48, 48, 48,70548, 48, 48, 48, 48, 48, 48, 48, 48, 48,70648, 48, 48, 48, 48, 48, 49, 49, 50, 50707};708709/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */710static const yytype_uint8 yyr2[] =711{7120, 2, 1, 2, 2, 3, 2, 0, 1, 3,7131, 1, 1, 1, 3, 3, 3, 3, 3, 3,7143, 3, 3, 2, 2, 3, 3, 3, 3, 3,7153, 3, 3, 4, 6, 4, 4, 6, 4, 4,7164, 8, 6, 4, 1, 1, 1, 3, 1, 3717};718719/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.720Performed when YYTABLE doesn't specify something else to do. Zero721means the default is an error. */722static const yytype_uint8 yydefact[] =723{7240, 0, 10, 11, 12, 13, 0, 0, 0, 0,7250, 0, 0, 0, 0, 0, 0, 45, 44, 0,7260, 0, 7, 2, 8, 6, 0, 0, 0, 0,7270, 0, 0, 0, 0, 0, 0, 0, 44, 24,7280, 1, 3, 4, 0, 0, 0, 0, 0, 0,7290, 0, 0, 0, 0, 0, 0, 0, 0, 0,73023, 0, 0, 0, 46, 0, 0, 48, 0, 0,7310, 0, 0, 0, 9, 14, 5, 32, 31, 25,73230, 29, 26, 28, 27, 22, 21, 15, 16, 17,73318, 19, 20, 33, 0, 35, 36, 0, 0, 38,7340, 39, 40, 0, 0, 43, 0, 47, 0, 49,7350, 0, 34, 37, 0, 42, 0, 41736};737738/* YYDEFGOTO[NTERM-NUM]. */739static const yytype_int8 yydefgoto[] =740{741-1, 21, 22, 23, 24, 65, 68742};743744/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing745STATE-NUM. */746#define YYPACT_NINF -39747static const yytype_int16 yypact[] =748{74941, 3, -39, -39, -39, -39, 2, 4, 27, 32,75035, 36, 39, 42, 45, 46, 47, -39, -18, 124,751124, 89, 91, 87, 464, -39, 124, 124, 124, 124,752124, 124, 124, 124, 124, 124, 124, 124, -39, -36,753254, -39, 88, -39, 124, 124, 124, 124, 124, 124,754124, 124, 124, 124, 124, 124, 124, 124, 124, 124,755-39, 275, 144, 296, 464, -38, 166, 464, 29, 317,756338, 188, 210, 359, 464, -39, -39, 481, 497, 513,757513, 513, 513, 513, 513, 31, 31, -15, -15, -36,758-36, -36, -36, -39, 124, -39, -39, 124, 124, -39,759124, -39, -39, 124, 124, -39, 380, 464, 401, 464,760232, 422, -39, -39, 124, -39, 443, -39761};762763/* YYPGOTO[NTERM-NUM]. */764static const yytype_int8 yypgoto[] =765{766-39, -39, -39, 70, -19, -39, -39767};768769/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If770positive, shift that token. If negative, reduce the rule which771number is the opposite. If YYTABLE_NINF, syntax error. */772#define YYTABLE_NINF -8773static const yytype_int8 yytable[] =774{77539, 40, 59, 60, 96, 97, 25, 61, 62, 63,77664, 66, 67, 69, 70, 71, 72, 73, 74, 56,77757, 58, 37, 59, 60, 77, 78, 79, 80, 81,77882, 83, 84, 85, 86, 87, 88, 89, 90, 91,77992, -7, 1, 26, -7, 27, 2, 3, 4, 5,7806, 7, 8, 9, 10, 11, 12, 13, 14, 15,78116, 17, 18, 54, 55, 56, 57, 58, 28, 59,78260, 99, 100, 29, 19, 106, 30, 31, 107, 108,78332, 109, 20, 33, 110, 111, 34, 35, 36, 41,78443, 76, 42, 0, 0, 116, 2, 3, 4, 5,7856, 7, 8, 9, 10, 11, 12, 13, 14, 15,78616, 17, 18, 0, 0, 0, 0, 0, 0, 0,7870, 0, 0, 0, 19, 0, 0, 0, 0, 0,7880, 0, 20, 6, 7, 8, 9, 10, 11, 12,78913, 14, 15, 16, 17, 38, 0, 0, 0, 0,7900, 0, 0, 0, 0, 0, 0, 19, 0, 0,7910, 0, 0, 0, 0, 20, 44, 45, 46, 47,79248, 49, 50, 51, 52, 53, 54, 55, 56, 57,79358, 0, 59, 60, 0, 0, 0, 94, 44, 45,79446, 47, 48, 49, 50, 51, 52, 53, 54, 55,79556, 57, 58, 0, 59, 60, 0, 0, 0, 98,79644, 45, 46, 47, 48, 49, 50, 51, 52, 53,79754, 55, 56, 57, 58, 0, 59, 60, 0, 0,7980, 103, 44, 45, 46, 47, 48, 49, 50, 51,79952, 53, 54, 55, 56, 57, 58, 0, 59, 60,8000, 0, 0, 104, 44, 45, 46, 47, 48, 49,80150, 51, 52, 53, 54, 55, 56, 57, 58, 0,80259, 60, 0, 0, 0, 114, 44, 45, 46, 47,80348, 49, 50, 51, 52, 53, 54, 55, 56, 57,80458, 0, 59, 60, 0, 0, 75, 44, 45, 46,80547, 48, 49, 50, 51, 52, 53, 54, 55, 56,80657, 58, 0, 59, 60, 0, 0, 93, 44, 45,80746, 47, 48, 49, 50, 51, 52, 53, 54, 55,80856, 57, 58, 0, 59, 60, 0, 0, 95, 44,80945, 46, 47, 48, 49, 50, 51, 52, 53, 54,81055, 56, 57, 58, 0, 59, 60, 0, 0, 101,81144, 45, 46, 47, 48, 49, 50, 51, 52, 53,81254, 55, 56, 57, 58, 0, 59, 60, 0, 0,813102, 44, 45, 46, 47, 48, 49, 50, 51, 52,81453, 54, 55, 56, 57, 58, 0, 59, 60, 0,8150, 105, 44, 45, 46, 47, 48, 49, 50, 51,81652, 53, 54, 55, 56, 57, 58, 0, 59, 60,8170, 0, 112, 44, 45, 46, 47, 48, 49, 50,81851, 52, 53, 54, 55, 56, 57, 58, 0, 59,81960, 0, 0, 113, 44, 45, 46, 47, 48, 49,82050, 51, 52, 53, 54, 55, 56, 57, 58, 0,82159, 60, 0, 0, 115, 44, 45, 46, 47, 48,82249, 50, 51, 52, 53, 54, 55, 56, 57, 58,8230, 59, 60, 0, 0, 117, 44, 45, 46, 47,82448, 49, 50, 51, 52, 53, 54, 55, 56, 57,82558, 0, 59, 60, 45, 46, 47, 48, 49, 50,82651, 52, 53, 54, 55, 56, 57, 58, 0, 59,82760, 46, 47, 48, 49, 50, 51, 52, 53, 54,82855, 56, 57, 58, 0, 59, 60, -8, -8, -8,829-8, -8, -8, 52, 53, 54, 55, 56, 57, 58,8300, 59, 60831};832833#define yypact_value_is_default(Yystate) \834(!!((Yystate) == (-39)))835836#define yytable_value_is_error(Yytable_value) \837(!!((Yytable_value) == (-8)))838839static const yytype_int8 yycheck[] =840{84119, 20, 38, 39, 42, 43, 3, 26, 27, 28,84229, 30, 31, 32, 33, 34, 35, 36, 37, 34,84335, 36, 40, 38, 39, 44, 45, 46, 47, 48,84449, 50, 51, 52, 53, 54, 55, 56, 57, 58,84559, 0, 1, 41, 3, 41, 5, 6, 7, 8,8469, 10, 11, 12, 13, 14, 15, 16, 17, 18,84719, 20, 21, 32, 33, 34, 35, 36, 41, 38,84839, 42, 43, 41, 33, 94, 41, 41, 97, 98,84941, 100, 41, 41, 103, 104, 41, 41, 41, 0,8503, 3, 22, -1, -1, 114, 5, 6, 7, 8,8519, 10, 11, 12, 13, 14, 15, 16, 17, 18,85219, 20, 21, -1, -1, -1, -1, -1, -1, -1,853-1, -1, -1, -1, 33, -1, -1, -1, -1, -1,854-1, -1, 41, 9, 10, 11, 12, 13, 14, 15,85516, 17, 18, 19, 20, 21, -1, -1, -1, -1,856-1, -1, -1, -1, -1, -1, -1, 33, -1, -1,857-1, -1, -1, -1, -1, 41, 22, 23, 24, 25,85826, 27, 28, 29, 30, 31, 32, 33, 34, 35,85936, -1, 38, 39, -1, -1, -1, 43, 22, 23,86024, 25, 26, 27, 28, 29, 30, 31, 32, 33,86134, 35, 36, -1, 38, 39, -1, -1, -1, 43,86222, 23, 24, 25, 26, 27, 28, 29, 30, 31,86332, 33, 34, 35, 36, -1, 38, 39, -1, -1,864-1, 43, 22, 23, 24, 25, 26, 27, 28, 29,86530, 31, 32, 33, 34, 35, 36, -1, 38, 39,866-1, -1, -1, 43, 22, 23, 24, 25, 26, 27,86728, 29, 30, 31, 32, 33, 34, 35, 36, -1,86838, 39, -1, -1, -1, 43, 22, 23, 24, 25,86926, 27, 28, 29, 30, 31, 32, 33, 34, 35,87036, -1, 38, 39, -1, -1, 42, 22, 23, 24,87125, 26, 27, 28, 29, 30, 31, 32, 33, 34,87235, 36, -1, 38, 39, -1, -1, 42, 22, 23,87324, 25, 26, 27, 28, 29, 30, 31, 32, 33,87434, 35, 36, -1, 38, 39, -1, -1, 42, 22,87523, 24, 25, 26, 27, 28, 29, 30, 31, 32,87633, 34, 35, 36, -1, 38, 39, -1, -1, 42,87722, 23, 24, 25, 26, 27, 28, 29, 30, 31,87832, 33, 34, 35, 36, -1, 38, 39, -1, -1,87942, 22, 23, 24, 25, 26, 27, 28, 29, 30,88031, 32, 33, 34, 35, 36, -1, 38, 39, -1,881-1, 42, 22, 23, 24, 25, 26, 27, 28, 29,88230, 31, 32, 33, 34, 35, 36, -1, 38, 39,883-1, -1, 42, 22, 23, 24, 25, 26, 27, 28,88429, 30, 31, 32, 33, 34, 35, 36, -1, 38,88539, -1, -1, 42, 22, 23, 24, 25, 26, 27,88628, 29, 30, 31, 32, 33, 34, 35, 36, -1,88738, 39, -1, -1, 42, 22, 23, 24, 25, 26,88827, 28, 29, 30, 31, 32, 33, 34, 35, 36,889-1, 38, 39, -1, -1, 42, 22, 23, 24, 25,89026, 27, 28, 29, 30, 31, 32, 33, 34, 35,89136, -1, 38, 39, 23, 24, 25, 26, 27, 28,89229, 30, 31, 32, 33, 34, 35, 36, -1, 38,89339, 24, 25, 26, 27, 28, 29, 30, 31, 32,89433, 34, 35, 36, -1, 38, 39, 24, 25, 26,89527, 28, 29, 30, 31, 32, 33, 34, 35, 36,896-1, 38, 39897};898899/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing900symbol of state STATE-NUM. */901static const yytype_uint8 yystos[] =902{9030, 1, 5, 6, 7, 8, 9, 10, 11, 12,90413, 14, 15, 16, 17, 18, 19, 20, 21, 33,90541, 45, 46, 47, 48, 3, 41, 41, 41, 41,90641, 41, 41, 41, 41, 41, 41, 40, 21, 48,90748, 0, 47, 3, 22, 23, 24, 25, 26, 27,90828, 29, 30, 31, 32, 33, 34, 35, 36, 38,90939, 48, 48, 48, 48, 49, 48, 48, 50, 48,91048, 48, 48, 48, 48, 42, 3, 48, 48, 48,91148, 48, 48, 48, 48, 48, 48, 48, 48, 48,91248, 48, 48, 42, 43, 42, 42, 43, 43, 42,91343, 42, 42, 43, 43, 42, 48, 48, 48, 48,91448, 48, 42, 42, 43, 42, 48, 42915};916917#define yyerrok (yyerrstatus = 0)918#define yyclearin (yychar = YYEMPTY)919#define YYEMPTY (-2)920#define YYEOF 0921922#define YYACCEPT goto yyacceptlab923#define YYABORT goto yyabortlab924#define YYERROR goto yyerrorlab925926927/* Like YYERROR except do call yyerror. This remains here temporarily928to ease the transition to the new meaning of YYERROR, for GCC.929Once GCC version 2 has supplanted version 1, this can go. However,930YYFAIL appears to be in use. Nevertheless, it is formally deprecated931in Bison 2.4.2's NEWS entry, where a plan to phase it out is932discussed. */933934#define YYFAIL goto yyerrlab935#if defined YYFAIL936/* This is here to suppress warnings from the GCC cpp's937-Wunused-macros. Normally we don't worry about that warning, but938some users do, and we want to make it easy for users to remove939YYFAIL uses, which will produce warnings from Bison 2.5. */940#endif941942#define YYRECOVERING() (!!yyerrstatus)943944#define YYBACKUP(Token, Value) \945do \946if (yychar == YYEMPTY) \947{ \948yychar = (Token); \949yylval = (Value); \950YYPOPSTACK (yylen); \951yystate = *yyssp; \952goto yybackup; \953} \954else \955{ \956yyerror (YY_("syntax error: cannot back up")); \957YYERROR; \958} \959while (YYID (0))960961/* Error token number */962#define YYTERROR 1963#define YYERRCODE 256964965966/* This macro is provided for backward compatibility. */967#ifndef YY_LOCATION_PRINT968# define YY_LOCATION_PRINT(File, Loc) ((void) 0)969#endif970971972/* YYLEX -- calling `yylex' with the right arguments. */973#ifdef YYLEX_PARAM974# define YYLEX yylex (YYLEX_PARAM)975#else976# define YYLEX yylex ()977#endif978979/* Enable debugging if requested. */980#if YYDEBUG981982# ifndef YYFPRINTF983# include <stdio.h> /* INFRINGES ON USER NAME SPACE */984# define YYFPRINTF fprintf985# endif986987# define YYDPRINTF(Args) \988do { \989if (yydebug) \990YYFPRINTF Args; \991} while (YYID (0))992993# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \994do { \995if (yydebug) \996{ \997YYFPRINTF (stderr, "%s ", Title); \998yy_symbol_print (stderr, \999Type, Value); \1000YYFPRINTF (stderr, "\n"); \1001} \1002} while (YYID (0))100310041005/*--------------------------------.1006| Print this symbol on YYOUTPUT. |1007`--------------------------------*/10081009/*ARGSUSED*/1010#if (defined __STDC__ || defined __C99__FUNC__ \1011|| defined __cplusplus || defined _MSC_VER)1012static void1013yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)1014#else1015static void1016yy_symbol_value_print (yyoutput, yytype, yyvaluep)1017FILE *yyoutput;1018int yytype;1019YYSTYPE const * const yyvaluep;1020#endif1021{1022FILE *yyo = yyoutput;1023YYUSE (yyo);1024if (!yyvaluep)1025return;1026# ifdef YYPRINT1027if (yytype < YYNTOKENS)1028YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);1029# else1030YYUSE (yyoutput);1031# endif1032YYUSE (yytype);1033}103410351036/*--------------------------------.1037| Print this symbol on YYOUTPUT. |1038`--------------------------------*/10391040#if (defined __STDC__ || defined __C99__FUNC__ \1041|| defined __cplusplus || defined _MSC_VER)1042static void1043yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)1044#else1045static void1046yy_symbol_print (yyoutput, yytype, yyvaluep)1047FILE *yyoutput;1048int yytype;1049YYSTYPE const * const yyvaluep;1050#endif1051{1052if (yytype < YYNTOKENS)1053YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);1054else1055YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);10561057yy_symbol_value_print (yyoutput, yytype, yyvaluep);1058YYFPRINTF (yyoutput, ")");1059}10601061/*------------------------------------------------------------------.1062| yy_stack_print -- Print the state stack from its BOTTOM up to its |1063| TOP (included). |1064`------------------------------------------------------------------*/10651066#if (defined __STDC__ || defined __C99__FUNC__ \1067|| defined __cplusplus || defined _MSC_VER)1068static void1069yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)1070#else1071static void1072yy_stack_print (yybottom, yytop)1073yytype_int16 *yybottom;1074yytype_int16 *yytop;1075#endif1076{1077YYFPRINTF (stderr, "Stack now");1078for (; yybottom <= yytop; yybottom++)1079{1080int yybot = *yybottom;1081YYFPRINTF (stderr, " %d", yybot);1082}1083YYFPRINTF (stderr, "\n");1084}10851086# define YY_STACK_PRINT(Bottom, Top) \1087do { \1088if (yydebug) \1089yy_stack_print ((Bottom), (Top)); \1090} while (YYID (0))109110921093/*------------------------------------------------.1094| Report that the YYRULE is going to be reduced. |1095`------------------------------------------------*/10961097#if (defined __STDC__ || defined __C99__FUNC__ \1098|| defined __cplusplus || defined _MSC_VER)1099static void1100yy_reduce_print (YYSTYPE *yyvsp, int yyrule)1101#else1102static void1103yy_reduce_print (yyvsp, yyrule)1104YYSTYPE *yyvsp;1105int yyrule;1106#endif1107{1108int yynrhs = yyr2[yyrule];1109int yyi;1110unsigned long int yylno = yyrline[yyrule];1111YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",1112yyrule - 1, yylno);1113/* The symbols being reduced. */1114for (yyi = 0; yyi < yynrhs; yyi++)1115{1116YYFPRINTF (stderr, " $%d = ", yyi + 1);1117yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],1118&(yyvsp[(yyi + 1) - (yynrhs)])1119);1120YYFPRINTF (stderr, "\n");1121}1122}11231124# define YY_REDUCE_PRINT(Rule) \1125do { \1126if (yydebug) \1127yy_reduce_print (yyvsp, Rule); \1128} while (YYID (0))11291130/* Nonzero means print parse trace. It is left uninitialized so that1131multiple parsers can coexist. */1132int yydebug;1133#else /* !YYDEBUG */1134# define YYDPRINTF(Args)1135# define YY_SYMBOL_PRINT(Title, Type, Value, Location)1136# define YY_STACK_PRINT(Bottom, Top)1137# define YY_REDUCE_PRINT(Rule)1138#endif /* !YYDEBUG */113911401141/* YYINITDEPTH -- initial size of the parser's stacks. */1142#ifndef YYINITDEPTH1143# define YYINITDEPTH 2001144#endif11451146/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only1147if the built-in stack extension method is used).11481149Do not make this value too large; the results are undefined if1150YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)1151evaluated with infinite-precision integer arithmetic. */11521153#ifndef YYMAXDEPTH1154# define YYMAXDEPTH 100001155#endif115611571158#if YYERROR_VERBOSE11591160# ifndef yystrlen1161# if defined __GLIBC__ && defined _STRING_H1162# define yystrlen strlen1163# else1164/* Return the length of YYSTR. */1165#if (defined __STDC__ || defined __C99__FUNC__ \1166|| defined __cplusplus || defined _MSC_VER)1167static YYSIZE_T1168yystrlen (const char *yystr)1169#else1170static YYSIZE_T1171yystrlen (yystr)1172const char *yystr;1173#endif1174{1175YYSIZE_T yylen;1176for (yylen = 0; yystr[yylen]; yylen++)1177continue;1178return yylen;1179}1180# endif1181# endif11821183# ifndef yystpcpy1184# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE1185# define yystpcpy stpcpy1186# else1187/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in1188YYDEST. */1189#if (defined __STDC__ || defined __C99__FUNC__ \1190|| defined __cplusplus || defined _MSC_VER)1191static char *1192yystpcpy (char *yydest, const char *yysrc)1193#else1194static char *1195yystpcpy (yydest, yysrc)1196char *yydest;1197const char *yysrc;1198#endif1199{1200char *yyd = yydest;1201const char *yys = yysrc;12021203while ((*yyd++ = *yys++) != '\0')1204continue;12051206return yyd - 1;1207}1208# endif1209# endif12101211# ifndef yytnamerr1212/* Copy to YYRES the contents of YYSTR after stripping away unnecessary1213quotes and backslashes, so that it's suitable for yyerror. The1214heuristic is that double-quoting is unnecessary unless the string1215contains an apostrophe, a comma, or backslash (other than1216backslash-backslash). YYSTR is taken from yytname. If YYRES is1217null, do not copy; instead, return the length of what the result1218would have been. */1219static YYSIZE_T1220yytnamerr (char *yyres, const char *yystr)1221{1222if (*yystr == '"')1223{1224YYSIZE_T yyn = 0;1225char const *yyp = yystr;12261227for (;;)1228switch (*++yyp)1229{1230case '\'':1231case ',':1232goto do_not_strip_quotes;12331234case '\\':1235if (*++yyp != '\\')1236goto do_not_strip_quotes;1237/* Fall through. */1238default:1239if (yyres)1240yyres[yyn] = *yyp;1241yyn++;1242break;12431244case '"':1245if (yyres)1246yyres[yyn] = '\0';1247return yyn;1248}1249do_not_strip_quotes: ;1250}12511252if (! yyres)1253return yystrlen (yystr);12541255return yystpcpy (yyres, yystr) - yyres;1256}1257# endif12581259/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message1260about the unexpected token YYTOKEN for the state stack whose top is1261YYSSP.12621263Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is1264not large enough to hold the message. In that case, also set1265*YYMSG_ALLOC to the required number of bytes. Return 2 if the1266required number of bytes is too large to store. */1267static int1268yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,1269yytype_int16 *yyssp, int yytoken)1270{1271YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);1272YYSIZE_T yysize = yysize0;1273enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };1274/* Internationalized format string. */1275const char *yyformat = YY_NULL;1276/* Arguments of yyformat. */1277char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];1278/* Number of reported tokens (one for the "unexpected", one per1279"expected"). */1280int yycount = 0;12811282/* There are many possibilities here to consider:1283- Assume YYFAIL is not used. It's too flawed to consider. See1284<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>1285for details. YYERROR is fine as it does not invoke this1286function.1287- If this state is a consistent state with a default action, then1288the only way this function was invoked is if the default action1289is an error action. In that case, don't check for expected1290tokens because there are none.1291- The only way there can be no lookahead present (in yychar) is if1292this state is a consistent state with a default action. Thus,1293detecting the absence of a lookahead is sufficient to determine1294that there is no unexpected or expected token to report. In that1295case, just report a simple "syntax error".1296- Don't assume there isn't a lookahead just because this state is a1297consistent state with a default action. There might have been a1298previous inconsistent state, consistent state with a non-default1299action, or user semantic action that manipulated yychar.1300- Of course, the expected token list depends on states to have1301correct lookahead information, and it depends on the parser not1302to perform extra reductions after fetching a lookahead from the1303scanner and before detecting a syntax error. Thus, state merging1304(from LALR or IELR) and default reductions corrupt the expected1305token list. However, the list is correct for canonical LR with1306one exception: it will still contain any token that will not be1307accepted due to an error action in a later state.1308*/1309if (yytoken != YYEMPTY)1310{1311int yyn = yypact[*yyssp];1312yyarg[yycount++] = yytname[yytoken];1313if (!yypact_value_is_default (yyn))1314{1315/* Start YYX at -YYN if negative to avoid negative indexes in1316YYCHECK. In other words, skip the first -YYN actions for1317this state because they are default actions. */1318int yyxbegin = yyn < 0 ? -yyn : 0;1319/* Stay within bounds of both yycheck and yytname. */1320int yychecklim = YYLAST - yyn + 1;1321int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;1322int yyx;13231324for (yyx = yyxbegin; yyx < yyxend; ++yyx)1325if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR1326&& !yytable_value_is_error (yytable[yyx + yyn]))1327{1328if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)1329{1330yycount = 1;1331yysize = yysize0;1332break;1333}1334yyarg[yycount++] = yytname[yyx];1335{1336YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);1337if (! (yysize <= yysize11338&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))1339return 2;1340yysize = yysize1;1341}1342}1343}1344}13451346switch (yycount)1347{1348# define YYCASE_(N, S) \1349case N: \1350yyformat = S; \1351break1352YYCASE_(0, YY_("syntax error"));1353YYCASE_(1, YY_("syntax error, unexpected %s"));1354YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));1355YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));1356YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));1357YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));1358# undef YYCASE_1359}13601361{1362YYSIZE_T yysize1 = yysize + yystrlen (yyformat);1363if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))1364return 2;1365yysize = yysize1;1366}13671368if (*yymsg_alloc < yysize)1369{1370*yymsg_alloc = 2 * yysize;1371if (! (yysize <= *yymsg_alloc1372&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))1373*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;1374return 1;1375}13761377/* Avoid sprintf, as that infringes on the user's name space.1378Don't have undefined behavior even if the translation1379produced a string with the wrong number of "%s"s. */1380{1381char *yyp = *yymsg;1382int yyi = 0;1383while ((*yyp = *yyformat) != '\0')1384if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)1385{1386yyp += yytnamerr (yyp, yyarg[yyi++]);1387yyformat += 2;1388}1389else1390{1391yyp++;1392yyformat++;1393}1394}1395return 0;1396}1397#endif /* YYERROR_VERBOSE */13981399/*-----------------------------------------------.1400| Release the memory associated to this symbol. |1401`-----------------------------------------------*/14021403/*ARGSUSED*/1404#if (defined __STDC__ || defined __C99__FUNC__ \1405|| defined __cplusplus || defined _MSC_VER)1406static void1407yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)1408#else1409static void1410yydestruct (yymsg, yytype, yyvaluep)1411const char *yymsg;1412int yytype;1413YYSTYPE *yyvaluep;1414#endif1415{1416YYUSE (yyvaluep);14171418if (!yymsg)1419yymsg = "Deleting";1420YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);14211422YYUSE (yytype);1423}14241425142614271428/* The lookahead symbol. */1429int yychar;143014311432#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN1433# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN1434# define YY_IGNORE_MAYBE_UNINITIALIZED_END1435#endif1436#ifndef YY_INITIAL_VALUE1437# define YY_INITIAL_VALUE(Value) /* Nothing. */1438#endif14391440/* The semantic value of the lookahead symbol. */1441YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);14421443/* Number of syntax errors so far. */1444int yynerrs;144514461447/*----------.1448| yyparse. |1449`----------*/14501451#ifdef YYPARSE_PARAM1452#if (defined __STDC__ || defined __C99__FUNC__ \1453|| defined __cplusplus || defined _MSC_VER)1454int1455yyparse (void *YYPARSE_PARAM)1456#else1457int1458yyparse (YYPARSE_PARAM)1459void *YYPARSE_PARAM;1460#endif1461#else /* ! YYPARSE_PARAM */1462#if (defined __STDC__ || defined __C99__FUNC__ \1463|| defined __cplusplus || defined _MSC_VER)1464int1465yyparse (void)1466#else1467int1468yyparse ()14691470#endif1471#endif1472{1473int yystate;1474/* Number of tokens to shift before error messages enabled. */1475int yyerrstatus;14761477/* The stacks and their tools:1478`yyss': related to states.1479`yyvs': related to semantic values.14801481Refer to the stacks through separate pointers, to allow yyoverflow1482to reallocate them elsewhere. */14831484/* The state stack. */1485yytype_int16 yyssa[YYINITDEPTH];1486yytype_int16 *yyss;1487yytype_int16 *yyssp;14881489/* The semantic value stack. */1490YYSTYPE yyvsa[YYINITDEPTH];1491YYSTYPE *yyvs;1492YYSTYPE *yyvsp;14931494YYSIZE_T yystacksize;14951496int yyn;1497int yyresult;1498/* Lookahead token as an internal (translated) token number. */1499int yytoken = 0;1500/* The variables used to return semantic value and location from the1501action routines. */1502YYSTYPE yyval;15031504#if YYERROR_VERBOSE1505/* Buffer for error messages, and its allocated size. */1506char yymsgbuf[128];1507char *yymsg = yymsgbuf;1508YYSIZE_T yymsg_alloc = sizeof yymsgbuf;1509#endif15101511#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))15121513/* The number of symbols on the RHS of the reduced rule.1514Keep to zero when no symbol should be popped. */1515int yylen = 0;15161517yyssp = yyss = yyssa;1518yyvsp = yyvs = yyvsa;1519yystacksize = YYINITDEPTH;15201521YYDPRINTF ((stderr, "Starting parse\n"));15221523yystate = 0;1524yyerrstatus = 0;1525yynerrs = 0;1526yychar = YYEMPTY; /* Cause a token to be read. */1527goto yysetstate;15281529/*------------------------------------------------------------.1530| yynewstate -- Push a new state, which is found in yystate. |1531`------------------------------------------------------------*/1532yynewstate:1533/* In all cases, when you get here, the value and location stacks1534have just been pushed. So pushing a state here evens the stacks. */1535yyssp++;15361537yysetstate:1538*yyssp = yystate;15391540if (yyss + yystacksize - 1 <= yyssp)1541{1542/* Get the current used size of the three stacks, in elements. */1543YYSIZE_T yysize = yyssp - yyss + 1;15441545#ifdef yyoverflow1546{1547/* Give user a chance to reallocate the stack. Use copies of1548these so that the &'s don't force the real ones into1549memory. */1550YYSTYPE *yyvs1 = yyvs;1551yytype_int16 *yyss1 = yyss;15521553/* Each stack pointer address is followed by the size of the1554data in use in that stack, in bytes. This used to be a1555conditional around just the two extra args, but that might1556be undefined if yyoverflow is a macro. */1557yyoverflow (YY_("memory exhausted"),1558&yyss1, yysize * sizeof (*yyssp),1559&yyvs1, yysize * sizeof (*yyvsp),1560&yystacksize);15611562yyss = yyss1;1563yyvs = yyvs1;1564}1565#else /* no yyoverflow */1566# ifndef YYSTACK_RELOCATE1567goto yyexhaustedlab;1568# else1569/* Extend the stack our own way. */1570if (YYMAXDEPTH <= yystacksize)1571goto yyexhaustedlab;1572yystacksize *= 2;1573if (YYMAXDEPTH < yystacksize)1574yystacksize = YYMAXDEPTH;15751576{1577yytype_int16 *yyss1 = yyss;1578union yyalloc *yyptr =1579(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));1580if (! yyptr)1581goto yyexhaustedlab;1582YYSTACK_RELOCATE (yyss_alloc, yyss);1583YYSTACK_RELOCATE (yyvs_alloc, yyvs);1584# undef YYSTACK_RELOCATE1585if (yyss1 != yyssa)1586YYSTACK_FREE (yyss1);1587}1588# endif1589#endif /* no yyoverflow */15901591yyssp = yyss + yysize - 1;1592yyvsp = yyvs + yysize - 1;15931594YYDPRINTF ((stderr, "Stack size increased to %lu\n",1595(unsigned long int) yystacksize));15961597if (yyss + yystacksize - 1 <= yyssp)1598YYABORT;1599}16001601YYDPRINTF ((stderr, "Entering state %d\n", yystate));16021603if (yystate == YYFINAL)1604YYACCEPT;16051606goto yybackup;16071608/*-----------.1609| yybackup. |1610`-----------*/1611yybackup:16121613/* Do appropriate processing given the current state. Read a1614lookahead token if we need one and don't already have one. */16151616/* First try to decide what to do without reference to lookahead token. */1617yyn = yypact[yystate];1618if (yypact_value_is_default (yyn))1619goto yydefault;16201621/* Not known => get a lookahead token if don't already have one. */16221623/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */1624if (yychar == YYEMPTY)1625{1626YYDPRINTF ((stderr, "Reading a token: "));1627yychar = YYLEX;1628}16291630if (yychar <= YYEOF)1631{1632yychar = yytoken = YYEOF;1633YYDPRINTF ((stderr, "Now at end of input.\n"));1634}1635else1636{1637yytoken = YYTRANSLATE (yychar);1638YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);1639}16401641/* If the proper action on seeing token YYTOKEN is to reduce or to1642detect an error, take that action. */1643yyn += yytoken;1644if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)1645goto yydefault;1646yyn = yytable[yyn];1647if (yyn <= 0)1648{1649if (yytable_value_is_error (yyn))1650goto yyerrlab;1651yyn = -yyn;1652goto yyreduce;1653}16541655/* Count tokens shifted since error; after three, turn off error1656status. */1657if (yyerrstatus)1658yyerrstatus--;16591660/* Shift the lookahead token. */1661YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);16621663/* Discard the shifted token. */1664yychar = YYEMPTY;16651666yystate = yyn;1667YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN1668*++yyvsp = yylval;1669YY_IGNORE_MAYBE_UNINITIALIZED_END16701671goto yynewstate;167216731674/*-----------------------------------------------------------.1675| yydefault -- do the default action for the current state. |1676`-----------------------------------------------------------*/1677yydefault:1678yyn = yydefact[yystate];1679if (yyn == 0)1680goto yyerrlab;1681goto yyreduce;168216831684/*-----------------------------.1685| yyreduce -- Do a reduction. |1686`-----------------------------*/1687yyreduce:1688/* yyn is the number of a rule to reduce with. */1689yylen = yyr2[yyn];16901691/* If YYLEN is nonzero, implement the default value of the action:1692`$$ = $1'.16931694Otherwise, the following line sets YYVAL to garbage.1695This behavior is undocumented and Bison1696users should not rely upon it. Assigning to YYVAL1697unconditionally makes the parser a bit smaller, and it avoids a1698GCC warning that YYVAL may be used uninitialized. */1699yyval = yyvsp[1-yylen];170017011702YY_REDUCE_PRINT (yyn);1703switch (yyn)1704{1705case 6:1706/* Line 1787 of yacc.c */1707#line 173 "calc.y"1708{ sp = stack[0]; yyerrok; }1709break;17101711case 8:1712/* Line 1787 of yacc.c */1713#line 177 "calc.y"1714{1715mpz_out_str (stdout, obase, sp); putchar ('\n');1716sp--;1717CHECK_EMPTY ();1718}1719break;17201721case 9:1722/* Line 1787 of yacc.c */1723#line 182 "calc.y"1724{1725CHECK_VARIABLE ((yyvsp[(1) - (3)].var));1726mpz_swap (variable[(yyvsp[(1) - (3)].var)], sp);1727sp--;1728CHECK_EMPTY ();1729}1730break;17311732case 10:1733/* Line 1787 of yacc.c */1734#line 188 "calc.y"1735{ calc_help (); }1736break;17371738case 11:1739/* Line 1787 of yacc.c */1740#line 189 "calc.y"1741{ ibase = 16; obase = -16; }1742break;17431744case 12:1745/* Line 1787 of yacc.c */1746#line 190 "calc.y"1747{ ibase = 0; obase = 10; }1748break;17491750case 13:1751/* Line 1787 of yacc.c */1752#line 191 "calc.y"1753{ exit (0); }1754break;17551756case 15:1757/* Line 1787 of yacc.c */1758#line 198 "calc.y"1759{ sp--; mpz_add (sp, sp, sp+1); }1760break;17611762case 16:1763/* Line 1787 of yacc.c */1764#line 199 "calc.y"1765{ sp--; mpz_sub (sp, sp, sp+1); }1766break;17671768case 17:1769/* Line 1787 of yacc.c */1770#line 200 "calc.y"1771{ sp--; mpz_mul (sp, sp, sp+1); }1772break;17731774case 18:1775/* Line 1787 of yacc.c */1776#line 201 "calc.y"1777{ sp--; mpz_fdiv_q (sp, sp, sp+1); }1778break;17791780case 19:1781/* Line 1787 of yacc.c */1782#line 202 "calc.y"1783{ sp--; mpz_fdiv_r (sp, sp, sp+1); }1784break;17851786case 20:1787/* Line 1787 of yacc.c */1788#line 203 "calc.y"1789{ CHECK_UI ("Exponent", sp);1790sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }1791break;17921793case 21:1794/* Line 1787 of yacc.c */1795#line 205 "calc.y"1796{ CHECK_UI ("Shift count", sp);1797sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }1798break;17991800case 22:1801/* Line 1787 of yacc.c */1802#line 207 "calc.y"1803{ CHECK_UI ("Shift count", sp);1804sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }1805break;18061807case 23:1808/* Line 1787 of yacc.c */1809#line 209 "calc.y"1810{ CHECK_UI ("Factorial", sp);1811mpz_fac_ui (sp, mpz_get_ui (sp)); }1812break;18131814case 24:1815/* Line 1787 of yacc.c */1816#line 211 "calc.y"1817{ mpz_neg (sp, sp); }1818break;18191820case 25:1821/* Line 1787 of yacc.c */1822#line 213 "calc.y"1823{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) < 0); }1824break;18251826case 26:1827/* Line 1787 of yacc.c */1828#line 214 "calc.y"1829{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }1830break;18311832case 27:1833/* Line 1787 of yacc.c */1834#line 215 "calc.y"1835{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }1836break;18371838case 28:1839/* Line 1787 of yacc.c */1840#line 216 "calc.y"1841{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }1842break;18431844case 29:1845/* Line 1787 of yacc.c */1846#line 217 "calc.y"1847{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }1848break;18491850case 30:1851/* Line 1787 of yacc.c */1852#line 218 "calc.y"1853{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) > 0); }1854break;18551856case 31:1857/* Line 1787 of yacc.c */1858#line 220 "calc.y"1859{ sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }1860break;18611862case 32:1863/* Line 1787 of yacc.c */1864#line 221 "calc.y"1865{ sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }1866break;18671868case 33:1869/* Line 1787 of yacc.c */1870#line 223 "calc.y"1871{ mpz_abs (sp, sp); }1872break;18731874case 34:1875/* Line 1787 of yacc.c */1876#line 224 "calc.y"1877{ sp--; CHECK_UI ("Binomial base", sp+1);1878mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }1879break;18801881case 35:1882/* Line 1787 of yacc.c */1883#line 226 "calc.y"1884{ CHECK_UI ("Fibonacci", sp);1885mpz_fib_ui (sp, mpz_get_ui (sp)); }1886break;18871888case 37:1889/* Line 1787 of yacc.c */1890#line 229 "calc.y"1891{ sp--; mpz_set_si (sp,1892mpz_kronecker (sp, sp+1)); }1893break;18941895case 39:1896/* Line 1787 of yacc.c */1897#line 232 "calc.y"1898{ CHECK_UI ("Lucas number", sp);1899mpz_lucnum_ui (sp, mpz_get_ui (sp)); }1900break;19011902case 40:1903/* Line 1787 of yacc.c */1904#line 234 "calc.y"1905{ mpz_nextprime (sp, sp); }1906break;19071908case 41:1909/* Line 1787 of yacc.c */1910#line 235 "calc.y"1911{ sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }1912break;19131914case 42:1915/* Line 1787 of yacc.c */1916#line 236 "calc.y"1917{ sp--; CHECK_UI ("Nth-root", sp+1);1918mpz_root (sp, sp, mpz_get_ui (sp+1)); }1919break;19201921case 43:1922/* Line 1787 of yacc.c */1923#line 238 "calc.y"1924{ mpz_sqrt (sp, sp); }1925break;19261927case 44:1928/* Line 1787 of yacc.c */1929#line 240 "calc.y"1930{1931sp++;1932CHECK_OVERFLOW ();1933CHECK_VARIABLE ((yyvsp[(1) - (1)].var));1934mpz_set (sp, variable[(yyvsp[(1) - (1)].var)]);1935}1936break;19371938case 45:1939/* Line 1787 of yacc.c */1940#line 246 "calc.y"1941{1942sp++;1943CHECK_OVERFLOW ();1944if (mpz_set_str (sp, (yyvsp[(1) - (1)].str), ibase) != 0)1945{1946fprintf (stderr, "Invalid number: %s\n", (yyvsp[(1) - (1)].str));1947YYERROR;1948}1949}1950break;19511952case 47:1953/* Line 1787 of yacc.c */1954#line 258 "calc.y"1955{ sp--; mpz_gcd (sp, sp, sp+1); }1956break;19571958case 49:1959/* Line 1787 of yacc.c */1960#line 262 "calc.y"1961{ sp--; mpz_lcm (sp, sp, sp+1); }1962break;196319641965/* Line 1787 of yacc.c */1966#line 1968 "calc.c"1967default: break;1968}1969/* User semantic actions sometimes alter yychar, and that requires1970that yytoken be updated with the new translation. We take the1971approach of translating immediately before every use of yytoken.1972One alternative is translating here after every semantic action,1973but that translation would be missed if the semantic action invokes1974YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or1975if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an1976incorrect destructor might then be invoked immediately. In the1977case of YYERROR or YYBACKUP, subsequent parser actions might lead1978to an incorrect destructor call or verbose syntax error message1979before the lookahead is translated. */1980YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);19811982YYPOPSTACK (yylen);1983yylen = 0;1984YY_STACK_PRINT (yyss, yyssp);19851986*++yyvsp = yyval;19871988/* Now `shift' the result of the reduction. Determine what state1989that goes to, based on the state we popped back to and the rule1990number reduced by. */19911992yyn = yyr1[yyn];19931994yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;1995if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)1996yystate = yytable[yystate];1997else1998yystate = yydefgoto[yyn - YYNTOKENS];19992000goto yynewstate;200120022003/*------------------------------------.2004| yyerrlab -- here on detecting error |2005`------------------------------------*/2006yyerrlab:2007/* Make sure we have latest lookahead translation. See comments at2008user semantic actions for why this is necessary. */2009yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);20102011/* If not already recovering from an error, report this error. */2012if (!yyerrstatus)2013{2014++yynerrs;2015#if ! YYERROR_VERBOSE2016yyerror (YY_("syntax error"));2017#else2018# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \2019yyssp, yytoken)2020{2021char const *yymsgp = YY_("syntax error");2022int yysyntax_error_status;2023yysyntax_error_status = YYSYNTAX_ERROR;2024if (yysyntax_error_status == 0)2025yymsgp = yymsg;2026else if (yysyntax_error_status == 1)2027{2028if (yymsg != yymsgbuf)2029YYSTACK_FREE (yymsg);2030yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);2031if (!yymsg)2032{2033yymsg = yymsgbuf;2034yymsg_alloc = sizeof yymsgbuf;2035yysyntax_error_status = 2;2036}2037else2038{2039yysyntax_error_status = YYSYNTAX_ERROR;2040yymsgp = yymsg;2041}2042}2043yyerror (yymsgp);2044if (yysyntax_error_status == 2)2045goto yyexhaustedlab;2046}2047# undef YYSYNTAX_ERROR2048#endif2049}2050205120522053if (yyerrstatus == 3)2054{2055/* If just tried and failed to reuse lookahead token after an2056error, discard it. */20572058if (yychar <= YYEOF)2059{2060/* Return failure if at end of input. */2061if (yychar == YYEOF)2062YYABORT;2063}2064else2065{2066yydestruct ("Error: discarding",2067yytoken, &yylval);2068yychar = YYEMPTY;2069}2070}20712072/* Else will try to reuse lookahead token after shifting the error2073token. */2074goto yyerrlab1;207520762077/*---------------------------------------------------.2078| yyerrorlab -- error raised explicitly by YYERROR. |2079`---------------------------------------------------*/2080yyerrorlab:20812082/* Pacify compilers like GCC when the user code never invokes2083YYERROR and the label yyerrorlab therefore never appears in user2084code. */2085if (/*CONSTCOND*/ 0)2086goto yyerrorlab;20872088/* Do not reclaim the symbols of the rule which action triggered2089this YYERROR. */2090YYPOPSTACK (yylen);2091yylen = 0;2092YY_STACK_PRINT (yyss, yyssp);2093yystate = *yyssp;2094goto yyerrlab1;209520962097/*-------------------------------------------------------------.2098| yyerrlab1 -- common code for both syntax error and YYERROR. |2099`-------------------------------------------------------------*/2100yyerrlab1:2101yyerrstatus = 3; /* Each real token shifted decrements this. */21022103for (;;)2104{2105yyn = yypact[yystate];2106if (!yypact_value_is_default (yyn))2107{2108yyn += YYTERROR;2109if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)2110{2111yyn = yytable[yyn];2112if (0 < yyn)2113break;2114}2115}21162117/* Pop the current state because it cannot handle the error token. */2118if (yyssp == yyss)2119YYABORT;212021212122yydestruct ("Error: popping",2123yystos[yystate], yyvsp);2124YYPOPSTACK (1);2125yystate = *yyssp;2126YY_STACK_PRINT (yyss, yyssp);2127}21282129YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN2130*++yyvsp = yylval;2131YY_IGNORE_MAYBE_UNINITIALIZED_END213221332134/* Shift the error token. */2135YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);21362137yystate = yyn;2138goto yynewstate;213921402141/*-------------------------------------.2142| yyacceptlab -- YYACCEPT comes here. |2143`-------------------------------------*/2144yyacceptlab:2145yyresult = 0;2146goto yyreturn;21472148/*-----------------------------------.2149| yyabortlab -- YYABORT comes here. |2150`-----------------------------------*/2151yyabortlab:2152yyresult = 1;2153goto yyreturn;21542155#if !defined yyoverflow || YYERROR_VERBOSE2156/*-------------------------------------------------.2157| yyexhaustedlab -- memory exhaustion comes here. |2158`-------------------------------------------------*/2159yyexhaustedlab:2160yyerror (YY_("memory exhausted"));2161yyresult = 2;2162/* Fall through. */2163#endif21642165yyreturn:2166if (yychar != YYEMPTY)2167{2168/* Make sure we have latest lookahead translation. See comments at2169user semantic actions for why this is necessary. */2170yytoken = YYTRANSLATE (yychar);2171yydestruct ("Cleanup: discarding lookahead",2172yytoken, &yylval);2173}2174/* Do not reclaim the symbols of the rule which action triggered2175this YYABORT or YYACCEPT. */2176YYPOPSTACK (yylen);2177YY_STACK_PRINT (yyss, yyssp);2178while (yyssp != yyss)2179{2180yydestruct ("Cleanup: popping",2181yystos[*yyssp], yyvsp);2182YYPOPSTACK (1);2183}2184#ifndef yyoverflow2185if (yyss != yyssa)2186YYSTACK_FREE (yyss);2187#endif2188#if YYERROR_VERBOSE2189if (yymsg != yymsgbuf)2190YYSTACK_FREE (yymsg);2191#endif2192/* Make sure YYID is used. */2193return YYID (yyresult);2194}219521962197/* Line 2050 of yacc.c */2198#line 264 "calc.y"219922002201yyerror (char *s)2202{2203fprintf (stderr, "%s\n", s);2204}22052206int calc_option_readline = -1;22072208int2209main (int argc, char *argv[])2210{2211int i;22122213for (i = 1; i < argc; i++)2214{2215if (strcmp (argv[i], "--readline") == 0)2216calc_option_readline = 1;2217else if (strcmp (argv[i], "--noreadline") == 0)2218calc_option_readline = 0;2219else if (strcmp (argv[i], "--help") == 0)2220{2221printf ("Usage: calc [--option]...\n");2222printf (" --readline use readline\n");2223printf (" --noreadline don't use readline\n");2224printf (" --help this message\n");2225printf ("Readline is only available when compiled in,\n");2226printf ("and in that case it's the default on a tty.\n");2227exit (0);2228}2229else2230{2231fprintf (stderr, "Unrecognised option: %s\n", argv[i]);2232exit (1);2233}2234}22352236#if WITH_READLINE2237calc_init_readline ();2238#else2239if (calc_option_readline == 1)2240{2241fprintf (stderr, "Readline support not available\n");2242exit (1);2243}2244#endif22452246for (i = 0; i < numberof (variable); i++)2247mpz_init (variable[i]);22482249for (i = 0; i < numberof (stack); i++)2250mpz_init (stack[i]);22512252return yyparse ();2253}225422552256