Commit d63901c9 authored by Bruce Momjian's avatar Bruce Momjian

Source code alignment fixes for preproc.y.

parent a274239b
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.316 2006/01/24 11:01:37 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.317 2006/02/01 22:16:36 momjian Exp $ */
/* Copyright comment */
%{
......@@ -651,9 +651,11 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
{
if (INFORMIX_MODE)
{
/* Informix also has a CLOSE DATABASE command that
essantially works like a DISCONNECT CURRENT
as far as I know. */
/*
* Informix also has a CLOSE DATABASE command that
* essantially works like a DISCONNECT CURRENT
* as far as I know.
*/
if (pg_strcasecmp($1+strlen("close "), "database") == 0)
{
if (connection)
......@@ -833,7 +835,8 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
struct cursor *ptr;
if ((ptr = add_additional_variables($1, true)) != NULL)
output_statement(mm_strdup(ptr->command), 0, ptr->connection ? mm_strdup(ptr->connection) : NULL);
output_statement(mm_strdup(ptr->command), 0,
ptr->connection ? mm_strdup(ptr->connection) : NULL);
ptr->opened = true;
}
| ECPGPrepare
......@@ -957,112 +960,109 @@ OptRoleList:
CreateUserStmt:
CREATE USER RoleId opt_with OptRoleList
{
$$ = cat_str(4, make_str("create user"), $3, $4, $5);
}
{$$ = cat_str(4, make_str("create user"), $3, $4, $5); }
;
/*****************************************************************************
/*****************************************************************************
*
* Alter a postgresql DBMS role
*
*
*****************************************************************************/
AlterRoleStmt: ALTER ROLE RoleId opt_with OptRoleList
AlterRoleStmt: ALTER ROLE RoleId opt_with OptRoleList
{ $$ = cat_str(4, make_str("alter role"), $3, $4, $5); }
;
AlterRoleSetStmt: ALTER ROLE RoleId SET set_rest
AlterRoleSetStmt: ALTER ROLE RoleId SET set_rest
{ $$ = cat_str(4, make_str("alter role"), $3, make_str("set"), $5); }
| ALTER ROLE RoleId VariableResetStmt
{ $$ = cat_str(3, make_str("alter role"), $3, $4); }
;
/*****************************************************************************
/*****************************************************************************
*
* Alter a postgresql DBMS user
*
*****************************************************************************/
AlterUserStmt: ALTER USER RoleId opt_with OptRoleList
AlterUserStmt: ALTER USER RoleId opt_with OptRoleList
{ $$ = cat_str(4, make_str("alter user"), $3, $4, $5); };
AlterRoleSetStmt: ALTER USER RoleId SET set_rest
AlterRoleSetStmt: ALTER USER RoleId SET set_rest
{ $$ = cat_str(4, make_str("alter user"), $3, make_str("set"), $5); }
| ALTER USER RoleId VariableResetStmt
{ $$ = cat_str(3, make_str("alter user"), $3, $4); }
;
/*****************************************************************************
/*****************************************************************************
*
* Drop a postgresql DBMS role
*
*
*****************************************************************************/
DropRoleStmt: DROP ROLE name_list
DropRoleStmt: DROP ROLE name_list
{ $$ = cat2_str(make_str("drop role"), $3);}
;
/*****************************************************************************
/*****************************************************************************
*
* Drop a postgresql DBMS user
*
*
*****************************************************************************/
DropUserStmt: DROP USER name_list
DropUserStmt: DROP USER name_list
{ $$ = cat2_str(make_str("drop user"), $3);}
;
/*****************************************************************************
/*****************************************************************************
*
* Create a postgresql group
*
*
****************************************************************************/
CreateGroupStmt: CREATE GROUP_P RoleId opt_with OptRoleList
CreateGroupStmt: CREATE GROUP_P RoleId opt_with OptRoleList
{ $$ = cat_str(4, make_str("create group"), $3, $4, $5); }
;
/*****************************************************************************
/*****************************************************************************
*
* Alter a postgresql group
*
*
*****************************************************************************/
AlterGroupStmt: ALTER GROUP_P RoleId add_drop USER name_list
AlterGroupStmt: ALTER GROUP_P RoleId add_drop USER name_list
{ $$ = cat_str(5, make_str("alter group"), $3, $4, make_str("user"), $6); }
;
add_drop: ADD_P { $$ = make_str("add"); }
add_drop: ADD_P { $$ = make_str("add"); }
| DROP { $$ = make_str("drop"); }
;
/*****************************************************************************
/*****************************************************************************
*
* Drop a postgresql group
*
*
*****************************************************************************/
DropGroupStmt: DROP GROUP_P name_list
DropGroupStmt: DROP GROUP_P name_list
{ $$ = cat2_str(make_str("drop group"), $3); }
;
/*****************************************************************************
/*****************************************************************************
*
* Manipulate a schema
*
*
*****************************************************************************/
CreateSchemaStmt: CREATE SCHEMA OptSchemaName AUTHORIZATION RoleId OptSchemaEltList
CreateSchemaStmt: CREATE SCHEMA OptSchemaName AUTHORIZATION RoleId OptSchemaEltList
{ $$ = cat_str(5, make_str("create schema"), $3, make_str("authorization"), $5, $6); }
| CREATE SCHEMA ColId OptSchemaEltList
{ $$ = cat_str(3, make_str("create schema"), $3, $4); }
;
OptSchemaName: ColId { $$ = $1; }
OptSchemaName: ColId { $$ = $1; }
| /* EMPTY */ { $$ = EMPTY; }
;
......@@ -1345,9 +1345,7 @@ alter_using: USING a_expr { $$ = cat2_str(make_str("using"), $2); }
*****************************************************************************/
ClosePortalStmt: CLOSE name
{
$$ = cat2_str(make_str("close"), $2);
}
{ $$ = cat2_str(make_str("close"), $2); }
;
/*****************************************************************************
......@@ -1469,9 +1467,7 @@ TableElement: columnDef { $$ = $1; }
;
columnDef: ColId Typename ColQualList
{
$$ = cat_str(3, $1, $2, $3);
}
{$$ = cat_str(3, $1, $2, $3); }
;
ColQualList: ColQualList ColConstraint { $$ = cat2_str($1,$2); }
......@@ -1529,9 +1525,7 @@ ConstraintAttr: DEFERRABLE { $$ = make_str("deferrable"); }
;
TableLikeClause: LIKE qualified_name like_including_defaults
{
$$ = cat_str(3, make_str("like"), $2, $3);
}
{$$ = cat_str(3, make_str("like"), $2, $3); }
;
like_including_defaults:
......@@ -1794,7 +1788,9 @@ OptTableSpaceOwner: OWNER name { $$ = cat2_str(make_str("owner"), $2); }
****************************************************************************/
DropTableSpaceStmt: DROP TABLESPACE name { $$ = cat2_str(make_str("drop tablespace"), $3); };
DropTableSpaceStmt: DROP TABLESPACE name
{ $$ = cat2_str(make_str("drop tablespace"), $3); }
;
/*****************************************************************************
......@@ -1806,13 +1802,11 @@ DropTableSpaceStmt: DROP TABLESPACE name { $$ = cat2_str(make_str("drop tablespa
*****************************************************************************/
CreateTrigStmt: CREATE TRIGGER name TriggerActionTime TriggerEvents ON
qualified_name TriggerForSpec
EXECUTE PROCEDURE
name '(' TriggerFuncArgs ')'
qualified_name TriggerForSpec EXECUTE PROCEDURE name
'(' TriggerFuncArgs ')'
{ $$ = cat_str(12, make_str("create trigger"), $3, $4, $5, make_str("on"), $7, $8, make_str("execute procedure"), $11, make_str("("), $13, make_str(")")); }
| CREATE CONSTRAINT TRIGGER name AFTER TriggerEvents ON
qualified_name OptConstrFromTable
ConstraintAttributeSpec
qualified_name OptConstrFromTable ConstraintAttributeSpec
FOR EACH ROW EXECUTE PROCEDURE
func_name '(' TriggerFuncArgs ')'
{ $$ = cat_str(13, make_str("create constraint trigger"), $4, make_str("after"), $6, make_str("on"), $8, $9, $10, make_str("for each row execute procedure"), $16, make_str("("), $18, make_str(")")); }
......@@ -2004,16 +1998,12 @@ DropOpClassStmt: DROP OPERATOR CLASS any_name USING access_method opt_drop_behav
*****************************************************************************/
DropOwnedStmt:
DROP OWNED BY name_list opt_drop_behavior
{
$$ = cat_str(3, make_str("drop owned by"), $4, $5);
}
{$$ = cat_str(3, make_str("drop owned by"), $4, $5); }
;
ReassignOwnedStmt:
REASSIGN OWNED BY name_list TO name
{
$$ = cat_str(4, make_str("reassign owned by"), $4, make_str("to"), $6);
}
{$$ = cat_str(4, make_str("reassign owned by"), $4, make_str("to"), $6); }
;
/*****************************************************************************
......@@ -2193,14 +2183,9 @@ GrantStmt: GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_
;
RevokeStmt: REVOKE privileges ON privilege_target FROM grantee_list opt_drop_behavior
{
$$ = cat_str(7, make_str("revoke"), $2, make_str("on"), $4, make_str("from"), $6, $7);
}
{$$ = cat_str(7, make_str("revoke"), $2, make_str("on"), $4, make_str("from"), $6, $7); }
| REVOKE GRANT OPTION FOR privileges ON privilege_target FROM grantee_list opt_drop_behavior
{
$$ = cat_str(7, make_str("revoke grant option for"), $5, make_str("on"), $7, make_str("from"), $9, $10);
}
{$$ = cat_str(7, make_str("revoke grant option for"), $5, make_str("on"), $7, make_str("from"), $9, $10); }
;
privileges: ALL PRIVILEGES { $$ = make_str("all privileges"); }
......@@ -3006,7 +2991,6 @@ ExecuteStmt: EXECUTE name execute_param_clause
{ $$ = cat_str(3, make_str("execute"), $2, $3); }
| CREATE OptTemp TABLE qualified_name OptCreateAs AS EXECUTE name execute_param_clause
{ $$ = cat_str(8, make_str("create"), $2, make_str("table"), $4, $5, make_str("as execute"), $8, $9); }
;
execute_param_clause: '(' expr_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
......@@ -3150,10 +3134,13 @@ cursor_options: /* EMPTY */ { $$ = EMPTY; }
| cursor_options NO SCROLL { $$ = cat2_str($1, make_str("no scroll")); }
;
opt_hold: /* EMPTY */ { if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true)
opt_hold: /* EMPTY */
{
if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true)
$$ = make_str("with hold");
else
$$ = EMPTY; }
$$ = EMPTY;
}
| WITH HOLD { $$ = make_str("with hold"); }
| WITHOUT HOLD { $$ = make_str("without hold"); }
;
......@@ -4837,10 +4824,7 @@ type_declaration: S_TYPEDEF
if (($3.type_enum == ECPGt_struct ||
$3.type_enum == ECPGt_union) &&
initializer == 1)
{
mmerror(PARSE_ERROR, ET_ERROR, "Initializer not allowed in typedef command");
}
else
{
for (ptr = types; ptr != NULL; ptr = ptr->next)
......@@ -4914,17 +4898,9 @@ var_declaration: storage_declaration
;
storage_declaration: storage_clause storage_modifier
{
$$ = cat2_str ($1, $2);
}
| storage_clause
{
$$ = $1;
}
| storage_modifier
{
$$ = $1;
}
{$$ = cat2_str ($1, $2); }
| storage_clause {$$ = $1; }
| storage_modifier {$$ = $1; }
;
storage_clause : S_EXTERN { $$ = make_str("extern"); }
......@@ -5508,6 +5484,7 @@ UsingConst: AllConst
ECPGPrepare: PREPARE prepared_name FROM execstring
{ $$ = cat_str(3, $2, make_str(","), $4); }
;
/*
* We accept descibe but do nothing with it so far.
*/
......@@ -5548,7 +5525,8 @@ ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
{
add_descriptor($3,connection);
$$ = $3;
};
}
;
/*
......@@ -6066,8 +6044,7 @@ ECPGunreserved_interval: DAY_P { $$ = make_str("day"); }
;
/* The following symbol must be excluded from var_name but still included in ColId
to enable ecpg special postgresql variables with this name:
CONNECTION
to enable ecpg special postgresql variables with this name: CONNECTION
*/
ECPGunreserved: ECPGunreserved_con { $$ = $1; }
| CONNECTION { $$ = make_str("connection"); }
......@@ -6493,22 +6470,25 @@ cvariable: CVARIABLE
{
switch (*ptr)
{
case '[': if (brace)
{
case '[':
if (brace)
mmerror(PARSE_ERROR, ET_FATAL, "No multidimensional array support for simple data types");
}
brace_open++;
break;
case ']': brace_open--;
if (brace_open == 0) brace = true;
case ']':
brace_open--;
if (brace_open == 0)
brace = true;
break;
case '\t':
case ' ': break;
default: if (brace_open == 0) brace = false;
case ' ':
break;
default:
if (brace_open == 0)
brace = false;
break;
}
}
$$ = $1;
}
;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment