1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Get rid of last few vestiges of parsetree dependency on grammar token

codes, per discussion from last March.  parse.h should now be included
*only* by gram.y, scan.l, keywords.c, parser.c.  This prevents surprising
misbehavior after seemingly-trivial grammar adjustments.
This commit is contained in:
Tom Lane
2003-02-10 04:44:47 +00:00
parent b5956a2f22
commit c5ba16a83c
13 changed files with 259 additions and 236 deletions

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.242 2003/02/09 06:56:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.243 2003/02/10 04:44:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1198,7 +1198,7 @@ _copyAExpr(A_Expr *from)
{
A_Expr *newnode = makeNode(A_Expr);
COPY_SCALAR_FIELD(oper);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(name);
COPY_NODE_FIELD(lexpr);
COPY_NODE_FIELD(rexpr);
@@ -1669,7 +1669,7 @@ _copyDefineStmt(DefineStmt *from)
{
DefineStmt *newnode = makeNode(DefineStmt);
COPY_SCALAR_FIELD(defType);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(defnames);
COPY_NODE_FIELD(definition);
@@ -1869,7 +1869,7 @@ _copyTransactionStmt(TransactionStmt *from)
{
TransactionStmt *newnode = makeNode(TransactionStmt);
COPY_SCALAR_FIELD(command);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(options);
return newnode;
@@ -2215,7 +2215,7 @@ _copyReindexStmt(ReindexStmt *from)
{
ReindexStmt *newnode = makeNode(ReindexStmt);
COPY_SCALAR_FIELD(reindexType);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(relation);
COPY_STRING_FIELD(name);
COPY_SCALAR_FIELD(force);

View File

@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.185 2003/02/09 06:56:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.186 2003/02/10 04:44:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -730,7 +730,7 @@ _equalCreateStmt(CreateStmt *a, CreateStmt *b)
static bool
_equalDefineStmt(DefineStmt *a, DefineStmt *b)
{
COMPARE_SCALAR_FIELD(defType);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(defnames);
COMPARE_NODE_FIELD(definition);
@@ -898,7 +898,7 @@ _equalUnlistenStmt(UnlistenStmt *a, UnlistenStmt *b)
static bool
_equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
{
COMPARE_SCALAR_FIELD(command);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(options);
return true;
@@ -1187,7 +1187,7 @@ _equalDropGroupStmt(DropGroupStmt *a, DropGroupStmt *b)
static bool
_equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
{
COMPARE_SCALAR_FIELD(reindexType);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(relation);
COMPARE_STRING_FIELD(name);
COMPARE_SCALAR_FIELD(force);
@@ -1276,7 +1276,7 @@ _equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b)
static bool
_equalAExpr(A_Expr *a, A_Expr *b)
{
COMPARE_SCALAR_FIELD(oper);
COMPARE_SCALAR_FIELD(kind);
COMPARE_NODE_FIELD(name);
COMPARE_NODE_FIELD(lexpr);
COMPARE_NODE_FIELD(rexpr);

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.37 2002/12/12 15:49:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.38 2003/02/10 04:44:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,11 +24,11 @@
* makes an A_Expr node
*/
A_Expr *
makeA_Expr(int oper, List *name, Node *lexpr, Node *rexpr)
makeA_Expr(A_Expr_Kind kind, List *name, Node *lexpr, Node *rexpr)
{
A_Expr *a = makeNode(A_Expr);
a->oper = oper;
a->kind = kind;
a->name = name;
a->lexpr = lexpr;
a->rexpr = rexpr;
@@ -40,12 +40,12 @@ makeA_Expr(int oper, List *name, Node *lexpr, Node *rexpr)
* As above, given a simple (unqualified) operator name
*/
A_Expr *
makeSimpleA_Expr(int oper, const char *name,
makeSimpleA_Expr(A_Expr_Kind kind, const char *name,
Node *lexpr, Node *rexpr)
{
A_Expr *a = makeNode(A_Expr);
a->oper = oper;
a->kind = kind;
a->name = makeList1(makeString((char *) name));
a->lexpr = lexpr;
a->rexpr = rexpr;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.198 2003/02/09 06:56:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.199 2003/02/10 04:44:45 tgl Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@@ -27,7 +27,6 @@
#include "nodes/parsenodes.h"
#include "nodes/plannodes.h"
#include "nodes/relation.h"
#include "parser/parse.h"
#include "utils/datum.h"
@@ -1259,19 +1258,27 @@ _outAExpr(StringInfo str, A_Expr *node)
{
WRITE_NODE_TYPE("AEXPR");
switch (node->oper)
switch (node->kind)
{
case AND:
case AEXPR_OP:
appendStringInfo(str, " ");
WRITE_NODE_FIELD(name);
break;
case AEXPR_AND:
appendStringInfo(str, " AND");
break;
case OR:
case AEXPR_OR:
appendStringInfo(str, " OR");
break;
case NOT:
case AEXPR_NOT:
appendStringInfo(str, " NOT");
break;
case OP:
appendStringInfo(str, " ");
case AEXPR_DISTINCT:
appendStringInfo(str, " DISTINCT ");
WRITE_NODE_FIELD(name);
break;
case AEXPR_OF:
appendStringInfo(str, " OF ");
WRITE_NODE_FIELD(name);
break;
default: