bootparse.c
来自「PostgreSQL7.4.6 for Linux」· C语言 代码 · 共 1,634 行 · 第 1/3 页
C
1,634 行
/* A Bison parser, made by GNU Bison 1.875. *//* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 Int_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 Int_yytokentype { CONST_P = 258, ID = 259, OPEN = 260, XCLOSE = 261, XCREATE = 262, INSERT_TUPLE = 263, STRING = 264, XDEFINE = 265, XDECLARE = 266, INDEX = 267, ON = 268, USING = 269, XBUILD = 270, INDICES = 271, UNIQUE = 272, COMMA = 273, EQUALS = 274, LPAREN = 275, RPAREN = 276, OBJ_ID = 277, XBOOTSTRAP = 278, XSHARED_RELATION = 279, XWITHOUT_OIDS = 280, NULLVAL = 281, low = 282, high = 283 };#endif#define CONST_P 258#define ID 259#define OPEN 260#define XCLOSE 261#define XCREATE 262#define INSERT_TUPLE 263#define STRING 264#define XDEFINE 265#define XDECLARE 266#define INDEX 267#define ON 268#define USING 269#define XBUILD 270#define INDICES 271#define UNIQUE 272#define COMMA 273#define EQUALS 274#define LPAREN 275#define RPAREN 276#define OBJ_ID 277#define XBOOTSTRAP 278#define XSHARED_RELATION 279#define XWITHOUT_OIDS 280#define NULLVAL 281#define low 282#define high 283/* Copy the first part of user declarations. */#line 1 "bootparse.y"/*------------------------------------------------------------------------- * * bootparse.y * yacc parser grammar for the "backend" initialization program. * * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.60 2003/08/04 02:39:57 momjian Exp $ * *------------------------------------------------------------------------- */#include "postgres.h"#include <time.h>#include <unistd.h>#include "access/attnum.h"#include "access/htup.h"#include "access/itup.h"#include "access/skey.h"#include "access/strat.h"#include "access/tupdesc.h"#include "access/xact.h"#include "bootstrap/bootstrap.h"#include "catalog/catalog.h"#include "catalog/heap.h"#include "catalog/pg_am.h"#include "catalog/pg_attribute.h"#include "catalog/pg_class.h"#include "catalog/pg_namespace.h"#include "commands/defrem.h"#include "miscadmin.h"#include "nodes/makefuncs.h"#include "nodes/nodes.h"#include "nodes/parsenodes.h"#include "nodes/pg_list.h"#include "nodes/primnodes.h"#include "rewrite/prs2lock.h"#include "storage/block.h"#include "storage/fd.h"#include "storage/ipc.h"#include "storage/itemptr.h"#include "storage/off.h"#include "storage/smgr.h"#include "tcop/dest.h"#include "utils/nabstime.h"#include "utils/rel.h"static voiddo_start(){ StartTransactionCommand(); elog(DEBUG4, "start transaction");}static voiddo_end(){ CommitTransactionCommand(); elog(DEBUG4, "commit transaction"); if (isatty(0)) { printf("bootstrap> "); fflush(stdout); }}int num_columns_read = 0;/* 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)#line 81 "bootparse.y"typedef union YYSTYPE { List *list; IndexElem *ielem; char *str; int ival; Oid oidval;} YYSTYPE;/* Line 191 of yacc.c. */#line 218 "y.tab.c"# define Int_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 230 "y.tab.c"#if ! defined (Int_yyoverflow) || YYERROR_VERBOSE/* The parser invokes alloca or malloc; define the necessary symbols. */# if YYSTACK_USE_ALLOCA# define YYSTACK_ALLOC alloca# else# ifndef YYSTACK_USE_ALLOCA# if defined (alloca) || defined (_ALLOCA_H)# define YYSTACK_ALLOC alloca# else# ifdef __GNUC__# define YYSTACK_ALLOC __builtin_alloca# endif# 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 malloc# define YYSTACK_FREE free# endif#endif /* ! defined (Int_yyoverflow) || YYERROR_VERBOSE */#if (! defined (Int_yyoverflow) \ && (! defined (__cplusplus) \ || (YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member. */union Int_yyalloc{ short Int_yyss; YYSTYPE Int_yyvs; };/* The size of the maximum gap between one aligned stack and the next. */# define YYSTACK_GAP_MAXIMUM (sizeof (union Int_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) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM)/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */# ifndef YYCOPY# if 1 < __GNUC__# define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))# else# define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T Int_yyi; \ for (Int_yyi = 0; Int_yyi < (Count); Int_yyi++) \ (To)[Int_yyi] = (From)[Int_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 Int_yynewbytes; \ YYCOPY (&Int_yyptr->Stack, Stack, Int_yysize); \ Stack = &Int_yyptr->Stack; \ Int_yynewbytes = Int_yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ Int_yyptr += Int_yynewbytes / sizeof (*Int_yyptr); \ } \ while (0)#endif#if defined (__STDC__) || defined (__cplusplus) typedef signed char Int_yysigned_char;#else typedef short Int_yysigned_char;#endif/* YYFINAL -- State number of the termination state. */#define YYFINAL 27/* YYLAST -- Last index in YYTABLE. */#define YYLAST 74/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS 29/* YYNNTS -- Number of nonterminals. */#define YYNNTS 26/* YYNRULES -- Number of rules. */#define YYNRULES 45/* YYNRULES -- Number of states. */#define YYNSTATES 81/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */#define YYUNDEFTOK 2#define YYMAXUTOK 283#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? Int_yytranslate[YYX] : YYUNDEFTOK)/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */static const unsigned char Int_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, 28};#if YYDEBUG/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */static const unsigned char Int_yyprhs[] ={ 0, 0, 3, 5, 6, 8, 11, 13, 15, 17, 19, 21, 23, 25, 28, 31, 33, 34, 35, 46, 47, 54, 65, 77, 80, 84, 86, 89, 91, 92, 94, 95, 97, 98, 100, 104, 108, 112, 113, 115, 118, 122, 124, 126, 128, 130};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const Int_yysigned_char Int_yyrhs[] ={ 30, 0, -1, 31, -1, -1, 32, -1, 31, 32, -1, 33, -1, 34, -1, 35, -1, 38, -1, 40, -1, 41, -1, 42, -1, 5, 54, -1, 6, 54, -1, 6, -1, -1, -1, 7, 45, 46, 47, 54, 20, 36, 48, 37, 21, -1, -1, 8, 50, 39, 20, 51, 21, -1, 11, 12, 54, 13, 54, 14, 54, 20, 43, 21, -1, 11, 17, 12, 54, 13, 54, 14, 54, 20, 43, 21, -1, 15, 16, -1, 43, 18, 44, -1, 44, -1, 54, 54, -1, 23, -1, -1, 24, -1, -1, 25, -1, -1, 49, -1, 48, 18, 49, -1, 54, 19, 54, -1, 22, 19, 54, -1, -1, 52, -1, 51, 52, -1, 51, 18, 52, -1, 54, -1, 53, -1, 26, -1, 3, -1, 4, -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined. */static const unsigned short Int_yyrline[] ={ 0, 110, 110, 111, 115, 116, 120, 121, 122, 123, 124, 125, 126, 130, 139, 145, 155, 164, 154, 210, 209, 234, 248, 262, 267, 268, 272, 283, 284, 288, 289, 293, 294, 298, 299, 303, 312, 313, 317, 318, 319, 323, 325, 327, 332, 336};#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 Int_yytname[] ={ "$end", "error", "$undefined", "CONST_P", "ID", "OPEN", "XCLOSE", "XCREATE", "INSERT_TUPLE", "STRING", "XDEFINE", "XDECLARE", "INDEX", "ON", "USING", "XBUILD", "INDICES", "UNIQUE", "COMMA", "EQUALS", "LPAREN", "RPAREN", "OBJ_ID", "XBOOTSTRAP", "XSHARED_RELATION", "XWITHOUT_OIDS", "NULLVAL", "low", "high", "$accept", "TopLevel", "Boot_Queries", "Boot_Query", "Boot_OpenStmt", "Boot_CloseStmt", "Boot_CreateStmt", "@1", "@2", "Boot_InsertStmt", "@3", "Boot_DeclareIndexStmt", "Boot_DeclareUniqueIndexStmt", "Boot_BuildIndsStmt", "boot_index_params", "boot_index_param", "optbootstrap", "optsharedrelation", "optwithoutoids", "boot_typelist", "boot_type_thing", "optoideq", "boot_tuplelist", "boot_tuple", "boot_const", "boot_ident", 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, 283};# endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */static const unsigned char Int_yyr1[] ={ 0, 29, 30, 30, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33, 34, 34, 36, 37, 35, 39, 38, 40, 41, 42, 43, 43, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 50, 50, 51, 51, 51, 52, 52, 52, 53, 54};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */static const unsigned char Int_yyr2[] ={ 0, 2, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 0, 0, 10, 0, 6, 10, 11, 2, 3, 1, 2, 1, 0, 1, 0, 1, 0, 1, 3, 3, 3, 0, 1, 2, 3, 1, 1, 1, 1, 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 Int_yydefact[] ={ 3, 0, 15, 28, 37, 0, 0, 0, 2, 4, 6, 7, 8, 9, 10, 11, 12, 45, 13, 14, 27, 30, 0, 19, 0, 0, 23, 1, 5, 29, 32, 0, 0, 0, 0, 31, 0, 36, 0, 0, 0, 0, 44, 43, 0, 38, 42, 41, 0, 0, 16, 0, 20, 39, 0, 0, 0, 40, 0, 0, 17, 33, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 34, 18, 35, 0, 21, 26, 0, 24, 22};/* YYDEFGOTO[NTERM-NUM]. */static const Int_yysigned_char Int_yydefgoto[] ={ -1, 7, 8, 9, 10, 11, 12, 56, 66, 13, 32, 14, 15, 16, 68, 69, 21, 30, 36, 60, 61, 23, 44, 45, 46, 47};/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */#define YYPACT_NINF -38static const Int_yysigned_char Int_yypact[] ={ 4, -2, -2, -7, -5, -4, 9, 20, 4, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, 7, 3, -38, -2, 22, -38, -38, -38, -38, 12, -2, 16, 26, -2, -38, -2, -38, 2, -2, 27, 21, -38, -38, 0, -38, -38, -38, 28, -2, -38, 2, -38, -38, -2, 29, -2, -38, 24, -2, 31, -38, 32, -2, 25, -2, 33, -2, 6, -38, -2, -2, -38, -38, -38, -2, -38, -38, 11, -38, -38};/* YYPGOTO[NTERM-NUM]. */static const Int_yysigned_char Int_yypgoto[] ={ -38, -38, -38, 38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -24, -25, -38, -38, -38, -38, -13, -38, -38, -37, -38, -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 Int_yytable[] ={ 18, 19, 17, 42, 17, 42, 17, 53, 24, 1, 2, 3, 4, 25, 57, 5, 20, 22, 51, 6, 27, 52, 31, 33, 75, 26, 43, 76, 43, 75, 37, 29, 80, 40, 34, 41, 38, 35, 48, 39, 49, 50, 54, 59, 63, 71, 28, 78, 55, 65, 79, 67, 72, 58, 73, 62, 0, 0, 64, 0, 0, 0, 70, 0, 62, 0, 74, 0, 0, 77, 70, 0, 0, 0, 70};static const Int_yysigned_char Int_yycheck[] ={ 1, 2, 4, 3, 4, 3, 4, 44, 12, 5, 6, 7, 8, 17, 51, 11, 23, 22, 18, 15, 0, 21, 19, 24, 18, 16, 26, 21, 26, 18, 31, 24, 21, 34, 12, 36, 20, 25, 39, 13, 13, 20, 14, 14, 20, 20, 8, 71, 49, 18,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?