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

📄 pl_gram.c

📁 PostgreSQL7.4.6 for Linux
💻 C
📖 第 1 页 / 共 5 页
字号:
/* 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 plpgsql_yy or PLPGSQL_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 PLPGSQL_YYBISON 1/* Skeleton name.  */#define PLPGSQL_YYSKELETON_NAME "yacc.c"/* Pure parsers.  */#define PLPGSQL_YYPURE 0/* Using locations.  */#define PLPGSQL_YYLSP_NEEDED 0/* Tokens.  */#ifndef PLPGSQL_YYTOKENTYPE# define PLPGSQL_YYTOKENTYPE   /* Put the tokens into the symbol table, so that GDB and other debuggers      know about them.  */   enum plpgsql_yytokentype {     K_ALIAS = 258,     K_ASSIGN = 259,     K_BEGIN = 260,     K_CLOSE = 261,     K_CONSTANT = 262,     K_CURSOR = 263,     K_DEBUG = 264,     K_DECLARE = 265,     K_DEFAULT = 266,     K_DIAGNOSTICS = 267,     K_DOTDOT = 268,     K_ELSE = 269,     K_ELSIF = 270,     K_END = 271,     K_EXCEPTION = 272,     K_EXECUTE = 273,     K_EXIT = 274,     K_FOR = 275,     K_FETCH = 276,     K_FROM = 277,     K_GET = 278,     K_IF = 279,     K_IN = 280,     K_INFO = 281,     K_INTO = 282,     K_IS = 283,     K_LOG = 284,     K_LOOP = 285,     K_NEXT = 286,     K_NOT = 287,     K_NOTICE = 288,     K_NULL = 289,     K_OPEN = 290,     K_PERFORM = 291,     K_ROW_COUNT = 292,     K_RAISE = 293,     K_RECORD = 294,     K_RENAME = 295,     K_RESULT_OID = 296,     K_RETURN = 297,     K_RETURN_NEXT = 298,     K_REVERSE = 299,     K_SELECT = 300,     K_THEN = 301,     K_TO = 302,     K_TYPE = 303,     K_WARNING = 304,     K_WHEN = 305,     K_WHILE = 306,     T_FUNCTION = 307,     T_TRIGGER = 308,     T_STRING = 309,     T_NUMBER = 310,     T_VARIABLE = 311,     T_ROW = 312,     T_RECORD = 313,     T_DTYPE = 314,     T_LABEL = 315,     T_WORD = 316,     T_ERROR = 317,     O_OPTION = 318,     O_DUMP = 319   };#endif#define K_ALIAS 258#define K_ASSIGN 259#define K_BEGIN 260#define K_CLOSE 261#define K_CONSTANT 262#define K_CURSOR 263#define K_DEBUG 264#define K_DECLARE 265#define K_DEFAULT 266#define K_DIAGNOSTICS 267#define K_DOTDOT 268#define K_ELSE 269#define K_ELSIF 270#define K_END 271#define K_EXCEPTION 272#define K_EXECUTE 273#define K_EXIT 274#define K_FOR 275#define K_FETCH 276#define K_FROM 277#define K_GET 278#define K_IF 279#define K_IN 280#define K_INFO 281#define K_INTO 282#define K_IS 283#define K_LOG 284#define K_LOOP 285#define K_NEXT 286#define K_NOT 287#define K_NOTICE 288#define K_NULL 289#define K_OPEN 290#define K_PERFORM 291#define K_ROW_COUNT 292#define K_RAISE 293#define K_RECORD 294#define K_RENAME 295#define K_RESULT_OID 296#define K_RETURN 297#define K_RETURN_NEXT 298#define K_REVERSE 299#define K_SELECT 300#define K_THEN 301#define K_TO 302#define K_TYPE 303#define K_WARNING 304#define K_WHEN 305#define K_WHILE 306#define T_FUNCTION 307#define T_TRIGGER 308#define T_STRING 309#define T_NUMBER 310#define T_VARIABLE 311#define T_ROW 312#define T_RECORD 313#define T_DTYPE 314#define T_LABEL 315#define T_WORD 316#define T_ERROR 317#define O_OPTION 318#define O_DUMP 319/* Copy the first part of user declarations.  */#line 1 "gram.y"/********************************************************************** * gram.y				- Parser for the PL/pgSQL *						  procedural language * * IDENTIFICATION *	  $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.48 2003/10/30 17:18:55 tgl Exp $ * *	  This software is copyrighted by Jan Wieck - Hamburg. * *	  The author hereby grants permission  to  use,  copy,	modify, *	  distribute,  and	license this software and its documentation *	  for any purpose, provided that existing copyright notices are *	  retained	in	all  copies  and  that	this notice is included *	  verbatim in any distributions. No written agreement, license, *	  or  royalty  fee	is required for any of the authorized uses. *	  Modifications to this software may be  copyrighted  by  their *	  author  and  need  not  follow  the licensing terms described *	  here, provided that the new terms are  clearly  indicated  on *	  the first page of each file where they apply. * *	  IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY *	  PARTY  FOR  DIRECT,	INDIRECT,	SPECIAL,   INCIDENTAL,	 OR *	  CONSEQUENTIAL   DAMAGES  ARISING	OUT  OF  THE  USE  OF  THIS *	  SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN *	  IF  THE  AUTHOR  HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH *	  DAMAGE. * *	  THE  AUTHOR  AND	DISTRIBUTORS  SPECIFICALLY	 DISCLAIM	ANY *	  WARRANTIES,  INCLUDING,  BUT	NOT  LIMITED  TO,  THE	IMPLIED *	  WARRANTIES  OF  MERCHANTABILITY,	FITNESS  FOR  A  PARTICULAR *	  PURPOSE,	AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON *	  AN "AS IS" BASIS, AND THE AUTHOR	AND  DISTRIBUTORS  HAVE  NO *	  OBLIGATION   TO	PROVIDE   MAINTENANCE,	 SUPPORT,  UPDATES, *	  ENHANCEMENTS, OR MODIFICATIONS. * **********************************************************************/#include "plpgsql.h"static	PLpgSQL_expr	*read_sql_construct(int until,											const char *expected,											bool isexpression,											const char *sqlstart);static	PLpgSQL_expr	*read_sql_stmt(const char *sqlstart);static	PLpgSQL_type	*read_datatype(int tok);static	PLpgSQL_stmt	*make_select_stmt(void);static	PLpgSQL_stmt	*make_fetch_stmt(void);static	void check_assignable(PLpgSQL_datum *datum);/* Enabling traces.  */#ifndef PLPGSQL_YYDEBUG# define PLPGSQL_YYDEBUG 0#endif/* Enabling verbose error messages.  */#ifdef PLPGSQL_YYERROR_VERBOSE# undef PLPGSQL_YYERROR_VERBOSE# define PLPGSQL_YYERROR_VERBOSE 1#else# define PLPGSQL_YYERROR_VERBOSE 0#endif#if ! defined (PLPGSQL_YYSTYPE) && ! defined (PLPGSQL_YYSTYPE_IS_DECLARED)#line 54 "gram.y"typedef union PLPGSQL_YYSTYPE {		int32					ival;		char					*str;		struct		{			char *name;			int  lineno;		}						varname;		struct		{			int  nalloc;			int  nused;			int	 *nums;		}						intlist;		struct		{			int  nalloc;			int  nused;			PLpgSQL_diag_item *dtitems;		}						dtlist;		struct		{			int  reverse;			PLpgSQL_expr *expr;		}						forilow;		struct		{			char *label;			int  n_initvars;			int  *initvarnos;		}						declhdr;		PLpgSQL_type			*dtype;		PLpgSQL_datum			*variable; /* a VAR, RECFIELD, or TRIGARG */		PLpgSQL_var				*var;		PLpgSQL_row				*row;		PLpgSQL_rec				*rec;		PLpgSQL_expr			*expr;		PLpgSQL_stmt			*stmt;		PLpgSQL_stmts			*stmts;		PLpgSQL_stmt_block		*program;		PLpgSQL_nsitem			*nsitem;} PLPGSQL_YYSTYPE;/* Line 191 of yacc.c.  */#line 299 "y.tab.c"# define plpgsql_yystype PLPGSQL_YYSTYPE /* obsolescent; will be withdrawn */# define PLPGSQL_YYSTYPE_IS_DECLARED 1# define PLPGSQL_YYSTYPE_IS_TRIVIAL 1#endif/* Copy the second part of user declarations.  *//* Line 214 of yacc.c.  */#line 311 "y.tab.c"#if ! defined (plpgsql_yyoverflow) || PLPGSQL_YYERROR_VERBOSE/* The parser invokes alloca or malloc; define the necessary symbols.  */# if PLPGSQL_YYSTACK_USE_ALLOCA#  define PLPGSQL_YYSTACK_ALLOC alloca# else#  ifndef PLPGSQL_YYSTACK_USE_ALLOCA#   if defined (alloca) || defined (_ALLOCA_H)#    define PLPGSQL_YYSTACK_ALLOC alloca#   else#    ifdef __GNUC__#     define PLPGSQL_YYSTACK_ALLOC __builtin_alloca#    endif#   endif#  endif# endif# ifdef PLPGSQL_YYSTACK_ALLOC   /* Pacify GCC's `empty if-body' warning. */#  define PLPGSQL_YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else#  if defined (__STDC__) || defined (__cplusplus)#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */#   define PLPGSQL_YYSIZE_T size_t#  endif#  define PLPGSQL_YYSTACK_ALLOC malloc#  define PLPGSQL_YYSTACK_FREE free# endif#endif /* ! defined (plpgsql_yyoverflow) || PLPGSQL_YYERROR_VERBOSE */#if (! defined (plpgsql_yyoverflow) \     && (! defined (__cplusplus) \	 || (PLPGSQL_YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member.  */union plpgsql_yyalloc{  short plpgsql_yyss;  PLPGSQL_YYSTYPE plpgsql_yyvs;  };/* The size of the maximum gap between one aligned stack and the next.  */# define PLPGSQL_YYSTACK_GAP_MAXIMUM (sizeof (union plpgsql_yyalloc) - 1)/* The size of an array large to enough to hold all stacks, each with   N elements.  */# define PLPGSQL_YYSTACK_BYTES(N) \     ((N) * (sizeof (short) + sizeof (PLPGSQL_YYSTYPE))				\      + PLPGSQL_YYSTACK_GAP_MAXIMUM)/* Copy COUNT objects from FROM to TO.  The source and destination do   not overlap.  */# ifndef PLPGSQL_YYCOPY#  if 1 < __GNUC__#   define PLPGSQL_YYCOPY(To, From, Count) \      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))#  else#   define PLPGSQL_YYCOPY(To, From, Count)		\      do					\	{					\	  register PLPGSQL_YYSIZE_T plpgsql_yyi;		\	  for (plpgsql_yyi = 0; plpgsql_yyi < (Count); plpgsql_yyi++)	\	    (To)[plpgsql_yyi] = (From)[plpgsql_yyi];		\	}					\      while (0)#  endif# endif/* Relocate STACK from its old location to the new one.  The   local variables PLPGSQL_YYSIZE and PLPGSQL_YYSTACKSIZE give the old and new number of   elements in the stack, and PLPGSQL_YYPTR gives the new location of the   stack.  Advance PLPGSQL_YYPTR to a properly aligned location for the next

⌨️ 快捷键说明

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