Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53c15ce

Browse files
author
Michael Meskes
committed
Just intermediate results for backup reasons.
1 parent5f5da0a commit53c15ce

File tree

2 files changed

+117
-16
lines changed

2 files changed

+117
-16
lines changed

‎src/interfaces/ecpg/preproc/pgc.l

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.102 2003/02/1313:11:52 meskes Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.103 2003/02/1320:37:28 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -831,7 +831,16 @@ cppline{space}*#(.*\\{space})*.*
831831
i >0 &&isspace((unsignedchar) yytext[i]);
832832
i-- )
833833
{}
834-
yytext[i+1] ='\0';
834+
835+
/* Remove trailing '"' if it exists */
836+
if (yytext[i] =='"')
837+
yytext[i] ='\0';
838+
else
839+
yytext[i+1] ='\0';
840+
841+
/* also remove starting '"' */
842+
if (yytext[0] =='"')
843+
memmove(yytext, yytext+1,strlen(yytext));
835844

836845
yyin =NULL;
837846
for (ip = include_paths; yyin ==NULL && ip !=NULL; ip = ip->next)

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 106 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.206 2003/01/21 20:01:12 meskes Exp $*/
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.207 2003/02/13 20:37:28 meskes Exp $*/
22

33
/* Copyright comment*/
44
%{
@@ -376,7 +376,7 @@ make_name(void)
376376
%type<str>storage_clauseopt_initializerc_anything
377377
%type<str>variable_listvariablec_thingc_term
378378
%type<str>opt_pointerECPGDisconnectdis_namestorage_modifier
379-
%type<str>stmtECPGReleaseexecstringserver_name
379+
%type<str>ECPGReleaseexecstringserver_nameECPGVarDeclaration
380380
%type<str>connection_objectopt_serveropt_portc_stuffc_stuff_item
381381
%type<str>user_nameopt_userchar_variableora_useridentopt_reference
382382
%type<str>var_type_declarationsquoted_ident_stringvar
@@ -385,21 +385,21 @@ make_name(void)
385385
%type<str>enum_typecivarcivarindECPGCursorStmtECPGDeallocate
386386
%type<str>ECPGFreeECPGDeclareECPGVaropt_atenum_definition
387387
%type<str>struct_types_structvt_declarationsvariable_declarations
388-
%type<str>var_declarationtype_declaration
388+
%type<str>var_declarationtype_declarationsingle_vt_declaration
389389
%type<str>s_unionunion_typeECPGSetAutocommiton_off
390390
%type<str>ECPGAllocateDescrECPGDeallocateDescrsymbolopt_symbol
391-
%type<str>ECPGGetDescriptorHeaderECPGColLabel
391+
%type<str>ECPGGetDescriptorHeaderECPGColLabelsingle_var_declaration
392392
%type<str>reserved_keywordunreserved_keyword
393393
%type<str>col_name_keywordfunc_name_keyword
394-
%type<str>ECPGTypeNamevariablelist
394+
%type<str>ECPGTypeNamevariablelistECPGColLabelCommon
395395

396396
%type<descriptor>ECPGGetDescriptor
397397

398398
%type<type_enum>simple_typesigned_typeunsigned_type
399399

400400
%type<dtype_enum>descriptor_itemdesc_header_item
401401

402-
%type<type>type
402+
%type<type>typecommon_typesingle_vt_type
403403

404404
%type<action>action
405405

@@ -652,6 +652,12 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
652652

653653
output_simple_statement($1);
654654
}
655+
|ECPGVarDeclaration
656+
{
657+
fprintf(yyout,"%s", $1);
658+
free($1);
659+
output_line_number();
660+
}
655661
|ECPGWhenever
656662
{
657663
if (connection)
@@ -4125,8 +4131,89 @@ ECPGDeallocate: DEALLOCATE PREPARE ident
41254131
{$$ = cat_str(2, make_str("ECPGdeallocate(__LINE__,\""),$2, make_str("\");")); }
41264132
;
41274133

4134+
/*
4135+
* variable decalartion outside exec sql declare block
4136+
*/
4137+
ECPGVarDeclaration:single_vt_declaration;
4138+
4139+
single_vt_declaration:type_declaration{$$ =$1; }
4140+
|single_var_declaration{$$ =$1; }
4141+
;
4142+
4143+
single_var_declaration:storage_clausestorage_modifier
4144+
{
4145+
actual_storage[struct_level] = cat2_str(mm_strdup($1), mm_strdup($2));
4146+
actual_startline[struct_level] = hashline_number();
4147+
}
4148+
single_vt_type
4149+
{
4150+
actual_type[struct_level].type_enum =$4.type_enum;
4151+
actual_type[struct_level].type_dimension =$4.type_dimension;
4152+
actual_type[struct_level].type_index =$4.type_index;
4153+
actual_type[struct_level].type_sizeof =$4.type_sizeof;
4154+
4155+
/* we do not need the string "varchar" for output*/
4156+
/* so replace it with an empty string*/
4157+
if ($4.type_enum == ECPGt_varchar)
4158+
{
4159+
free($4.type_str);
4160+
$4.type_str=EMPTY;
4161+
}
4162+
}
4163+
variable_list
4164+
{
4165+
$$ = cat_str(6, actual_startline[struct_level],$1,$2,$4.type_str,$6, make_str(";\n"));
4166+
}
4167+
;
4168+
4169+
single_vt_type:common_type
4170+
|ECPGColLabelCommon
4171+
{
4172+
/*
4173+
* Check for type names that the SQL grammar treats as
4174+
* unreserved keywords
4175+
*/
4176+
if (strcmp($1,"varchar") ==0)
4177+
{
4178+
$$.type_enum = ECPGt_varchar;
4179+
$$.type_str = make_str("varchar");
4180+
$$.type_dimension = -1;
4181+
$$.type_index = -1;
4182+
$$.type_sizeof =NULL;
4183+
}
4184+
elseif (strcmp($1,"float") ==0)
4185+
{
4186+
$$.type_enum = ECPGt_float;
4187+
$$.type_str = make_str("float");
4188+
$$.type_dimension = -1;
4189+
$$.type_index = -1;
4190+
$$.type_sizeof =NULL;
4191+
}
4192+
elseif (strcmp($1,"double") ==0)
4193+
{
4194+
$$.type_enum = ECPGt_double;
4195+
$$.type_str = make_str("double");
4196+
$$.type_dimension = -1;
4197+
$$.type_index = -1;
4198+
$$.type_sizeof =NULL;
4199+
}
4200+
else
4201+
{
4202+
/* this is for typedef'ed types*/
4203+
structtypedefs *this = get_typedef($1);
4204+
4205+
$$.type_str = (this->type->type_enum == ECPGt_varchar) ? EMPTY : mm_strdup(this->name);
4206+
$$.type_enum =this->type->type_enum;
4207+
$$.type_dimension =this->type->type_dimension;
4208+
$$.type_index =this->type->type_index;
4209+
$$.type_sizeof =this->type->type_sizeof;
4210+
struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
4211+
}
4212+
}
4213+
;
4214+
41284215
/*
4129-
* variable declaration insidetheexec sql declare block
4216+
* variable declaration inside exec sql declare block
41304217
*/
41314218
ECPGDeclaration:sql_startdeclare
41324219
{ fputs("/* exec sql begin declare section */", yyout); }
@@ -4256,7 +4343,7 @@ storage_modifier : S_CONST{ $$ = make_str("const"); }
42564343
|/*EMPTY*/{$$ = EMPTY; }
42574344
;
42584345

4259-
type:simple_type
4346+
common_type:simple_type
42604347
{
42614348
$$.type_enum =$1;
42624349
$$.type_str = mm_strdup(ECPGtype_name($1));
@@ -4288,6 +4375,9 @@ type: simple_type
42884375
$$.type_index = -1;
42894376
$$.type_sizeof =NULL;
42904377
}
4378+
;
4379+
4380+
type:common_type
42914381
|ECPGColLabel
42924382
{
42934383
/*
@@ -5108,15 +5198,17 @@ ColLabel: ECPGColLabel{ $$ = $1; }
51085198
|UNION{$$ = make_str("union"); }
51095199
;
51105200

5111-
ECPGColLabel:ident{$$ =$1; }
5201+
ECPGColLabelCommon:ident {$$ =$1; }
5202+
|col_name_keyword {$$ =$1; }
5203+
|func_name_keyword {$$ =$1; }
5204+
;
5205+
5206+
ECPGColLabel:ECPGColLabelCommon{$$ =$1; }
51125207
|unreserved_keyword{$$ =$1; }
5113-
|col_name_keyword{$$ =$1; }
5114-
|func_name_keyword{$$ =$1; }
5115-
|reserved_keyword{$$ =$1; }
5116-
|ECPGKeywords{$$ =$1; }
5208+
|reserved_keyword{$$ =$1; }
5209+
|ECPGKeywords{$$ =$1; }
51175210
;
51185211

5119-
51205212
/*
51215213
* Keyword classification lists. Generally, every keyword present in
51225214
* the Postgres grammar should appear in exactly one of these lists.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp