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

📄 pl_gram.c

📁 PostgreSQL 8.1.4的源码 适用于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_CONTINUE = 263,     K_CURSOR = 264,     K_DEBUG = 265,     K_DECLARE = 266,     K_DEFAULT = 267,     K_DIAGNOSTICS = 268,     K_DOTDOT = 269,     K_ELSE = 270,     K_ELSIF = 271,     K_END = 272,     K_EXCEPTION = 273,     K_EXECUTE = 274,     K_EXIT = 275,     K_FOR = 276,     K_FETCH = 277,     K_FROM = 278,     K_GET = 279,     K_IF = 280,     K_IN = 281,     K_INFO = 282,     K_INTO = 283,     K_IS = 284,     K_LOG = 285,     K_LOOP = 286,     K_NEXT = 287,     K_NOT = 288,     K_NOTICE = 289,     K_NULL = 290,     K_OPEN = 291,     K_OR = 292,     K_PERFORM = 293,     K_ROW_COUNT = 294,     K_RAISE = 295,     K_RENAME = 296,     K_RESULT_OID = 297,     K_RETURN = 298,     K_RETURN_NEXT = 299,     K_REVERSE = 300,     K_SELECT = 301,     K_THEN = 302,     K_TO = 303,     K_TYPE = 304,     K_WARNING = 305,     K_WHEN = 306,     K_WHILE = 307,     T_FUNCTION = 308,     T_TRIGGER = 309,     T_STRING = 310,     T_NUMBER = 311,     T_SCALAR = 312,     T_ROW = 313,     T_RECORD = 314,     T_DTYPE = 315,     T_LABEL = 316,     T_WORD = 317,     T_ERROR = 318,     O_OPTION = 319,     O_DUMP = 320   };#endif#define K_ALIAS 258#define K_ASSIGN 259#define K_BEGIN 260#define K_CLOSE 261#define K_CONSTANT 262#define K_CONTINUE 263#define K_CURSOR 264#define K_DEBUG 265#define K_DECLARE 266#define K_DEFAULT 267#define K_DIAGNOSTICS 268#define K_DOTDOT 269#define K_ELSE 270#define K_ELSIF 271#define K_END 272#define K_EXCEPTION 273#define K_EXECUTE 274#define K_EXIT 275#define K_FOR 276#define K_FETCH 277#define K_FROM 278#define K_GET 279#define K_IF 280#define K_IN 281#define K_INFO 282#define K_INTO 283#define K_IS 284#define K_LOG 285#define K_LOOP 286#define K_NEXT 287#define K_NOT 288#define K_NOTICE 289#define K_NULL 290#define K_OPEN 291#define K_OR 292#define K_PERFORM 293#define K_ROW_COUNT 294#define K_RAISE 295#define K_RENAME 296#define K_RESULT_OID 297#define K_RETURN 298#define K_RETURN_NEXT 299#define K_REVERSE 300#define K_SELECT 301#define K_THEN 302#define K_TO 303#define K_TYPE 304#define K_WARNING 305#define K_WHEN 306#define K_WHILE 307#define T_FUNCTION 308#define T_TRIGGER 309#define T_STRING 310#define T_NUMBER 311#define T_SCALAR 312#define T_ROW 313#define T_RECORD 314#define T_DTYPE 315#define T_LABEL 316#define T_WORD 317#define T_ERROR 318#define O_OPTION 319#define O_DUMP 320/* Copy the first part of user declarations.  */#line 1 "gram.y"/********************************************************************** * gram.y				- Parser for the PL/pgSQL *						  procedural language * * IDENTIFICATION *	  $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.82.2.1 2006/03/23 04:22:44 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"#include "parser/parser.h"static PLpgSQL_expr		*read_sql_construct(int until,											int until2,											const char *expected,											const char *sqlstart,											bool isexpression,											bool valid_sql,											int *endtoken);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);static	PLpgSQL_row		*read_into_scalar_list(const char *initial_name,											   PLpgSQL_datum *initial_datum);static	void			 check_sql_expr(const char *stmt);static	void			 plpgsql_sql_error_callback(void *arg);static	void			 check_labels(const char *start_label,									  const char *end_label);/* 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 64 "gram.y"typedef union PLPGSQL_YYSTYPE {		int32					ival;		bool					boolean;		char					*str;		struct		{			char *name;			int  lineno;		}						varname;		struct		{			char *name;			int  lineno;			PLpgSQL_rec     *rec;			PLpgSQL_row     *row;		}						forvariable;		struct		{			char *label;			int  n_initvars;			int  *initvarnos;		}						declhdr;		struct		{			char *end_label;			List *stmts;		}						loop_body;		List					*list;		PLpgSQL_type			*dtype;		PLpgSQL_datum			*scalar;	/* a VAR, RECFIELD, or TRIGARG */		PLpgSQL_variable		*variable;	/* a VAR, REC, or ROW */		PLpgSQL_var				*var;		PLpgSQL_row				*row;		PLpgSQL_rec				*rec;		PLpgSQL_expr			*expr;		PLpgSQL_stmt			*stmt;		PLpgSQL_stmt_block		*program;		PLpgSQL_condition		*condition;		PLpgSQL_exception		*exception;		PLpgSQL_exception_block	*exception_block;		PLpgSQL_nsitem			*nsitem;		PLpgSQL_diag_item		*diagitem;} PLPGSQL_YYSTYPE;/* Line 191 of yacc.c.  */#line 312 "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 324 "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

⌨️ 快捷键说明

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