Commit 53c15ced authored by Michael Meskes's avatar Michael Meskes

Just intermediate results for backup reasons.

parent 5f5da0a6
......@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.102 2003/02/13 13:11:52 meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.103 2003/02/13 20:37:28 meskes Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -831,8 +831,17 @@ cppline {space}*#(.*\\{space})*.*
i > 0 && isspace((unsigned char) yytext[i]);
i-- )
{}
/* Remove trailing '"' if it exists */
if (yytext[i] == '"')
yytext[i] = '\0';
else
yytext[i+1] = '\0';
/* also remove starting '"' */
if (yytext[0] == '"')
memmove(yytext, yytext+1, strlen(yytext));
yyin = NULL;
for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
{
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.206 2003/01/21 20:01:12 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.207 2003/02/13 20:37:28 meskes Exp $ */
/* Copyright comment */
%{
......@@ -376,7 +376,7 @@ make_name(void)
%type <str> storage_clause opt_initializer c_anything
%type <str> variable_list variable c_thing c_term
%type <str> opt_pointer ECPGDisconnect dis_name storage_modifier
%type <str> stmt ECPGRelease execstring server_name
%type <str> ECPGRelease execstring server_name ECPGVarDeclaration
%type <str> connection_object opt_server opt_port c_stuff c_stuff_item
%type <str> user_name opt_user char_variable ora_user ident opt_reference
%type <str> var_type_declarations quoted_ident_stringvar
......@@ -385,13 +385,13 @@ make_name(void)
%type <str> enum_type civar civarind ECPGCursorStmt ECPGDeallocate
%type <str> ECPGFree ECPGDeclare ECPGVar opt_at enum_definition
%type <str> struct_type s_struct vt_declarations variable_declarations
%type <str> var_declaration type_declaration
%type <str> var_declaration type_declaration single_vt_declaration
%type <str> s_union union_type ECPGSetAutocommit on_off
%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_symbol
%type <str> ECPGGetDescriptorHeader ECPGColLabel
%type <str> ECPGGetDescriptorHeader ECPGColLabel single_var_declaration
%type <str> reserved_keyword unreserved_keyword
%type <str> col_name_keyword func_name_keyword
%type <str> ECPGTypeName variablelist
%type <str> ECPGTypeName variablelist ECPGColLabelCommon
%type <descriptor> ECPGGetDescriptor
......@@ -399,7 +399,7 @@ make_name(void)
%type <dtype_enum> descriptor_item desc_header_item
%type <type> type
%type <type> type common_type single_vt_type
%type <action> action
......@@ -652,6 +652,12 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
output_simple_statement($1);
}
| ECPGVarDeclaration
{
fprintf(yyout, "%s", $1);
free($1);
output_line_number();
}
| ECPGWhenever
{
if (connection)
......@@ -4126,7 +4132,88 @@ ECPGDeallocate: DEALLOCATE PREPARE ident
;
/*
* variable declaration inside the exec sql declare block
* variable decalartion outside exec sql declare block
*/
ECPGVarDeclaration: single_vt_declaration;
single_vt_declaration: type_declaration { $$ = $1; }
| single_var_declaration { $$ = $1; }
;
single_var_declaration: storage_clause storage_modifier
{
actual_storage[struct_level] = cat2_str(mm_strdup($1), mm_strdup($2));
actual_startline[struct_level] = hashline_number();
}
single_vt_type
{
actual_type[struct_level].type_enum = $4.type_enum;
actual_type[struct_level].type_dimension = $4.type_dimension;
actual_type[struct_level].type_index = $4.type_index;
actual_type[struct_level].type_sizeof = $4.type_sizeof;
/* we do not need the string "varchar" for output */
/* so replace it with an empty string */
if ($4.type_enum == ECPGt_varchar)
{
free($4.type_str);
$4.type_str=EMPTY;
}
}
variable_list
{
$$ = cat_str(6, actual_startline[struct_level], $1, $2, $4.type_str, $6, make_str(";\n"));
}
;
single_vt_type: common_type
| ECPGColLabelCommon
{
/*
* Check for type names that the SQL grammar treats as
* unreserved keywords
*/
if (strcmp($1, "varchar") == 0)
{
$$.type_enum = ECPGt_varchar;
$$.type_str = make_str("varchar");
$$.type_dimension = -1;
$$.type_index = -1;
$$.type_sizeof = NULL;
}
else if (strcmp($1, "float") == 0)
{
$$.type_enum = ECPGt_float;
$$.type_str = make_str("float");
$$.type_dimension = -1;
$$.type_index = -1;
$$.type_sizeof = NULL;
}
else if (strcmp($1, "double") == 0)
{
$$.type_enum = ECPGt_double;
$$.type_str = make_str("double");
$$.type_dimension = -1;
$$.type_index = -1;
$$.type_sizeof = NULL;
}
else
{
/* this is for typedef'ed types */
struct typedefs *this = get_typedef($1);
$$.type_str = (this->type->type_enum == ECPGt_varchar) ? EMPTY : mm_strdup(this->name);
$$.type_enum = this->type->type_enum;
$$.type_dimension = this->type->type_dimension;
$$.type_index = this->type->type_index;
$$.type_sizeof = this->type->type_sizeof;
struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
}
}
;
/*
* variable declaration inside exec sql declare block
*/
ECPGDeclaration: sql_startdeclare
{ fputs("/* exec sql begin declare section */", yyout); }
......@@ -4256,7 +4343,7 @@ storage_modifier : S_CONST { $$ = make_str("const"); }
| /*EMPTY*/ { $$ = EMPTY; }
;
type: simple_type
common_type: simple_type
{
$$.type_enum = $1;
$$.type_str = mm_strdup(ECPGtype_name($1));
......@@ -4288,6 +4375,9 @@ type: simple_type
$$.type_index = -1;
$$.type_sizeof = NULL;
}
;
type: common_type
| ECPGColLabel
{
/*
......@@ -5108,15 +5198,17 @@ ColLabel: ECPGColLabel { $$ = $1; }
| UNION { $$ = make_str("union"); }
;
ECPGColLabel: ident { $$ = $1; }
| unreserved_keyword { $$ = $1; }
ECPGColLabelCommon: ident { $$ = $1; }
| col_name_keyword { $$ = $1; }
| func_name_keyword { $$ = $1; }
;
ECPGColLabel: ECPGColLabelCommon { $$ = $1; }
| unreserved_keyword { $$ = $1; }
| reserved_keyword { $$ = $1; }
| ECPGKeywords { $$ = $1; }
;
/*
* Keyword classification lists. Generally, every keyword present in
* the Postgres grammar should appear in exactly one of these lists.
......
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