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 */ /* Copyright comment */
%{ %{
...@@ -651,9 +651,11 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); } ...@@ -651,9 +651,11 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
{ {
if (INFORMIX_MODE) if (INFORMIX_MODE)
{ {
/* Informix also has a CLOSE DATABASE command that /*
essantially works like a DISCONNECT CURRENT * Informix also has a CLOSE DATABASE command that
as far as I know. */ * essantially works like a DISCONNECT CURRENT
* as far as I know.
*/
if (pg_strcasecmp($1+strlen("close "), "database") == 0) if (pg_strcasecmp($1+strlen("close "), "database") == 0)
{ {
if (connection) if (connection)
...@@ -833,7 +835,8 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); } ...@@ -833,7 +835,8 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
struct cursor *ptr; struct cursor *ptr;
if ((ptr = add_additional_variables($1, true)) != NULL) 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; ptr->opened = true;
} }
| ECPGPrepare | ECPGPrepare
...@@ -957,112 +960,109 @@ OptRoleList: ...@@ -957,112 +960,109 @@ OptRoleList:
CreateUserStmt: CreateUserStmt:
CREATE USER RoleId opt_with OptRoleList 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 * 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); } { $$ = 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); } { $$ = cat_str(4, make_str("alter role"), $3, make_str("set"), $5); }
| ALTER ROLE RoleId VariableResetStmt | ALTER ROLE RoleId VariableResetStmt
{ $$ = cat_str(3, make_str("alter role"), $3, $4); } { $$ = cat_str(3, make_str("alter role"), $3, $4); }
; ;
/***************************************************************************** /*****************************************************************************
* *
* Alter a postgresql DBMS user * 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); }; { $$ = 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); } { $$ = cat_str(4, make_str("alter user"), $3, make_str("set"), $5); }
| ALTER USER RoleId VariableResetStmt | ALTER USER RoleId VariableResetStmt
{ $$ = cat_str(3, make_str("alter user"), $3, $4); } { $$ = cat_str(3, make_str("alter user"), $3, $4); }
; ;
/***************************************************************************** /*****************************************************************************
* *
* Drop a postgresql DBMS role * Drop a postgresql DBMS role
* *
* *
*****************************************************************************/ *****************************************************************************/
DropRoleStmt: DROP ROLE name_list DropRoleStmt: DROP ROLE name_list
{ $$ = cat2_str(make_str("drop role"), $3);} { $$ = cat2_str(make_str("drop role"), $3);}
; ;
/***************************************************************************** /*****************************************************************************
* *
* Drop a postgresql DBMS user * Drop a postgresql DBMS user
* *
* *
*****************************************************************************/ *****************************************************************************/
DropUserStmt: DROP USER name_list DropUserStmt: DROP USER name_list
{ $$ = cat2_str(make_str("drop user"), $3);} { $$ = cat2_str(make_str("drop user"), $3);}
; ;
/***************************************************************************** /*****************************************************************************
* *
* Create a postgresql group * 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); } { $$ = cat_str(4, make_str("create group"), $3, $4, $5); }
; ;
/***************************************************************************** /*****************************************************************************
* *
* Alter a postgresql group * 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); } { $$ = 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 { $$ = make_str("drop"); }
; ;
/***************************************************************************** /*****************************************************************************
* *
* Drop a postgresql group * Drop a postgresql group
* *
* *
*****************************************************************************/ *****************************************************************************/
DropGroupStmt: DROP GROUP_P name_list DropGroupStmt: DROP GROUP_P name_list
{ $$ = cat2_str(make_str("drop group"), $3); } { $$ = cat2_str(make_str("drop group"), $3); }
; ;
/***************************************************************************** /*****************************************************************************
* *
* Manipulate a schema * 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); } { $$ = cat_str(5, make_str("create schema"), $3, make_str("authorization"), $5, $6); }
| CREATE SCHEMA ColId OptSchemaEltList | CREATE SCHEMA ColId OptSchemaEltList
{ $$ = cat_str(3, make_str("create schema"), $3, $4); } { $$ = cat_str(3, make_str("create schema"), $3, $4); }
; ;
OptSchemaName: ColId { $$ = $1; } OptSchemaName: ColId { $$ = $1; }
| /* EMPTY */ { $$ = EMPTY; } | /* EMPTY */ { $$ = EMPTY; }
; ;
...@@ -1345,9 +1345,7 @@ alter_using: USING a_expr { $$ = cat2_str(make_str("using"), $2); } ...@@ -1345,9 +1345,7 @@ alter_using: USING a_expr { $$ = cat2_str(make_str("using"), $2); }
*****************************************************************************/ *****************************************************************************/
ClosePortalStmt: CLOSE name ClosePortalStmt: CLOSE name
{ { $$ = cat2_str(make_str("close"), $2); }
$$ = cat2_str(make_str("close"), $2);
}
; ;
/***************************************************************************** /*****************************************************************************
...@@ -1469,9 +1467,7 @@ TableElement: columnDef { $$ = $1; } ...@@ -1469,9 +1467,7 @@ TableElement: columnDef { $$ = $1; }
; ;
columnDef: ColId Typename ColQualList columnDef: ColId Typename ColQualList
{ {$$ = cat_str(3, $1, $2, $3); }
$$ = cat_str(3, $1, $2, $3);
}
; ;
ColQualList: ColQualList ColConstraint { $$ = cat2_str($1,$2); } ColQualList: ColQualList ColConstraint { $$ = cat2_str($1,$2); }
...@@ -1529,9 +1525,7 @@ ConstraintAttr: DEFERRABLE { $$ = make_str("deferrable"); } ...@@ -1529,9 +1525,7 @@ ConstraintAttr: DEFERRABLE { $$ = make_str("deferrable"); }
; ;
TableLikeClause: LIKE qualified_name like_including_defaults 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: like_including_defaults:
...@@ -1794,7 +1788,9 @@ OptTableSpaceOwner: OWNER name { $$ = cat2_str(make_str("owner"), $2); } ...@@ -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 ...@@ -1806,13 +1802,11 @@ DropTableSpaceStmt: DROP TABLESPACE name { $$ = cat2_str(make_str("drop tablespa
*****************************************************************************/ *****************************************************************************/
CreateTrigStmt: CREATE TRIGGER name TriggerActionTime TriggerEvents ON CreateTrigStmt: CREATE TRIGGER name TriggerActionTime TriggerEvents ON
qualified_name TriggerForSpec qualified_name TriggerForSpec EXECUTE PROCEDURE name
EXECUTE PROCEDURE '(' TriggerFuncArgs ')'
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(")")); } { $$ = 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 | CREATE CONSTRAINT TRIGGER name AFTER TriggerEvents ON
qualified_name OptConstrFromTable qualified_name OptConstrFromTable ConstraintAttributeSpec
ConstraintAttributeSpec
FOR EACH ROW EXECUTE PROCEDURE FOR EACH ROW EXECUTE PROCEDURE
func_name '(' TriggerFuncArgs ')' 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(")")); } { $$ = 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 ...@@ -2004,16 +1998,12 @@ DropOpClassStmt: DROP OPERATOR CLASS any_name USING access_method opt_drop_behav
*****************************************************************************/ *****************************************************************************/
DropOwnedStmt: DropOwnedStmt:
DROP OWNED BY name_list opt_drop_behavior 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: ReassignOwnedStmt:
REASSIGN OWNED BY name_list TO name 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_ ...@@ -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 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 | 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"); } privileges: ALL PRIVILEGES { $$ = make_str("all privileges"); }
...@@ -3006,7 +2991,6 @@ ExecuteStmt: EXECUTE name execute_param_clause ...@@ -3006,7 +2991,6 @@ ExecuteStmt: EXECUTE name execute_param_clause
{ $$ = cat_str(3, make_str("execute"), $2, $3); } { $$ = cat_str(3, make_str("execute"), $2, $3); }
| CREATE OptTemp TABLE qualified_name OptCreateAs AS EXECUTE name execute_param_clause | 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); } { $$ = 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(")")); } execute_param_clause: '(' expr_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
...@@ -3150,10 +3134,13 @@ cursor_options: /* EMPTY */ { $$ = EMPTY; } ...@@ -3150,10 +3134,13 @@ cursor_options: /* EMPTY */ { $$ = EMPTY; }
| cursor_options NO SCROLL { $$ = cat2_str($1, make_str("no scroll")); } | 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"); $$ = make_str("with hold");
else else
$$ = EMPTY; } $$ = EMPTY;
}
| WITH HOLD { $$ = make_str("with hold"); } | WITH HOLD { $$ = make_str("with hold"); }
| WITHOUT HOLD { $$ = make_str("without hold"); } | WITHOUT HOLD { $$ = make_str("without hold"); }
; ;
...@@ -4837,10 +4824,7 @@ type_declaration: S_TYPEDEF ...@@ -4837,10 +4824,7 @@ type_declaration: S_TYPEDEF
if (($3.type_enum == ECPGt_struct || if (($3.type_enum == ECPGt_struct ||
$3.type_enum == ECPGt_union) && $3.type_enum == ECPGt_union) &&
initializer == 1) initializer == 1)
{
mmerror(PARSE_ERROR, ET_ERROR, "Initializer not allowed in typedef command"); mmerror(PARSE_ERROR, ET_ERROR, "Initializer not allowed in typedef command");
}
else else
{ {
for (ptr = types; ptr != NULL; ptr = ptr->next) for (ptr = types; ptr != NULL; ptr = ptr->next)
...@@ -4914,17 +4898,9 @@ var_declaration: storage_declaration ...@@ -4914,17 +4898,9 @@ var_declaration: storage_declaration
; ;
storage_declaration: storage_clause storage_modifier storage_declaration: storage_clause storage_modifier
{ {$$ = cat2_str ($1, $2); }
$$ = cat2_str ($1, $2); | storage_clause {$$ = $1; }
} | storage_modifier {$$ = $1; }
| storage_clause
{
$$ = $1;
}
| storage_modifier
{
$$ = $1;
}
; ;
storage_clause : S_EXTERN { $$ = make_str("extern"); } storage_clause : S_EXTERN { $$ = make_str("extern"); }
...@@ -5508,6 +5484,7 @@ UsingConst: AllConst ...@@ -5508,6 +5484,7 @@ UsingConst: AllConst
ECPGPrepare: PREPARE prepared_name FROM execstring ECPGPrepare: PREPARE prepared_name FROM execstring
{ $$ = cat_str(3, $2, make_str(","), $4); } { $$ = cat_str(3, $2, make_str(","), $4); }
; ;
/* /*
* We accept descibe but do nothing with it so far. * We accept descibe but do nothing with it so far.
*/ */
...@@ -5548,7 +5525,8 @@ ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar ...@@ -5548,7 +5525,8 @@ ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
{ {
add_descriptor($3,connection); add_descriptor($3,connection);
$$ = $3; $$ = $3;
}; }
;
/* /*
...@@ -6066,8 +6044,7 @@ ECPGunreserved_interval: DAY_P { $$ = make_str("day"); } ...@@ -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 /* The following symbol must be excluded from var_name but still included in ColId
to enable ecpg special postgresql variables with this name: to enable ecpg special postgresql variables with this name: CONNECTION
CONNECTION
*/ */
ECPGunreserved: ECPGunreserved_con { $$ = $1; } ECPGunreserved: ECPGunreserved_con { $$ = $1; }
| CONNECTION { $$ = make_str("connection"); } | CONNECTION { $$ = make_str("connection"); }
...@@ -6493,22 +6470,25 @@ cvariable: CVARIABLE ...@@ -6493,22 +6470,25 @@ cvariable: CVARIABLE
{ {
switch (*ptr) switch (*ptr)
{ {
case '[': if (brace) case '[':
{ if (brace)
mmerror(PARSE_ERROR, ET_FATAL, "No multidimensional array support for simple data types"); mmerror(PARSE_ERROR, ET_FATAL, "No multidimensional array support for simple data types");
}
brace_open++; brace_open++;
break; break;
case ']': brace_open--; case ']':
if (brace_open == 0) brace = true; brace_open--;
if (brace_open == 0)
brace = true;
break; break;
case '\t': case '\t':
case ' ': break; case ' ':
default: if (brace_open == 0) brace = false; break;
default:
if (brace_open == 0)
brace = false;
break; break;
} }
} }
$$ = $1; $$ = $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