1e-fix-shiftreduce-ctxdiff.patch
text/x-patch
Filename: 1e-fix-shiftreduce-ctxdiff.patch
Type: text/x-patch
Part: 4
Message:
Re: CommitFest 2009-09, two weeks on
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/interfaces/ecpg/preproc/ecpg.addons | 48 | 0 |
| src/interfaces/ecpg/preproc/ecpg.trailer | 4 | 0 |
| src/interfaces/ecpg/preproc/ecpg.type | 1 | 0 |
| src/interfaces/ecpg/preproc/parse.pl | 3 | 1 |
diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.addons
*** pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 01:24:46.000000000 +0200
--- pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 01:54:43.000000000 +0200
*************** ECPG: FetchStmtMOVEfetch_args rule
*** 406,411 ****
--- 406,459 ----
{
$$ = cat2_str(make_str("fetch"), $2);
}
+ | FETCH FORWARD cursor_name opt_ecpg_into
+ {
+ char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
+ add_additional_variables($3, false);
+ $$ = cat_str(2, make_str("fetch forward"), cursor_marker);
+ }
+ | FETCH FORWARD from_in cursor_name opt_ecpg_into
+ {
+ char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
+ add_additional_variables($4, false);
+ $$ = cat_str(2, make_str("fetch forward from"), cursor_marker);
+ }
+ | FETCH BACKWARD cursor_name opt_ecpg_into
+ {
+ char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
+ add_additional_variables($3, false);
+ $$ = cat_str(2, make_str("fetch backward"), cursor_marker);
+ }
+ | FETCH BACKWARD from_in cursor_name opt_ecpg_into
+ {
+ char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
+ add_additional_variables($4, false);
+ $$ = cat_str(2, make_str("fetch backward from"), cursor_marker);
+ }
+ | MOVE FORWARD cursor_name
+ {
+ char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
+ add_additional_variables($3, false);
+ $$ = cat_str(2, make_str("move forward"), cursor_marker);
+ }
+ | MOVE FORWARD from_in cursor_name
+ {
+ char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
+ add_additional_variables($4, false);
+ $$ = cat_str(2, make_str("move forward from"), cursor_marker);
+ }
+ | MOVE BACKWARD cursor_name
+ {
+ char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3;
+ add_additional_variables($3, false);
+ $$ = cat_str(2, make_str("move backward"), cursor_marker);
+ }
+ | MOVE BACKWARD from_in cursor_name
+ {
+ char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4;
+ add_additional_variables($4, false);
+ $$ = cat_str(2, make_str("move backward from"), cursor_marker);
+ }
ECPG: SpecialRuleRelationOLD addon
if (!QueryIsRule)
mmerror(PARSE_ERROR, ET_ERROR, "OLD used in query that is not in a rule");
diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer
*** pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:36:36.000000000 +0200
--- pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:42:17.000000000 +0200
*************** ecpg_into: INTO into_list { $$ = EMPTY;
*** 2020,2025 ****
--- 2020,2029 ----
| into_descriptor { $$ = $1; }
;
+ opt_ecpg_into: /* EMPTY */ { $$ = EMPTY; }
+ | ecpg_into { $$ = $1; }
+ ;
+
%%
void base_yyerror(const char *error)
diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type
*** pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:36:11.000000000 +0200
--- pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:41:51.000000000 +0200
***************
*** 76,81 ****
--- 76,82 ----
%type <str> opt_bit_field
%type <str> opt_connection_name
%type <str> opt_database_name
+ %type <str> opt_ecpg_into
%type <str> opt_ecpg_using
%type <str> opt_initializer
%type <str> opt_options
diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/parse.pl pgsql.fixshred/src/interfaces/ecpg/preproc/parse.pl
*** pgsql.dynamiccur/src/interfaces/ecpg/preproc/parse.pl 2009-01-30 17:28:46.000000000 +0100
--- pgsql.fixshred/src/interfaces/ecpg/preproc/parse.pl 2009-10-03 01:54:56.000000000 +0200
*************** $replace_types{'unreserved_keyword'} = '
*** 57,63 ****
$replace_types{'Sconst'} = 'ignore';
# some production rules have to be ignored or replaced
! $replace_line{'fetch_direction'} = 'ignore';
$replace_line{"opt_array_boundsopt_array_bounds'['Iconst']'"} = 'ignore';
$replace_line{'col_name_keywordCHAR_P'} = 'ignore';
$replace_line{'col_name_keywordINT_P'} = 'ignore';
--- 57,65 ----
$replace_types{'Sconst'} = 'ignore';
# some production rules have to be ignored or replaced
! $replace_line{'fetch_args'} = 'ignore';
! $replace_line{'fetch_argsFORWARDopt_from_incursor_name'} = 'ignore';
! $replace_line{'fetch_argsBACKWARDopt_from_incursor_name'} = 'ignore';
$replace_line{"opt_array_boundsopt_array_bounds'['Iconst']'"} = 'ignore';
$replace_line{'col_name_keywordCHAR_P'} = 'ignore';
$replace_line{'col_name_keywordINT_P'} = 'ignore';