]> granicus.if.org Git - postgresql/commitdiff
Move some declarations in the raw-parser header files to create a clearer
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 12 Jul 2009 17:12:34 +0000 (17:12 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 12 Jul 2009 17:12:34 +0000 (17:12 +0000)
distinction between the external API (parser.h) and declarations that only
need to be visible within the raw parser code (gramparse.h, which now is only
included by parser.c, gram.y, scan.l, and keywords.c).  This is in preparation
for the upcoming change to a reentrant lexer, which will require referencing
YYSTYPE in the declarations of base_yylex and filtered_base_yylex, hence
gram.h will have to be included by gramparse.h.  We don't want any more files
than absolutely necessary to depend on gram.h, so some cleanup is called for.

12 files changed:
src/backend/commands/proclang.c
src/backend/commands/tablecmds.c
src/backend/parser/gram.y
src/backend/parser/keywords.c
src/backend/parser/parse_utilcmd.c
src/backend/parser/parser.c
src/backend/parser/scan.l
src/backend/utils/adt/ruleutils.c
src/backend/utils/misc/guc.c
src/include/parser/gramparse.h
src/include/parser/parser.h
src/pl/plpgsql/src/pl_comp.c

index afb61981cecb1e70f31707703b327c0cc20413e2..27af379d7e154ba93b8ddd74ac5c21c00f2d621c 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.85 2009/06/11 14:48:56 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.86 2009/07/12 17:12:33 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -28,8 +28,8 @@
 #include "commands/defrem.h"
 #include "commands/proclang.h"
 #include "miscadmin.h"
-#include "parser/gramparse.h"
 #include "parser/parse_func.h"
+#include "parser/parser.h"
 #include "utils/acl.h"
 #include "utils/builtins.h"
 #include "utils/fmgroids.h"
index f22e7be5d88eab5b6ff1e698dc19a15e320870fc..846f34e19dd7e3a3839b54f0e42e7c92498fc2c9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.288 2009/06/18 01:27:02 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.289 2009/07/12 17:12:33 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,7 +51,6 @@
 #include "nodes/nodeFuncs.h"
 #include "nodes/parsenodes.h"
 #include "optimizer/clauses.h"
-#include "parser/gramparse.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_expr.h"
index 06499fa9bc928195e62736c07f18d09a84def965..dd71071efd08b5bbd013aa51d47042af7b7ea325 100644 (file)
@@ -4,14 +4,14 @@
 /*-------------------------------------------------------------------------
  *
  * gram.y
- *       POSTGRES SQL YACC rules/actions
+ *       POSTGRESQL BISON rules/actions
  *
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.666 2009/07/06 02:58:40 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.667 2009/07/12 17:12:33 tgl Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -58,6 +58,7 @@
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "parser/gramparse.h"
+#include "parser/parser.h"
 #include "storage/lmgr.h"
 #include "utils/date.h"
 #include "utils/datetime.h"
@@ -6807,7 +6808,7 @@ opt_hold: /* EMPTY */                                             { $$ = 0; }
  *
  * There is an ambiguity when a sub-SELECT is within an a_expr and there
  * are excess parentheses: do the parentheses belong to the sub-SELECT or
- * to the surrounding a_expr?  We don't really care, but yacc wants to know.
+ * to the surrounding a_expr?  We don't really care, but bison wants to know.
  * To resolve the ambiguity, we are careful to define the grammar so that
  * the decision is staved off as long as possible: as long as we can keep
  * absorbing parentheses into the sub-SELECT, we will do so, and only when
@@ -8204,7 +8205,7 @@ a_expr:           c_expr                                                                  { $$ = $1; }
                                }
                /*
                 * These operators must be called out explicitly in order to make use
-                * of yacc/bison's automatic operator-precedence handling.  All other
+                * of bison's automatic operator-precedence handling.  All other
                 * operator names are handled by the generic productions using "Op",
                 * below; and all those operators will have the same precedence.
                 *
index 0abd802fea85cd120b61137165ca291f00b0d7f7..05e7fb9ee5ae8dca0e220d1a103de55dfffdb205 100644 (file)
@@ -9,16 +9,14 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.212 2009/03/08 16:53:30 alvherre Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.213 2009/07/12 17:12:33 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
 
-#include "nodes/nodes.h"
-#include "nodes/parsenodes.h"
+#include "parser/gramparse.h"
 #include "parser/keywords.h"
-#include "parser/gram.h"
 
 #define PG_KEYWORD(a,b,c) {a,b,c},
 
index e5a3621cce6ca518138789501efe1d7d9eec36de..0c93f58c1739f47c6ff0dc90111b47f82c41be2a 100644 (file)
@@ -19,7 +19,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.21 2009/06/11 14:49:00 momjian Exp $
+ *     $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.22 2009/07/12 17:12:34 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "parser/analyze.h"
-#include "parser/gramparse.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_expr.h"
 #include "parser/parse_relation.h"
 #include "parser/parse_type.h"
 #include "parser/parse_utilcmd.h"
+#include "parser/parser.h"
 #include "rewrite/rewriteManip.h"
 #include "utils/acl.h"
 #include "utils/builtins.h"
index ee77c38f86e3a3b68128e55e117ec08cb4e9317e..1e7f93af536ba8ac45adeb345ae88027bba5d989 100644 (file)
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.78 2009/06/11 14:49:00 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.79 2009/07/12 17:12:34 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "postgres.h"
 
-#include "parser/gramparse.h"  /* required before parser/gram.h! */
-#include "parser/gram.h"
+#include "parser/gramparse.h"
 #include "parser/parser.h"
 
 
index 6e18a41db1e6c42c5501c8af473d4860eae68e37..1483627510f6058ef418e3d641dd9596c2ed4d23 100644 (file)
@@ -24,7 +24,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.153 2009/05/05 21:09:23 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.154 2009/07/12 17:12:34 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,8 +35,6 @@
 
 #include "parser/gramparse.h"
 #include "parser/keywords.h"
-/* Not needed now that this file is compiled as part of gram.y */
-/* #include "parser/gram.h" */
 #include "parser/scansup.h"
 #include "mb/pg_wchar.h"
 
index f52bf8b5a12fa0801e418af03375deffe5d24339..6fdef41cc0450620b1bd11aa7de502acae61c855 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.300 2009/06/11 14:49:04 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.301 2009/07/12 17:12:34 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/tlist.h"
-#include "parser/gramparse.h"
 #include "parser/keywords.h"
 #include "parser/parse_func.h"
 #include "parser/parse_oper.h"
+#include "parser/parser.h"
 #include "parser/parsetree.h"
 #include "rewrite/rewriteHandler.h"
 #include "rewrite/rewriteManip.h"
index 210bd6ba6a5bb452fa5a07931bd799716260ffd4..66fa7810ae585f228febdab201c997ea9424c2da 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.505 2009/06/11 14:49:06 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.506 2009/07/12 17:12:34 tgl Exp $
  *
  *--------------------------------------------------------------------
  */
 #include "optimizer/geqo.h"
 #include "optimizer/paths.h"
 #include "optimizer/planmain.h"
-#include "parser/gramparse.h"
 #include "parser/parse_expr.h"
 #include "parser/parse_relation.h"
 #include "parser/parse_type.h"
+#include "parser/parser.h"
 #include "parser/scansup.h"
 #include "pgstat.h"
 #include "postmaster/autovacuum.h"
index 86719855be888f76ca05cf678fbb7a3000513939..31290a270c8488093b9b1d8c0636761bde772ae9 100644 (file)
@@ -1,13 +1,17 @@
 /*-------------------------------------------------------------------------
  *
  * gramparse.h
- *       Declarations for routines exported from lexer and parser files.
+ *             Shared definitions for the "raw" parser (flex and bison phases only)
+ *
+ * NOTE: this file is only meant to be included in the core parsing files,
+ * ie, parser.c, gram.y, scan.l, and keywords.c.  Definitions that are needed
+ * outside the core parser should be in parser.h.
  *
  *
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.44 2009/06/11 14:49:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.45 2009/07/12 17:12:34 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
  */
 #define YYLTYPE  int
 
-typedef enum
-{
-       BACKSLASH_QUOTE_OFF,
-       BACKSLASH_QUOTE_ON,
-       BACKSLASH_QUOTE_SAFE_ENCODING
-} BackslashQuoteType;
-
-/* GUC variables in scan.l (every one of these is a bad idea :-() */
-extern int     backslash_quote;
-extern bool escape_string_warning;
-extern bool standard_conforming_strings;
+/*
+ * After defining YYLTYPE, it's safe to include gram.h.
+ */
+#include "parser/gram.h"
 
 
 /* from parser.c */
@@ -53,7 +50,5 @@ extern void base_yyerror(const char *message);
 /* from gram.y */
 extern void parser_init(void);
 extern int     base_yyparse(void);
-extern List *SystemFuncName(char *name);
-extern TypeName *SystemTypeName(char *name);
 
 #endif   /* GRAMPARSE_H */
index cbe879302fcf64c726dacd36dd3e2746b6049ac3..becc24a9a94fb2a91f5764e0cd9eae8dd8172999 100644 (file)
@@ -1,23 +1,43 @@
 /*-------------------------------------------------------------------------
  *
  * parser.h
- *             Definitions for the "raw" parser (lex and yacc phases only)
+ *             Definitions for the "raw" parser (flex and bison phases only)
  *
+ * This is the external API for the raw lexing/parsing functions.
  *
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/parser/parser.h,v 1.25 2009/04/19 21:50:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/parser/parser.h,v 1.26 2009/07/12 17:12:34 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #ifndef PARSER_H
 #define PARSER_H
 
-#include "nodes/pg_list.h"
+#include "nodes/parsenodes.h"
 
+
+typedef enum
+{
+       BACKSLASH_QUOTE_OFF,
+       BACKSLASH_QUOTE_ON,
+       BACKSLASH_QUOTE_SAFE_ENCODING
+} BackslashQuoteType;
+
+/* GUC variables in scan.l (every one of these is a bad idea :-() */
+extern int     backslash_quote;
+extern bool escape_string_warning;
+extern bool standard_conforming_strings;
+
+
+/* Primary entry points for the raw parsing functions */
 extern List *raw_parser(const char *str);
 
 extern char *pg_parse_string_token(const char *token);
 
+/* Utility functions exported by gram.y (perhaps these should be elsewhere) */
+extern List *SystemFuncName(char *name);
+extern TypeName *SystemTypeName(char *name);
+
 #endif   /* PARSER_H */
index 659e797f2cc74c3b4deece4468f5016d04e23c72..1b501d52f162b8cab7ee07378db93ea0eb6eb645 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.136 2009/06/11 14:49:14 momjian Exp $
+ *       $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.137 2009/07/12 17:12:34 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -28,7 +28,6 @@
 #include "catalog/pg_type.h"
 #include "funcapi.h"
 #include "nodes/makefuncs.h"
-#include "parser/gramparse.h"
 #include "parser/parse_type.h"
 #include "tcop/tcopprot.h"
 #include "utils/array.h"