Commit 654e1f96 authored by Peter Eisentraut's avatar Peter Eisentraut

Clean up whitespace and indentation in parser and scanner files

These are not touched by pgindent, so clean them up a bit manually.
parent f3ebaad4
...@@ -47,165 +47,167 @@ static NDBOX * write_point_as_box(char *s, int dim); ...@@ -47,165 +47,167 @@ static NDBOX * write_point_as_box(char *s, int dim);
/* Grammar follows */ /* Grammar follows */
%% %%
box: box: O_BRACKET paren_list COMMA paren_list C_BRACKET
O_BRACKET paren_list COMMA paren_list C_BRACKET { {
int dim;
int dim;
dim = delim_count($2, ',') + 1;
dim = delim_count($2, ',') + 1; if ((delim_count($4, ',') + 1) != dim)
if ( (delim_count($4, ',') + 1) != dim ) { {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"), errmsg("bad cube representation"),
errdetail("Different point dimensions in (%s) and (%s).", errdetail("Different point dimensions in (%s) and (%s).",
$2, $4))); $2, $4)));
YYABORT; YYABORT;
} }
if (dim > CUBE_MAX_DIM) { if (dim > CUBE_MAX_DIM) {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"), errmsg("bad cube representation"),
errdetail("A cube cannot have more than %d dimensions.", errdetail("A cube cannot have more than %d dimensions.",
CUBE_MAX_DIM))); CUBE_MAX_DIM)));
YYABORT; YYABORT;
} }
*((void **)result) = write_box( dim, $2, $4 ); *((void **)result) = write_box( dim, $2, $4 );
} }
|
paren_list COMMA paren_list { | paren_list COMMA paren_list
int dim; {
int dim;
dim = delim_count($1, ',') + 1;
dim = delim_count($1, ',') + 1;
if ( (delim_count($3, ',') + 1) != dim ) {
ereport(ERROR, if ( (delim_count($3, ',') + 1) != dim ) {
(errcode(ERRCODE_SYNTAX_ERROR), ereport(ERROR,
errmsg("bad cube representation"), (errcode(ERRCODE_SYNTAX_ERROR),
errdetail("Different point dimensions in (%s) and (%s).", errmsg("bad cube representation"),
$1, $3))); errdetail("Different point dimensions in (%s) and (%s).",
YYABORT; $1, $3)));
} YYABORT;
if (dim > CUBE_MAX_DIM) { }
ereport(ERROR, if (dim > CUBE_MAX_DIM) {
(errcode(ERRCODE_SYNTAX_ERROR), ereport(ERROR,
errmsg("bad cube representation"), (errcode(ERRCODE_SYNTAX_ERROR),
errdetail("A cube cannot have more than %d dimensions.", errmsg("bad cube representation"),
CUBE_MAX_DIM))); errdetail("A cube cannot have more than %d dimensions.",
YYABORT; CUBE_MAX_DIM)));
} YYABORT;
}
*((void **)result) = write_box( dim, $1, $3 );
} *((void **)result) = write_box( dim, $1, $3 );
| }
paren_list { | paren_list
int dim; {
int dim;
dim = delim_count($1, ',') + 1;
if (dim > CUBE_MAX_DIM) { dim = delim_count($1, ',') + 1;
ereport(ERROR, if (dim > CUBE_MAX_DIM) {
(errcode(ERRCODE_SYNTAX_ERROR), ereport(ERROR,
errmsg("bad cube representation"), (errcode(ERRCODE_SYNTAX_ERROR),
errdetail("A cube cannot have more than %d dimensions.", errmsg("bad cube representation"),
CUBE_MAX_DIM))); errdetail("A cube cannot have more than %d dimensions.",
YYABORT; CUBE_MAX_DIM)));
} YYABORT;
}
*((void **)result) = write_point_as_box($1, dim);
} *((void **)result) = write_point_as_box($1, dim);
}
|
| list
list { {
int dim; int dim;
dim = delim_count($1, ',') + 1; dim = delim_count($1, ',') + 1;
if (dim > CUBE_MAX_DIM) { if (dim > CUBE_MAX_DIM) {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("bad cube representation"), errmsg("bad cube representation"),
errdetail("A cube cannot have more than %d dimensions.", errdetail("A cube cannot have more than %d dimensions.",
CUBE_MAX_DIM))); CUBE_MAX_DIM)));
YYABORT; YYABORT;
} }
*((void **)result) = write_point_as_box($1, dim); *((void **)result) = write_point_as_box($1, dim);
} }
; ;
paren_list: paren_list: O_PAREN list C_PAREN
O_PAREN list C_PAREN { {
$$ = $2; $$ = $2;
} }
; ;
list: list: CUBEFLOAT
CUBEFLOAT { {
/* alloc enough space to be sure whole list will fit */ /* alloc enough space to be sure whole list will fit */
$$ = palloc(scanbuflen + 1); $$ = palloc(scanbuflen + 1);
strcpy($$, $1); strcpy($$, $1);
} }
| | list COMMA CUBEFLOAT
list COMMA CUBEFLOAT { {
$$ = $1; $$ = $1;
strcat($$, ","); strcat($$, ",");
strcat($$, $3); strcat($$, $3);
} }
; ;
%% %%
static int static int
delim_count(char *s, char delim) delim_count(char *s, char delim)
{ {
int ndelim = 0; int ndelim = 0;
while ((s = strchr(s, delim)) != NULL) while ((s = strchr(s, delim)) != NULL)
{ {
ndelim++; ndelim++;
s++; s++;
} }
return (ndelim); return (ndelim);
} }
static NDBOX * static NDBOX *
write_box(unsigned int dim, char *str1, char *str2) write_box(unsigned int dim, char *str1, char *str2)
{ {
NDBOX * bp; NDBOX *bp;
char * s; char *s;
int i; int i;
int size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2; int size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
bp = palloc0(size); bp = palloc0(size);
SET_VARSIZE(bp, size); SET_VARSIZE(bp, size);
bp->dim = dim; bp->dim = dim;
s = str1; s = str1;
bp->x[i=0] = strtod(s, NULL); bp->x[i=0] = strtod(s, NULL);
while ((s = strchr(s, ',')) != NULL) { while ((s = strchr(s, ',')) != NULL)
s++; i++; {
bp->x[i] = strtod(s, NULL); s++; i++;
} bp->x[i] = strtod(s, NULL);
}
s = str2;
bp->x[i=dim] = strtod(s, NULL); s = str2;
while ((s = strchr(s, ',')) != NULL) { bp->x[i=dim] = strtod(s, NULL);
s++; i++; while ((s = strchr(s, ',')) != NULL)
bp->x[i] = strtod(s, NULL); {
} s++; i++;
bp->x[i] = strtod(s, NULL);
return(bp); }
return(bp);
} }
static NDBOX * static NDBOX *
write_point_as_box(char *str, int dim) write_point_as_box(char *str, int dim)
{ {
NDBOX * bp; NDBOX *bp;
int i, size; int i,
double x; size;
char * s = str; double x;
char *s = str;
size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2; size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
...@@ -217,11 +219,12 @@ write_point_as_box(char *str, int dim) ...@@ -217,11 +219,12 @@ write_point_as_box(char *str, int dim)
x = strtod(s, NULL); x = strtod(s, NULL);
bp->x[0] = x; bp->x[0] = x;
bp->x[dim] = x; bp->x[dim] = x;
while ((s = strchr(s, ',')) != NULL) { while ((s = strchr(s, ',')) != NULL)
s++; i++; {
x = strtod(s, NULL); s++; i++;
bp->x[i] = x; x = strtod(s, NULL);
bp->x[i+dim] = x; bp->x[i] = x;
bp->x[i+dim] = x;
} }
return(bp); return(bp);
......
...@@ -20,22 +20,22 @@ ...@@ -20,22 +20,22 @@
#define YYMALLOC palloc #define YYMALLOC palloc
#define YYFREE pfree #define YYFREE pfree
extern int seg_yylex(void); extern int seg_yylex(void);
extern int significant_digits(char *str); /* defined in seg.c */ extern int significant_digits(char *str); /* defined in seg.c */
void seg_yyerror(const char *message); void seg_yyerror(const char *message);
int seg_yyparse(void *result); int seg_yyparse(void *result);
static float seg_atof(char *value); static float seg_atof(char *value);
static char strbuf[25] = { static char strbuf[25] = {
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '\0' '0', '0', '0', '0', '\0'
}; };
%} %}
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
%name-prefix="seg_yy" %name-prefix="seg_yy"
%union { %union {
struct BND { struct BND {
float val; float val;
char ext; char ext;
char sigd; char sigd;
} bnd; } bnd;
char * text; char * text;
} }
%token <text> SEGFLOAT %token <text> SEGFLOAT
%token <text> RANGE %token <text> RANGE
...@@ -63,90 +63,94 @@ ...@@ -63,90 +63,94 @@
%% %%
range: range: boundary PLUMIN deviation
boundary PLUMIN deviation { {
((SEG *)result)->lower = $1.val - $3.val; ((SEG *)result)->lower = $1.val - $3.val;
((SEG *)result)->upper = $1.val + $3.val; ((SEG *)result)->upper = $1.val + $3.val;
sprintf(strbuf, "%g", ((SEG *)result)->lower); sprintf(strbuf, "%g", ((SEG *)result)->lower);
((SEG *)result)->l_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd)); ((SEG *)result)->l_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
sprintf(strbuf, "%g", ((SEG *)result)->upper); sprintf(strbuf, "%g", ((SEG *)result)->upper);
((SEG *)result)->u_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd)); ((SEG *)result)->u_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
((SEG *)result)->l_ext = '\0'; ((SEG *)result)->l_ext = '\0';
((SEG *)result)->u_ext = '\0'; ((SEG *)result)->u_ext = '\0';
} }
|
boundary RANGE boundary { | boundary RANGE boundary
((SEG *)result)->lower = $1.val; {
((SEG *)result)->upper = $3.val; ((SEG *)result)->lower = $1.val;
if ( ((SEG *)result)->lower > ((SEG *)result)->upper ) { ((SEG *)result)->upper = $3.val;
ereport(ERROR, if ( ((SEG *)result)->lower > ((SEG *)result)->upper ) {
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), ereport(ERROR,
errmsg("swapped boundaries: %g is greater than %g", (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
((SEG *)result)->lower, ((SEG *)result)->upper))); errmsg("swapped boundaries: %g is greater than %g",
((SEG *)result)->lower, ((SEG *)result)->upper)));
YYERROR;
} YYERROR;
((SEG *)result)->l_sigd = $1.sigd; }
((SEG *)result)->u_sigd = $3.sigd; ((SEG *)result)->l_sigd = $1.sigd;
((SEG *)result)->l_ext = ( $1.ext ? $1.ext : '\0' ); ((SEG *)result)->u_sigd = $3.sigd;
((SEG *)result)->u_ext = ( $3.ext ? $3.ext : '\0' ); ((SEG *)result)->l_ext = ( $1.ext ? $1.ext : '\0' );
} ((SEG *)result)->u_ext = ( $3.ext ? $3.ext : '\0' );
| }
boundary RANGE {
((SEG *)result)->lower = $1.val; | boundary RANGE
((SEG *)result)->upper = HUGE_VAL; {
((SEG *)result)->l_sigd = $1.sigd; ((SEG *)result)->lower = $1.val;
((SEG *)result)->u_sigd = 0; ((SEG *)result)->upper = HUGE_VAL;
((SEG *)result)->l_ext = ( $1.ext ? $1.ext : '\0' ); ((SEG *)result)->l_sigd = $1.sigd;
((SEG *)result)->u_ext = '-'; ((SEG *)result)->u_sigd = 0;
} ((SEG *)result)->l_ext = ( $1.ext ? $1.ext : '\0' );
| ((SEG *)result)->u_ext = '-';
RANGE boundary { }
((SEG *)result)->lower = -HUGE_VAL;
((SEG *)result)->upper = $2.val; | RANGE boundary
((SEG *)result)->l_sigd = 0; {
((SEG *)result)->u_sigd = $2.sigd; ((SEG *)result)->lower = -HUGE_VAL;
((SEG *)result)->l_ext = '-'; ((SEG *)result)->upper = $2.val;
((SEG *)result)->u_ext = ( $2.ext ? $2.ext : '\0' ); ((SEG *)result)->l_sigd = 0;
} ((SEG *)result)->u_sigd = $2.sigd;
| ((SEG *)result)->l_ext = '-';
boundary { ((SEG *)result)->u_ext = ( $2.ext ? $2.ext : '\0' );
((SEG *)result)->lower = ((SEG *)result)->upper = $1.val; }
((SEG *)result)->l_sigd = ((SEG *)result)->u_sigd = $1.sigd;
((SEG *)result)->l_ext = ((SEG *)result)->u_ext = ( $1.ext ? $1.ext : '\0' ); | boundary
} {
; ((SEG *)result)->lower = ((SEG *)result)->upper = $1.val;
((SEG *)result)->l_sigd = ((SEG *)result)->u_sigd = $1.sigd;
boundary: ((SEG *)result)->l_ext = ((SEG *)result)->u_ext = ( $1.ext ? $1.ext : '\0' );
SEGFLOAT { }
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */ ;
float val = seg_atof($1);
boundary: SEGFLOAT
$$.ext = '\0'; {
$$.sigd = significant_digits($1); /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
$$.val = val; float val = seg_atof($1);
}
| $$.ext = '\0';
EXTENSION SEGFLOAT { $$.sigd = significant_digits($1);
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */ $$.val = val;
float val = seg_atof($2); }
| EXTENSION SEGFLOAT
$$.ext = $1[0]; {
$$.sigd = significant_digits($2); /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
$$.val = val; float val = seg_atof($2);
}
; $$.ext = $1[0];
$$.sigd = significant_digits($2);
deviation: $$.val = val;
SEGFLOAT { }
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */ ;
float val = seg_atof($1);
deviation: SEGFLOAT
$$.ext = '\0'; {
$$.sigd = significant_digits($1); /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
$$.val = val; float val = seg_atof($1);
}
; $$.ext = '\0';
$$.sigd = significant_digits($1);
$$.val = val;
}
;
%% %%
......
This diff is collapsed.
...@@ -122,7 +122,7 @@ base_backup: ...@@ -122,7 +122,7 @@ base_backup:
; ;
base_backup_opt_list: base_backup_opt_list base_backup_opt { $$ = lappend($1, $2); } base_backup_opt_list: base_backup_opt_list base_backup_opt { $$ = lappend($1, $2); }
| /* EMPTY */ { $$ = NIL; } | /* EMPTY */ { $$ = NIL; }
base_backup_opt: base_backup_opt:
K_LABEL SCONST K_LABEL SCONST
......
...@@ -112,13 +112,13 @@ START_REPLICATION { return K_START_REPLICATION; } ...@@ -112,13 +112,13 @@ START_REPLICATION { return K_START_REPLICATION; }
static void static void
startlit(void) startlit(void)
{ {
initStringInfo(&litbuf); initStringInfo(&litbuf);
} }
static char * static char *
litbufdup(void) litbufdup(void)
{ {
return litbuf.data; return litbuf.data;
} }
static void static void
...@@ -130,13 +130,13 @@ addlit(char *ytext, int yleng) ...@@ -130,13 +130,13 @@ addlit(char *ytext, int yleng)
static void static void
addlitchar(unsigned char ychar) addlitchar(unsigned char ychar)
{ {
appendStringInfoChar(&litbuf, ychar); appendStringInfoChar(&litbuf, ychar);
} }
void void
yyerror(const char *message) yyerror(const char *message)
{ {
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg_internal("%s", message))); errmsg_internal("%s", message)));
} }
......
...@@ -55,41 +55,41 @@ static char *GUC_scanstr(const char *s); ...@@ -55,41 +55,41 @@ static char *GUC_scanstr(const char *s);
%option prefix="GUC_yy" %option prefix="GUC_yy"
SIGN ("-"|"+") SIGN ("-"|"+")
DIGIT [0-9] DIGIT [0-9]
HEXDIGIT [0-9a-fA-F] HEXDIGIT [0-9a-fA-F]
UNIT_LETTER [a-zA-Z] UNIT_LETTER [a-zA-Z]
INTEGER {SIGN}?({DIGIT}+|0x{HEXDIGIT}+){UNIT_LETTER}* INTEGER {SIGN}?({DIGIT}+|0x{HEXDIGIT}+){UNIT_LETTER}*
EXPONENT [Ee]{SIGN}?{DIGIT}+ EXPONENT [Ee]{SIGN}?{DIGIT}+
REAL {SIGN}?{DIGIT}*"."{DIGIT}*{EXPONENT}? REAL {SIGN}?{DIGIT}*"."{DIGIT}*{EXPONENT}?
LETTER [A-Za-z_\200-\377] LETTER [A-Za-z_\200-\377]
LETTER_OR_DIGIT [A-Za-z_0-9\200-\377] LETTER_OR_DIGIT [A-Za-z_0-9\200-\377]
ID {LETTER}{LETTER_OR_DIGIT}* ID {LETTER}{LETTER_OR_DIGIT}*
QUALIFIED_ID {ID}"."{ID} QUALIFIED_ID {ID}"."{ID}
UNQUOTED_STRING {LETTER}({LETTER_OR_DIGIT}|[-._:/])* UNQUOTED_STRING {LETTER}({LETTER_OR_DIGIT}|[-._:/])*
STRING \'([^'\\\n]|\\.|\'\')*\' STRING \'([^'\\\n]|\\.|\'\')*\'
%% %%
\n ConfigFileLineno++; return GUC_EOL; \n ConfigFileLineno++; return GUC_EOL;
[ \t\r]+ /* eat whitespace */ [ \t\r]+ /* eat whitespace */
#.* /* eat comment (.* matches anything until newline) */ #.* /* eat comment (.* matches anything until newline) */
{ID} return GUC_ID; {ID} return GUC_ID;
{QUALIFIED_ID} return GUC_QUALIFIED_ID; {QUALIFIED_ID} return GUC_QUALIFIED_ID;
{STRING} return GUC_STRING; {STRING} return GUC_STRING;
{UNQUOTED_STRING} return GUC_UNQUOTED_STRING; {UNQUOTED_STRING} return GUC_UNQUOTED_STRING;
{INTEGER} return GUC_INTEGER; {INTEGER} return GUC_INTEGER;
{REAL} return GUC_REAL; {REAL} return GUC_REAL;
= return GUC_EQUALS; = return GUC_EQUALS;
. return GUC_ERROR; . return GUC_ERROR;
%% %%
......
...@@ -308,8 +308,8 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt ...@@ -308,8 +308,8 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt
if (strcmp_fn($2, ptr->name) == 0) if (strcmp_fn($2, ptr->name) == 0)
{ {
if ($2[0] == ':') if ($2[0] == ':')
mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1); mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
else else
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2); mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
} }
} }
...@@ -362,7 +362,7 @@ ECPG: into_clauseINTOOptTempTableName block ...@@ -362,7 +362,7 @@ ECPG: into_clauseINTOOptTempTableName block
FoundInto = 1; FoundInto = 1;
$$= cat2_str(mm_strdup("into"), $2); $$= cat2_str(mm_strdup("into"), $2);
} }
| ecpg_into { $$ = EMPTY; } | ecpg_into { $$ = EMPTY; }
ECPG: table_refselect_with_parens addon ECPG: table_refselect_with_parens addon
mmerror(PARSE_ERROR, ET_ERROR, "subquery in FROM must have an alias"); mmerror(PARSE_ERROR, ET_ERROR, "subquery in FROM must have an alias");
ECPG: TypenameSimpleTypenameopt_array_bounds block ECPG: TypenameSimpleTypenameopt_array_bounds block
...@@ -468,9 +468,9 @@ ECPG: FetchStmtMOVEfetch_args rule ...@@ -468,9 +468,9 @@ ECPG: FetchStmtMOVEfetch_args rule
$$ = cat_str(2, mm_strdup("move backward from"), cursor_marker); $$ = cat_str(2, mm_strdup("move backward from"), cursor_marker);
} }
ECPG: limit_clauseLIMITselect_limit_value','select_offset_value block ECPG: limit_clauseLIMITselect_limit_value','select_offset_value block
{ {
mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server"); mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
$$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4); $$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4);
} }
ECPG: SignedIconstIconst rule ECPG: SignedIconstIconst rule
| civar { $$ = $1; } | civar { $$ = $1; }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -83,7 +83,7 @@ static void complete_direction(PLpgSQL_stmt_fetch *fetch, ...@@ -83,7 +83,7 @@ static void complete_direction(PLpgSQL_stmt_fetch *fetch,
static PLpgSQL_stmt *make_return_stmt(int location); static PLpgSQL_stmt *make_return_stmt(int location);
static PLpgSQL_stmt *make_return_next_stmt(int location); static PLpgSQL_stmt *make_return_next_stmt(int location);
static PLpgSQL_stmt *make_return_query_stmt(int location); static PLpgSQL_stmt *make_return_query_stmt(int location);
static PLpgSQL_stmt *make_case(int location, PLpgSQL_expr *t_expr, static PLpgSQL_stmt *make_case(int location, PLpgSQL_expr *t_expr,
List *case_when_list, List *else_stmts); List *case_when_list, List *else_stmts);
static char *NameOfDatum(PLwdatum *wdatum); static char *NameOfDatum(PLwdatum *wdatum);
static void check_assignable(PLpgSQL_datum *datum, int location); static void check_assignable(PLpgSQL_datum *datum, int location);
...@@ -102,7 +102,7 @@ static PLpgSQL_type *parse_datatype(const char *string, int location); ...@@ -102,7 +102,7 @@ static PLpgSQL_type *parse_datatype(const char *string, int location);
static void check_labels(const char *start_label, static void check_labels(const char *start_label,
const char *end_label, const char *end_label,
int end_location); int end_location);
static PLpgSQL_expr *read_cursor_args(PLpgSQL_var *cursor, static PLpgSQL_expr *read_cursor_args(PLpgSQL_var *cursor,
int until, const char *expected); int until, const char *expected);
static List *read_raise_options(void); static List *read_raise_options(void);
...@@ -134,8 +134,8 @@ static List *read_raise_options(void); ...@@ -134,8 +134,8 @@ static List *read_raise_options(void);
char *name; char *name;
int lineno; int lineno;
PLpgSQL_datum *scalar; PLpgSQL_datum *scalar;
PLpgSQL_rec *rec; PLpgSQL_rec *rec;
PLpgSQL_row *row; PLpgSQL_row *row;
} forvariable; } forvariable;
struct struct
{ {
...@@ -1069,7 +1069,7 @@ opt_expr_until_when : ...@@ -1069,7 +1069,7 @@ opt_expr_until_when :
plpgsql_push_back_token(K_WHEN); plpgsql_push_back_token(K_WHEN);
$$ = expr; $$ = expr;
} }
; ;
case_when_list : case_when_list case_when case_when_list : case_when_list case_when
{ {
...@@ -1859,7 +1859,7 @@ stmt_open : K_OPEN cursor_variable ...@@ -1859,7 +1859,7 @@ stmt_open : K_OPEN cursor_variable
if ($2->cursor_explicit_expr == NULL) if ($2->cursor_explicit_expr == NULL)
{ {
/* be nice if we could use opt_scrollable here */ /* be nice if we could use opt_scrollable here */
tok = yylex(); tok = yylex();
if (tok_is_keyword(tok, &yylval, if (tok_is_keyword(tok, &yylval,
K_NO, "no")) K_NO, "no"))
{ {
...@@ -2077,9 +2077,9 @@ proc_exception : K_WHEN proc_conditions K_THEN proc_sect ...@@ -2077,9 +2077,9 @@ proc_exception : K_WHEN proc_conditions K_THEN proc_sect
PLpgSQL_exception *new; PLpgSQL_exception *new;
new = palloc0(sizeof(PLpgSQL_exception)); new = palloc0(sizeof(PLpgSQL_exception));
new->lineno = plpgsql_location_to_lineno(@1); new->lineno = plpgsql_location_to_lineno(@1);
new->conditions = $2; new->conditions = $2;
new->action = $4; new->action = $4;
$$ = new; $$ = new;
} }
...@@ -2451,7 +2451,7 @@ read_sql_construct(int until, ...@@ -2451,7 +2451,7 @@ read_sql_construct(int until,
expr->query = pstrdup(ds.data); expr->query = pstrdup(ds.data);
expr->plan = NULL; expr->plan = NULL;
expr->paramnos = NULL; expr->paramnos = NULL;
expr->ns = plpgsql_ns_top(); expr->ns = plpgsql_ns_top();
pfree(ds.data); pfree(ds.data);
if (valid_sql) if (valid_sql)
...@@ -2651,7 +2651,7 @@ make_execsql_stmt(int firsttoken, int location) ...@@ -2651,7 +2651,7 @@ make_execsql_stmt(int firsttoken, int location)
expr->query = pstrdup(ds.data); expr->query = pstrdup(ds.data);
expr->plan = NULL; expr->plan = NULL;
expr->paramnos = NULL; expr->paramnos = NULL;
expr->ns = plpgsql_ns_top(); expr->ns = plpgsql_ns_top();
pfree(ds.data); pfree(ds.data);
check_sql_expr(expr->query, location, 0); check_sql_expr(expr->query, location, 0);
...@@ -2688,7 +2688,7 @@ read_fetch_direction(void) ...@@ -2688,7 +2688,7 @@ read_fetch_direction(void)
/* set direction defaults: */ /* set direction defaults: */
fetch->direction = FETCH_FORWARD; fetch->direction = FETCH_FORWARD;
fetch->how_many = 1; fetch->how_many = 1;
fetch->expr = NULL; fetch->expr = NULL;
fetch->returns_multiple_rows = false; fetch->returns_multiple_rows = false;
tok = yylex(); tok = yylex();
...@@ -3478,7 +3478,7 @@ static PLpgSQL_stmt * ...@@ -3478,7 +3478,7 @@ static PLpgSQL_stmt *
make_case(int location, PLpgSQL_expr *t_expr, make_case(int location, PLpgSQL_expr *t_expr,
List *case_when_list, List *else_stmts) List *case_when_list, List *else_stmts)
{ {
PLpgSQL_stmt_case *new; PLpgSQL_stmt_case *new;
new = palloc(sizeof(PLpgSQL_stmt_case)); new = palloc(sizeof(PLpgSQL_stmt_case));
new->cmd_type = PLPGSQL_STMT_CASE; new->cmd_type = PLPGSQL_STMT_CASE;
......
...@@ -96,12 +96,12 @@ teardown { return(TEARDOWN); } ...@@ -96,12 +96,12 @@ teardown { return(TEARDOWN); }
static void static void
addlitchar(char c) addlitchar(char c)
{ {
if (litbufpos >= sizeof(litbuf) - 1) if (litbufpos >= sizeof(litbuf) - 1)
{ {
fprintf(stderr, "SQL step too long\n"); fprintf(stderr, "SQL step too long\n");
exit(1); exit(1);
} }
litbuf[litbufpos++] = c; litbuf[litbufpos++] = c;
} }
void void
......
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