These are not touched by pgindent, so clean them up a bit manually.
/* Grammar follows */
%%
-box:
- O_BRACKET paren_list COMMA paren_list C_BRACKET {
-
- int dim;
-
- dim = delim_count($2, ',') + 1;
- if ( (delim_count($4, ',') + 1) != dim ) {
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("bad cube representation"),
- errdetail("Different point dimensions in (%s) and (%s).",
- $2, $4)));
- YYABORT;
- }
- if (dim > CUBE_MAX_DIM) {
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("bad cube representation"),
- errdetail("A cube cannot have more than %d dimensions.",
- CUBE_MAX_DIM)));
- YYABORT;
- }
-
- *((void **)result) = write_box( dim, $2, $4 );
-
- }
- |
- paren_list COMMA paren_list {
- int dim;
-
- dim = delim_count($1, ',') + 1;
-
- if ( (delim_count($3, ',') + 1) != dim ) {
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("bad cube representation"),
- errdetail("Different point dimensions in (%s) and (%s).",
- $1, $3)));
- YYABORT;
- }
- if (dim > CUBE_MAX_DIM) {
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("bad cube representation"),
- errdetail("A cube cannot have more than %d dimensions.",
- CUBE_MAX_DIM)));
- YYABORT;
- }
-
- *((void **)result) = write_box( dim, $1, $3 );
- }
- |
-
- paren_list {
- int dim;
-
- dim = delim_count($1, ',') + 1;
- if (dim > CUBE_MAX_DIM) {
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("bad cube representation"),
- errdetail("A cube cannot have more than %d dimensions.",
- CUBE_MAX_DIM)));
- YYABORT;
- }
-
- *((void **)result) = write_point_as_box($1, dim);
- }
-
- |
-
- list {
- int dim;
-
- dim = delim_count($1, ',') + 1;
- if (dim > CUBE_MAX_DIM) {
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("bad cube representation"),
- errdetail("A cube cannot have more than %d dimensions.",
- CUBE_MAX_DIM)));
- YYABORT;
- }
- *((void **)result) = write_point_as_box($1, dim);
- }
- ;
-
-paren_list:
- O_PAREN list C_PAREN {
- $$ = $2;
- }
- ;
-
-list:
- CUBEFLOAT {
- /* alloc enough space to be sure whole list will fit */
- $$ = palloc(scanbuflen + 1);
- strcpy($$, $1);
- }
- |
- list COMMA CUBEFLOAT {
- $$ = $1;
- strcat($$, ",");
- strcat($$, $3);
- }
- ;
+box: O_BRACKET paren_list COMMA paren_list C_BRACKET
+ {
+ int dim;
+
+ dim = delim_count($2, ',') + 1;
+ if ((delim_count($4, ',') + 1) != dim)
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("bad cube representation"),
+ errdetail("Different point dimensions in (%s) and (%s).",
+ $2, $4)));
+ YYABORT;
+ }
+ if (dim > CUBE_MAX_DIM) {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("bad cube representation"),
+ errdetail("A cube cannot have more than %d dimensions.",
+ CUBE_MAX_DIM)));
+ YYABORT;
+ }
+
+ *((void **)result) = write_box( dim, $2, $4 );
+
+ }
+
+ | paren_list COMMA paren_list
+ {
+ int dim;
+
+ dim = delim_count($1, ',') + 1;
+
+ if ( (delim_count($3, ',') + 1) != dim ) {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("bad cube representation"),
+ errdetail("Different point dimensions in (%s) and (%s).",
+ $1, $3)));
+ YYABORT;
+ }
+ if (dim > CUBE_MAX_DIM) {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("bad cube representation"),
+ errdetail("A cube cannot have more than %d dimensions.",
+ CUBE_MAX_DIM)));
+ YYABORT;
+ }
+
+ *((void **)result) = write_box( dim, $1, $3 );
+ }
+
+ | paren_list
+ {
+ int dim;
+
+ dim = delim_count($1, ',') + 1;
+ if (dim > CUBE_MAX_DIM) {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("bad cube representation"),
+ errdetail("A cube cannot have more than %d dimensions.",
+ CUBE_MAX_DIM)));
+ YYABORT;
+ }
+
+ *((void **)result) = write_point_as_box($1, dim);
+ }
+
+ | list
+ {
+ int dim;
+
+ dim = delim_count($1, ',') + 1;
+ if (dim > CUBE_MAX_DIM) {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("bad cube representation"),
+ errdetail("A cube cannot have more than %d dimensions.",
+ CUBE_MAX_DIM)));
+ YYABORT;
+ }
+ *((void **)result) = write_point_as_box($1, dim);
+ }
+ ;
+
+paren_list: O_PAREN list C_PAREN
+ {
+ $$ = $2;
+ }
+ ;
+
+list: CUBEFLOAT
+ {
+ /* alloc enough space to be sure whole list will fit */
+ $$ = palloc(scanbuflen + 1);
+ strcpy($$, $1);
+ }
+ | list COMMA CUBEFLOAT
+ {
+ $$ = $1;
+ strcat($$, ",");
+ strcat($$, $3);
+ }
+ ;
%%
static int
delim_count(char *s, char delim)
{
- int ndelim = 0;
-
- while ((s = strchr(s, delim)) != NULL)
- {
- ndelim++;
- s++;
- }
- return (ndelim);
+ int ndelim = 0;
+
+ while ((s = strchr(s, delim)) != NULL)
+ {
+ ndelim++;
+ s++;
+ }
+ return (ndelim);
}
static NDBOX *
write_box(unsigned int dim, char *str1, char *str2)
{
- NDBOX * bp;
- char * s;
- int i;
- int size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
-
- bp = palloc0(size);
- SET_VARSIZE(bp, size);
- bp->dim = dim;
-
- s = str1;
- bp->x[i=0] = strtod(s, NULL);
- while ((s = strchr(s, ',')) != NULL) {
- s++; i++;
- bp->x[i] = strtod(s, NULL);
- }
-
- s = str2;
- bp->x[i=dim] = strtod(s, NULL);
- while ((s = strchr(s, ',')) != NULL) {
- s++; i++;
- bp->x[i] = strtod(s, NULL);
- }
-
- return(bp);
+ NDBOX *bp;
+ char *s;
+ int i;
+ int size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
+
+ bp = palloc0(size);
+ SET_VARSIZE(bp, size);
+ bp->dim = dim;
+
+ s = str1;
+ bp->x[i=0] = strtod(s, NULL);
+ while ((s = strchr(s, ',')) != NULL)
+ {
+ s++; i++;
+ bp->x[i] = strtod(s, NULL);
+ }
+
+ s = str2;
+ bp->x[i=dim] = strtod(s, NULL);
+ while ((s = strchr(s, ',')) != NULL)
+ {
+ s++; i++;
+ bp->x[i] = strtod(s, NULL);
+ }
+
+ return(bp);
}
-
static NDBOX *
write_point_as_box(char *str, int dim)
{
- NDBOX * bp;
- int i, size;
- double x;
- char * s = str;
+ NDBOX *bp;
+ int i,
+ size;
+ double x;
+ char *s = str;
size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
x = strtod(s, NULL);
bp->x[0] = x;
bp->x[dim] = x;
- while ((s = strchr(s, ',')) != NULL) {
- s++; i++;
- x = strtod(s, NULL);
- bp->x[i] = x;
- bp->x[i+dim] = x;
+ while ((s = strchr(s, ',')) != NULL)
+ {
+ s++; i++;
+ x = strtod(s, NULL);
+ bp->x[i] = x;
+ bp->x[i+dim] = x;
}
return(bp);
#define YYMALLOC palloc
#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);
- int seg_yyparse(void *result);
+void seg_yyerror(const char *message);
+int seg_yyparse(void *result);
- static float seg_atof(char *value);
+static float seg_atof(char *value);
- 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'
- };
+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'
+};
%}
%name-prefix="seg_yy"
%union {
- struct BND {
- float val;
- char ext;
- char sigd;
- } bnd;
- char * text;
+ struct BND {
+ float val;
+ char ext;
+ char sigd;
+ } bnd;
+ char * text;
}
%token <text> SEGFLOAT
%token <text> RANGE
%%
-range:
- boundary PLUMIN deviation {
- ((SEG *)result)->lower = $1.val - $3.val;
- ((SEG *)result)->upper = $1.val + $3.val;
- sprintf(strbuf, "%g", ((SEG *)result)->lower);
- ((SEG *)result)->l_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
- sprintf(strbuf, "%g", ((SEG *)result)->upper);
- ((SEG *)result)->u_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
- ((SEG *)result)->l_ext = '\0';
- ((SEG *)result)->u_ext = '\0';
- }
- |
- boundary RANGE boundary {
- ((SEG *)result)->lower = $1.val;
- ((SEG *)result)->upper = $3.val;
- if ( ((SEG *)result)->lower > ((SEG *)result)->upper ) {
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("swapped boundaries: %g is greater than %g",
- ((SEG *)result)->lower, ((SEG *)result)->upper)));
-
- YYERROR;
- }
- ((SEG *)result)->l_sigd = $1.sigd;
- ((SEG *)result)->u_sigd = $3.sigd;
- ((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;
- ((SEG *)result)->upper = HUGE_VAL;
- ((SEG *)result)->l_sigd = $1.sigd;
- ((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;
- ((SEG *)result)->l_sigd = 0;
- ((SEG *)result)->u_sigd = $2.sigd;
- ((SEG *)result)->l_ext = '-';
- ((SEG *)result)->u_ext = ( $2.ext ? $2.ext : '\0' );
- }
- |
- boundary {
- ((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:
- SEGFLOAT {
- /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
- float val = seg_atof($1);
-
- $$.ext = '\0';
- $$.sigd = significant_digits($1);
- $$.val = val;
- }
- |
- EXTENSION SEGFLOAT {
- /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
- float val = seg_atof($2);
-
- $$.ext = $1[0];
- $$.sigd = significant_digits($2);
- $$.val = val;
- }
- ;
-
-deviation:
- SEGFLOAT {
- /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
- float val = seg_atof($1);
-
- $$.ext = '\0';
- $$.sigd = significant_digits($1);
- $$.val = val;
- }
- ;
+range: boundary PLUMIN deviation
+ {
+ ((SEG *)result)->lower = $1.val - $3.val;
+ ((SEG *)result)->upper = $1.val + $3.val;
+ sprintf(strbuf, "%g", ((SEG *)result)->lower);
+ ((SEG *)result)->l_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
+ sprintf(strbuf, "%g", ((SEG *)result)->upper);
+ ((SEG *)result)->u_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
+ ((SEG *)result)->l_ext = '\0';
+ ((SEG *)result)->u_ext = '\0';
+ }
+
+ | boundary RANGE boundary
+ {
+ ((SEG *)result)->lower = $1.val;
+ ((SEG *)result)->upper = $3.val;
+ if ( ((SEG *)result)->lower > ((SEG *)result)->upper ) {
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("swapped boundaries: %g is greater than %g",
+ ((SEG *)result)->lower, ((SEG *)result)->upper)));
+
+ YYERROR;
+ }
+ ((SEG *)result)->l_sigd = $1.sigd;
+ ((SEG *)result)->u_sigd = $3.sigd;
+ ((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;
+ ((SEG *)result)->upper = HUGE_VAL;
+ ((SEG *)result)->l_sigd = $1.sigd;
+ ((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;
+ ((SEG *)result)->l_sigd = 0;
+ ((SEG *)result)->u_sigd = $2.sigd;
+ ((SEG *)result)->l_ext = '-';
+ ((SEG *)result)->u_ext = ( $2.ext ? $2.ext : '\0' );
+ }
+
+ | boundary
+ {
+ ((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: SEGFLOAT
+ {
+ /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
+ float val = seg_atof($1);
+
+ $$.ext = '\0';
+ $$.sigd = significant_digits($1);
+ $$.val = val;
+ }
+ | EXTENSION SEGFLOAT
+ {
+ /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
+ float val = seg_atof($2);
+
+ $$.ext = $1[0];
+ $$.sigd = significant_digits($2);
+ $$.val = val;
+ }
+ ;
+
+deviation: SEGFLOAT
+ {
+ /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
+ float val = seg_atof($1);
+
+ $$.ext = '\0';
+ $$.sigd = significant_digits($1);
+ $$.val = val;
+ }
+ ;
%%
%type <ival> document_or_content
%type <boolean> xml_whitespace_option
-%type <node> common_table_expr
-%type <with> with_clause opt_with_clause
+%type <node> common_table_expr
+%type <with> with_clause opt_with_clause
%type <list> cte_list
%type <list> window_clause window_definition_list opt_partition_clause
{
ConstraintsSetStmt *n = makeNode(ConstraintsSetStmt);
n->constraints = $3;
- n->deferred = $4;
+ n->deferred = $4;
$$ = (Node *) n;
}
;
;
reloptions:
- '(' reloption_list ')' { $$ = $2; }
+ '(' reloption_list ')' { $$ = $2; }
;
opt_reloptions: WITH reloptions { $$ = $2; }
/*****************************************************************************
*
- * QUERY:
+ * QUERY:
* CREATE TABLESPACE tablespace LOCATION '/path/to/tablespace/'
*
*****************************************************************************/
/*****************************************************************************
*
- * QUERY :
+ * QUERY :
* DROP TABLESPACE <tablespace>
*
* No need for drop behaviour as we cannot implement dependencies for
$$ = (Node *) n;
}
| DROP TABLESPACE IF_P EXISTS name
- {
+ {
DropTableSpaceStmt *n = makeNode(DropTableSpaceStmt);
n->tablespacename = $5;
n->missing_ok = true;
/*****************************************************************************
*
- * QUERY:
+ * QUERY:
* CREATE EXTENSION extension
* [ WITH ] [ SCHEMA schema ] [ VERSION version ] [ FROM oldversion ]
*
/*****************************************************************************
*
- * QUERY:
+ * QUERY:
* CREATE FOREIGN DATA WRAPPER name options
*
*****************************************************************************/
/*****************************************************************************
*
- * QUERY :
+ * QUERY :
* DROP FOREIGN DATA WRAPPER name
*
****************************************************************************/
$$ = (Node *) n;
}
| DROP FOREIGN DATA_P WRAPPER IF_P EXISTS name opt_drop_behavior
- {
+ {
DropFdwStmt *n = makeNode(DropFdwStmt);
n->fdwname = $7;
n->missing_ok = true;
/*****************************************************************************
*
- * QUERY :
+ * QUERY :
* ALTER FOREIGN DATA WRAPPER name options
*
****************************************************************************/
/*****************************************************************************
*
- * QUERY:
+ * QUERY:
* CREATE SERVER name [TYPE] [VERSION] [OPTIONS]
*
*****************************************************************************/
;
opt_foreign_server_version:
- foreign_server_version { $$ = $1; }
+ foreign_server_version { $$ = $1; }
| /*EMPTY*/ { $$ = NULL; }
;
/*****************************************************************************
*
- * QUERY :
+ * QUERY :
* DROP SERVER name
*
****************************************************************************/
$$ = (Node *) n;
}
| DROP SERVER IF_P EXISTS name opt_drop_behavior
- {
+ {
DropForeignServerStmt *n = makeNode(DropForeignServerStmt);
n->servername = $5;
n->missing_ok = true;
/*****************************************************************************
*
- * QUERY :
+ * QUERY :
* ALTER SERVER name [VERSION] [OPTIONS]
*
****************************************************************************/
/*****************************************************************************
*
- * QUERY:
+ * QUERY:
* CREATE FOREIGN TABLE relname (...) SERVER name (...)
*
*****************************************************************************/
/*****************************************************************************
*
- * QUERY:
+ * QUERY:
* ALTER FOREIGN TABLE relname [...]
*
*****************************************************************************/
/*****************************************************************************
*
- * QUERY:
+ * QUERY:
* CREATE USER MAPPING FOR auth_ident SERVER name [OPTIONS]
*
*****************************************************************************/
/* User mapping authorization identifier */
auth_ident:
- CURRENT_USER { $$ = "current_user"; }
+ CURRENT_USER { $$ = "current_user"; }
| USER { $$ = "current_user"; }
- | RoleId { $$ = (strcmp($1, "public") == 0) ? NULL : $1; }
+ | RoleId { $$ = (strcmp($1, "public") == 0) ? NULL : $1; }
;
/*****************************************************************************
*
- * QUERY :
+ * QUERY :
* DROP USER MAPPING FOR auth_ident SERVER name
*
****************************************************************************/
$$ = (Node *) n;
}
| DROP USER MAPPING IF_P EXISTS FOR auth_ident SERVER name
- {
+ {
DropUserMappingStmt *n = makeNode(DropUserMappingStmt);
n->username = $7;
n->servername = $9;
/*****************************************************************************
*
- * QUERY :
+ * QUERY :
* ALTER USER MAPPING FOR auth_ident SERVER name OPTIONS
*
****************************************************************************/
definition: '(' def_list ')' { $$ = $2; }
;
-def_list: def_elem { $$ = list_make1($1); }
+def_list: def_elem { $$ = list_make1($1); }
| def_list ',' def_elem { $$ = lappend($1, $3); }
;
*****************************************************************************/
AlterEnumStmt:
- ALTER TYPE_P any_name ADD_P VALUE_P Sconst
- {
- AlterEnumStmt *n = makeNode(AlterEnumStmt);
- n->typeName = $3;
- n->newVal = $6;
- n->newValNeigr = NULL;
- n->newValIsAfter = true;
- $$ = (Node *) n;
- }
+ ALTER TYPE_P any_name ADD_P VALUE_P Sconst
+ {
+ AlterEnumStmt *n = makeNode(AlterEnumStmt);
+ n->typeName = $3;
+ n->newVal = $6;
+ n->newValNeigr = NULL;
+ n->newValIsAfter = true;
+ $$ = (Node *) n;
+ }
| ALTER TYPE_P any_name ADD_P VALUE_P Sconst BEFORE Sconst
- {
- AlterEnumStmt *n = makeNode(AlterEnumStmt);
- n->typeName = $3;
- n->newVal = $6;
- n->newValNeigr = $8;
- n->newValIsAfter = false;
- $$ = (Node *) n;
- }
+ {
+ AlterEnumStmt *n = makeNode(AlterEnumStmt);
+ n->typeName = $3;
+ n->newVal = $6;
+ n->newValNeigr = $8;
+ n->newValIsAfter = false;
+ $$ = (Node *) n;
+ }
| ALTER TYPE_P any_name ADD_P VALUE_P Sconst AFTER Sconst
- {
- AlterEnumStmt *n = makeNode(AlterEnumStmt);
- n->typeName = $3;
- n->newVal = $6;
- n->newValNeigr = $8;
- n->newValIsAfter = true;
- $$ = (Node *) n;
- }
+ {
+ AlterEnumStmt *n = makeNode(AlterEnumStmt);
+ n->typeName = $3;
+ n->newVal = $6;
+ n->newValNeigr = $8;
+ n->newValIsAfter = true;
+ $$ = (Node *) n;
+ }
;
*****************************************************************************/
DropOwnedStmt:
DROP OWNED BY name_list opt_drop_behavior
- {
+ {
DropOwnedStmt *n = makeNode(DropOwnedStmt);
n->roles = $4;
n->behavior = $5;
| COLLATION { $$ = OBJECT_COLLATION; }
| CONVERSION_P { $$ = OBJECT_CONVERSION; }
| TABLESPACE { $$ = OBJECT_TABLESPACE; }
- | EXTENSION { $$ = OBJECT_EXTENSION; }
+ | EXTENSION { $$ = OBJECT_EXTENSION; }
| ROLE { $$ = OBJECT_ROLE; }
| FOREIGN TABLE { $$ = OBJECT_FOREIGN_TABLE; }
| SERVER { $$ = OBJECT_FOREIGN_SERVER; }
func_arg_with_default:
func_arg
- {
- $$ = $1;
- }
+ {
+ $$ = $1;
+ }
| func_arg DEFAULT a_expr
- {
- $$ = $1;
- $$->defexpr = $3;
- }
+ {
+ $$ = $1;
+ $$->defexpr = $3;
+ }
| func_arg '=' a_expr
- {
- $$ = $1;
- $$->defexpr = $3;
- }
+ {
+ $$ = $1;
+ $$->defexpr = $3;
+ }
;
createfunc_opt_list:
/* Must be at least one to prevent conflict */
- createfunc_opt_item { $$ = list_make1($1); }
+ createfunc_opt_item { $$ = list_make1($1); }
| createfunc_opt_list createfunc_opt_item { $$ = lappend($1, $2); }
;
CREATE opt_default CONVERSION_P any_name FOR Sconst
TO Sconst FROM any_name
{
- CreateConversionStmt *n = makeNode(CreateConversionStmt);
- n->conversion_name = $4;
- n->for_encoding_name = $6;
- n->to_encoding_name = $8;
- n->func_name = $10;
- n->def = $2;
- $$ = (Node *)n;
+ CreateConversionStmt *n = makeNode(CreateConversionStmt);
+ n->conversion_name = $4;
+ n->for_encoding_name = $6;
+ n->to_encoding_name = $8;
+ n->func_name = $10;
+ n->def = $2;
+ $$ = (Node *)n;
}
;
ClusterStmt:
CLUSTER opt_verbose qualified_name cluster_index_specification
{
- ClusterStmt *n = makeNode(ClusterStmt);
- n->relation = $3;
- n->indexname = $4;
- n->verbose = $2;
- $$ = (Node*)n;
+ ClusterStmt *n = makeNode(ClusterStmt);
+ n->relation = $3;
+ n->indexname = $4;
+ n->verbose = $2;
+ $$ = (Node*)n;
}
| CLUSTER opt_verbose
- {
- ClusterStmt *n = makeNode(ClusterStmt);
- n->relation = NULL;
- n->indexname = NULL;
- n->verbose = $2;
- $$ = (Node*)n;
+ {
+ ClusterStmt *n = makeNode(ClusterStmt);
+ n->relation = NULL;
+ n->indexname = NULL;
+ n->verbose = $2;
+ $$ = (Node*)n;
}
/* kept for pre-8.3 compatibility */
| CLUSTER opt_verbose index_name ON qualified_name
{
- ClusterStmt *n = makeNode(ClusterStmt);
- n->relation = $5;
- n->indexname = $3;
- n->verbose = $2;
- $$ = (Node*)n;
+ ClusterStmt *n = makeNode(ClusterStmt);
+ n->relation = $5;
+ n->indexname = $3;
+ n->verbose = $2;
+ $$ = (Node*)n;
}
;
;
using_clause:
- USING from_list { $$ = $2; }
+ USING from_list { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }
;
}
;
-opt_lock: IN_P lock_type MODE { $$ = $2; }
+opt_lock: IN_P lock_type MODE { $$ = $2; }
| /*EMPTY*/ { $$ = AccessExclusiveLock; }
;
{
$$ = (Node *) makeA_Expr(AEXPR_OR, NIL,
(Node *) makeA_Expr(AEXPR_AND, NIL,
- (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", $1, $4, @2),
- (Node *) makeSimpleA_Expr(AEXPR_OP, "<=", $1, $6, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", $1, $4, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, "<=", $1, $6, @2),
@2),
(Node *) makeA_Expr(AEXPR_AND, NIL,
- (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", $1, $6, @2),
- (Node *) makeSimpleA_Expr(AEXPR_OP, "<=", $1, $4, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", $1, $6, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, "<=", $1, $4, @2),
@2),
@2);
}
{
$$ = (Node *) makeA_Expr(AEXPR_AND, NIL,
(Node *) makeA_Expr(AEXPR_OR, NIL,
- (Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $5, @2),
- (Node *) makeSimpleA_Expr(AEXPR_OP, ">", $1, $7, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $5, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, ">", $1, $7, @2),
@2),
(Node *) makeA_Expr(AEXPR_OR, NIL,
- (Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $7, @2),
- (Node *) makeSimpleA_Expr(AEXPR_OP, ">", $1, $5, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $7, @2),
+ (Node *) makeSimpleA_Expr(AEXPR_OP, ">", $1, $5, @2),
@2),
@2);
}
if (IsA(arg, NamedArgExpr))
ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("type modifier cannot have parameter name"),
- parser_errposition(arg->location)));
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("type modifier cannot have parameter name"),
+ parser_errposition(arg->location)));
}
t->typmods = $3;
t->location = @1;
makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
int location)
{
- XmlExpr *x = makeNode(XmlExpr);
+ XmlExpr *x = makeNode(XmlExpr);
x->op = op;
x->name = name;
;
base_backup_opt_list: base_backup_opt_list base_backup_opt { $$ = lappend($1, $2); }
- | /* EMPTY */ { $$ = NIL; }
+ | /* EMPTY */ { $$ = NIL; }
base_backup_opt:
K_LABEL SCONST
static void
startlit(void)
{
- initStringInfo(&litbuf);
+ initStringInfo(&litbuf);
}
static char *
litbufdup(void)
{
- return litbuf.data;
+ return litbuf.data;
}
static void
static void
addlitchar(unsigned char ychar)
{
- appendStringInfoChar(&litbuf, ychar);
+ appendStringInfoChar(&litbuf, ychar);
}
void
yyerror(const char *message)
{
- ereport(ERROR,
+ ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg_internal("%s", message)));
}
%option prefix="GUC_yy"
-SIGN ("-"|"+")
-DIGIT [0-9]
-HEXDIGIT [0-9a-fA-F]
+SIGN ("-"|"+")
+DIGIT [0-9]
+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}+
-REAL {SIGN}?{DIGIT}*"."{DIGIT}*{EXPONENT}?
+EXPONENT [Ee]{SIGN}?{DIGIT}+
+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]
-ID {LETTER}{LETTER_OR_DIGIT}*
-QUALIFIED_ID {ID}"."{ID}
+ID {LETTER}{LETTER_OR_DIGIT}*
+QUALIFIED_ID {ID}"."{ID}
UNQUOTED_STRING {LETTER}({LETTER_OR_DIGIT}|[-._:/])*
-STRING \'([^'\\\n]|\\.|\'\')*\'
+STRING \'([^'\\\n]|\\.|\'\')*\'
%%
-\n ConfigFileLineno++; return GUC_EOL;
-[ \t\r]+ /* eat whitespace */
-#.* /* eat comment (.* matches anything until newline) */
+\n ConfigFileLineno++; return GUC_EOL;
+[ \t\r]+ /* eat whitespace */
+#.* /* eat comment (.* matches anything until newline) */
-{ID} return GUC_ID;
-{QUALIFIED_ID} return GUC_QUALIFIED_ID;
-{STRING} return GUC_STRING;
+{ID} return GUC_ID;
+{QUALIFIED_ID} return GUC_QUALIFIED_ID;
+{STRING} return GUC_STRING;
{UNQUOTED_STRING} return GUC_UNQUOTED_STRING;
-{INTEGER} return GUC_INTEGER;
-{REAL} return GUC_REAL;
-= return GUC_EQUALS;
+{INTEGER} return GUC_INTEGER;
+{REAL} return GUC_REAL;
+= return GUC_EQUALS;
-. return GUC_ERROR;
+. return GUC_ERROR;
%%
if (strcmp_fn($2, ptr->name) == 0)
{
if ($2[0] == ':')
- mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
- else
+ mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
+ else
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
}
}
FoundInto = 1;
$$= cat2_str(mm_strdup("into"), $2);
}
- | ecpg_into { $$ = EMPTY; }
+ | ecpg_into { $$ = EMPTY; }
ECPG: table_refselect_with_parens addon
mmerror(PARSE_ERROR, ET_ERROR, "subquery in FROM must have an alias");
ECPG: TypenameSimpleTypenameopt_array_bounds block
$$ = cat_str(2, mm_strdup("move backward from"), cursor_marker);
}
ECPG: limit_clauseLIMITselect_limit_value','select_offset_value block
- {
- mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
- $$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4);
- }
+ {
+ mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
+ $$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4);
+ }
ECPG: SignedIconstIconst rule
| civar { $$ = $1; }
/* Location tracking support --- simpler than bison's default */
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
- if (N) \
- (Current) = (Rhs)[1]; \
- else \
- (Current) = (Rhs)[0]; \
+ if (N) \
+ (Current) = (Rhs)[1]; \
+ else \
+ (Current) = (Rhs)[0]; \
} while (0)
/*
static int FoundInto = 0;
static int initializer = 0;
static int pacounter = 1;
-static char pacounter_buffer[sizeof(int) * CHAR_BIT * 10 / 3]; /* a rough guess at the size we need */
+static char pacounter_buffer[sizeof(int) * CHAR_BIT * 10 / 3]; /* a rough guess at the size we need */
static struct this_type actual_type[STRUCT_DEPTH];
static char *actual_startline[STRUCT_DEPTH];
-static int varchar_counter = 1;
+static int varchar_counter = 1;
/* temporarily store struct members while creating the data structure */
struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH] = { NULL };
fclose(yyout);
if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0)
- fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);
+ fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);
exit(error_code);
}
}
newvar = ptr->variable;
skip_set_var = true;
}
- else if ((ptr->variable->type->type == ECPGt_char_variable) && (!strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement"))))
+ else if ((ptr->variable->type->type == ECPGt_char_variable)
+ && (!strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement"))))
{
newvar = ptr->variable;
skip_set_var = true;
}
- else if ((ptr->variable->type->type != ECPGt_varchar && ptr->variable->type->type != ECPGt_char && ptr->variable->type->type != ECPGt_unsigned_char && ptr->variable->type->type != ECPGt_string) && atoi(ptr->variable->type->size) > 1)
+ else if ((ptr->variable->type->type != ECPGt_varchar
+ && ptr->variable->type->type != ECPGt_char
+ && ptr->variable->type->type != ECPGt_unsigned_char
+ && ptr->variable->type->type != ECPGt_string)
+ && atoi(ptr->variable->type->size) > 1)
{
- newvar = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, mm_strdup("1"), ptr->variable->type->u.element->counter), ptr->variable->type->size), 0);
+ newvar = new_variable(cat_str(4, mm_strdup("("),
+ mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
+ mm_strdup("1"),
+ ptr->variable->type->u.element->counter),
+ ptr->variable->type->size),
+ 0);
sprintf(temp, "%d, (", ecpg_internal_var++);
}
- else if ((ptr->variable->type->type == ECPGt_varchar || ptr->variable->type->type == ECPGt_char || ptr->variable->type->type == ECPGt_unsigned_char || ptr->variable->type->type == ECPGt_string) && atoi(ptr->variable->type->size) > 1)
+ else if ((ptr->variable->type->type == ECPGt_varchar
+ || ptr->variable->type->type == ECPGt_char
+ || ptr->variable->type->type == ECPGt_unsigned_char
+ || ptr->variable->type->type == ECPGt_string)
+ && atoi(ptr->variable->type->size) > 1)
{
- newvar = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->counter), 0);
+ newvar = new_variable(cat_str(4, mm_strdup("("),
+ mm_strdup(ecpg_type_name(ptr->variable->type->type)),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_simple_type(ptr->variable->type->type,
+ ptr->variable->type->size,
+ ptr->variable->type->counter),
+ 0);
if (ptr->variable->type->type == ECPGt_varchar)
sprintf(temp, "%d, &(", ecpg_internal_var++);
else
sprintf(temp, "%d, (", ecpg_internal_var++);
}
- else if (ptr->variable->type->type == ECPGt_struct || ptr->variable->type->type == ECPGt_union)
+ else if (ptr->variable->type->type == ECPGt_struct
+ || ptr->variable->type->type == ECPGt_union)
{
sprintf(temp, "%d)))", ecpg_internal_var);
- newvar = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->variable->type->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->variable->type->u.members, ptr->variable->type->type, ptr->variable->type->type_name, ptr->variable->type->struct_sizeof), 0);
+ newvar = new_variable(cat_str(4, mm_strdup("(*("),
+ mm_strdup(ptr->variable->type->type_name),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_struct_type(ptr->variable->type->u.members,
+ ptr->variable->type->type,
+ ptr->variable->type->type_name,
+ ptr->variable->type->struct_sizeof),
+ 0);
sprintf(temp, "%d, &(", ecpg_internal_var++);
}
else if (ptr->variable->type->type == ECPGt_array)
{
- if (ptr->variable->type->u.element->type == ECPGt_struct || ptr->variable->type->u.element->type == ECPGt_union)
+ if (ptr->variable->type->u.element->type == ECPGt_struct
+ || ptr->variable->type->u.element->type == ECPGt_union)
{
sprintf(temp, "%d)))", ecpg_internal_var);
- newvar = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->variable->type->u.element->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->variable->type->u.element->u.members, ptr->variable->type->u.element->type, ptr->variable->type->u.element->type_name, ptr->variable->type->u.element->struct_sizeof), 0);
+ newvar = new_variable(cat_str(4, mm_strdup("(*("),
+ mm_strdup(ptr->variable->type->u.element->type_name),
+ mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)),
+ ECPGmake_struct_type(ptr->variable->type->u.element->u.members,
+ ptr->variable->type->u.element->type,
+ ptr->variable->type->u.element->type_name,
+ ptr->variable->type->u.element->struct_sizeof),
+ 0);
sprintf(temp, "%d, (", ecpg_internal_var++);
}
else
{
- newvar = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, ptr->variable->type->u.element->size, ptr->variable->type->u.element->counter), ptr->variable->type->size), 0);
+ newvar = new_variable(cat_str(4, mm_strdup("("),
+ mm_strdup(ecpg_type_name(ptr->variable->type->type)),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
+ ptr->variable->type->u.element->size,
+ ptr->variable->type->u.element->counter),
+ ptr->variable->type->size),
+ 0);
sprintf(temp, "%d, &(", ecpg_internal_var++);
}
}
else
{
- newvar = new_variable(cat_str(4, mm_strdup("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->counter), 0);
+ newvar = new_variable(cat_str(4, mm_strdup("*("),
+ mm_strdup(ecpg_type_name(ptr->variable->type->type)),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_simple_type(ptr->variable->type->type,
+ ptr->variable->type->size,
+ ptr->variable->type->counter),
+ 0);
sprintf(temp, "%d, &(", ecpg_internal_var++);
}
/* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
if (!skip_set_var)
- result = cat_str(5, result, mm_strdup("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), mm_strdup("), __LINE__);\n"));
+ result = cat_str(5, result, mm_strdup("ECPGset_var("),
+ mm_strdup(temp), mm_strdup(original_var),
+ mm_strdup("), __LINE__);\n"));
/* now the indicator if there is one and it's not a global variable */
if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
original_var = ptr->indicator->name;
sprintf(temp, "%d))", ecpg_internal_var);
- if (ptr->indicator->type->type == ECPGt_struct || ptr->indicator->type->type == ECPGt_union)
+ if (ptr->indicator->type->type == ECPGt_struct
+ || ptr->indicator->type->type == ECPGt_union)
{
sprintf(temp, "%d)))", ecpg_internal_var);
- newind = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->indicator->type->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->indicator->type->u.members, ptr->indicator->type->type, ptr->indicator->type->type_name, ptr->indicator->type->struct_sizeof), 0);
+ newind = new_variable(cat_str(4, mm_strdup("(*("),
+ mm_strdup(ptr->indicator->type->type_name),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_struct_type(ptr->indicator->type->u.members,
+ ptr->indicator->type->type,
+ ptr->indicator->type->type_name,
+ ptr->indicator->type->struct_sizeof),
+ 0);
sprintf(temp, "%d, &(", ecpg_internal_var++);
}
else if (ptr->indicator->type->type == ECPGt_array)
{
- if (ptr->indicator->type->u.element->type == ECPGt_struct || ptr->indicator->type->u.element->type == ECPGt_union)
+ if (ptr->indicator->type->u.element->type == ECPGt_struct
+ || ptr->indicator->type->u.element->type == ECPGt_union)
{
sprintf(temp, "%d)))", ecpg_internal_var);
- newind = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->indicator->type->u.element->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->indicator->type->u.element->u.members, ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->type_name, ptr->indicator->type->u.element->struct_sizeof), 0);
+ newind = new_variable(cat_str(4, mm_strdup("(*("),
+ mm_strdup(ptr->indicator->type->u.element->type_name),
+ mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)),
+ ECPGmake_struct_type(ptr->indicator->type->u.element->u.members,
+ ptr->indicator->type->u.element->type,
+ ptr->indicator->type->u.element->type_name,
+ ptr->indicator->type->u.element->struct_sizeof),
+ 0);
sprintf(temp, "%d, (", ecpg_internal_var++);
}
else
{
- newind = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->size, ptr->indicator->type->u.element->counter), ptr->indicator->type->size), 0);
+ newind = new_variable(cat_str(4, mm_strdup("("),
+ mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)),
+ mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)),
+ ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type,
+ ptr->indicator->type->u.element->size,
+ ptr->indicator->type->u.element->counter),
+ ptr->indicator->type->size),
+ 0);
sprintf(temp, "%d, &(", ecpg_internal_var++);
}
}
else if (atoi(ptr->indicator->type->size) > 1)
{
- newind = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->counter), 0);
+ newind = new_variable(cat_str(4, mm_strdup("("),
+ mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_simple_type(ptr->indicator->type->type,
+ ptr->indicator->type->size,
+ ptr->variable->type->counter),
+ 0);
sprintf(temp, "%d, (", ecpg_internal_var++);
}
else
{
- newind = new_variable(cat_str(4, mm_strdup("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->counter), 0);
+ newind = new_variable(cat_str(4, mm_strdup("*("),
+ mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
+ mm_strdup(" *)(ECPGget_var("),
+ mm_strdup(temp)),
+ ECPGmake_simple_type(ptr->indicator->type->type,
+ ptr->indicator->type->size,
+ ptr->variable->type->counter),
+ 0);
sprintf(temp, "%d, &(", ecpg_internal_var++);
}
/* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
- result = cat_str(5, result, mm_strdup("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), mm_strdup("), __LINE__);\n"));
+ result = cat_str(5, result, mm_strdup("ECPGset_var("),
+ mm_strdup(temp), mm_strdup(original_var),
+ mm_strdup("), __LINE__);\n"));
}
add_variable_to_tail(&newlist, newvar, newind);
}
static void
-add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enum, char *type_dimension, char *type_index, int initializer, int array)
+add_typedef(char *name, char *dimension, char *length, enum ECPGttype type_enum,
+ char *type_dimension, char *type_index, int initializer, int array)
{
/* add entry to list */
struct typedefs *ptr, *this;
if ((type_enum == ECPGt_struct ||
- type_enum == ECPGt_union) &&
- initializer == 1)
+ type_enum == ECPGt_union) &&
+ initializer == 1)
mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
else if (INFORMIX_MODE && strcmp(name, "string") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "type name \"string\" is reserved in Informix mode");
%union {
double dval;
char *str;
- int ival;
+ int ival;
struct when action;
struct index index;
int tagname;
/* src/interfaces/ecpg/preproc/ecpg.trailer */
statements: /*EMPTY*/
- | statements statement
- ;
+ | statements statement
+ ;
-statement: ecpgstart at stmt ';' { connection = NULL; }
- | ecpgstart stmt ';'
- | ecpgstart ECPGVarDeclaration
- {
- fprintf(yyout, "%s", $2);
- free($2);
- output_line_number();
- }
- | ECPGDeclaration
- | c_thing { fprintf(yyout, "%s", $1); free($1); }
- | CPP_LINE { fprintf(yyout, "%s", $1); free($1); }
- | '{' { braces_open++; fputs("{", yyout); }
- | '}'
+statement: ecpgstart at stmt ';' { connection = NULL; }
+ | ecpgstart stmt ';'
+ | ecpgstart ECPGVarDeclaration
+ {
+ fprintf(yyout, "%s", $2);
+ free($2);
+ output_line_number();
+ }
+ | ECPGDeclaration
+ | c_thing { fprintf(yyout, "%s", $1); free($1); }
+ | CPP_LINE { fprintf(yyout, "%s", $1); free($1); }
+ | '{' { braces_open++; fputs("{", yyout); }
+ | '}'
{
remove_typedefs(braces_open);
remove_variables(braces_open--);
}
fputs("}", yyout);
}
- ;
+ ;
CreateAsStmt: CREATE OptTemp TABLE create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
{
$$ = cat_str(6, mm_strdup("create"), $2, mm_strdup("table"), $4, mm_strdup("as"), $7);
}
- ;
+ ;
at: AT connection_object
- {
- connection = $2;
- /*
- * Do we have a variable as connection target?
- * Remove the variable from the variable
- * list or else it will be used twice
- */
- if (argsinsert != NULL)
- argsinsert = NULL;
- }
- ;
+ {
+ connection = $2;
+ /*
+ * Do we have a variable as connection target? Remove the variable
+ * from the variable list or else it will be used twice.
+ */
+ if (argsinsert != NULL)
+ argsinsert = NULL;
+ }
+ ;
/*
* the exec sql connect statement: connect to the given database
$$ = make2_str(mm_strdup("?"), $2);
}
- | /*EMPTY*/ { $$ = EMPTY; }
+ | /*EMPTY*/ { $$ = EMPTY; }
;
connect_options: ColId opt_opt_value
- { $$ = make2_str($1, $2); }
- | ColId opt_opt_value Op connect_options
+ {
+ $$ = make2_str($1, $2);
+ }
+ | ColId opt_opt_value Op connect_options
{
if (strlen($3) == 0)
mmerror(PARSE_ERROR, ET_ERROR, "incomplete statement");
$$ = cat_str(3, make2_str($1, $2), $3, $4);
}
- ;
+ ;
opt_opt_value: /*EMPTY*/
{ $$ = EMPTY; }
{ $$ = make2_str(mm_strdup("="), $2); }
;
-prepared_name: name {
- if ($1[0] == '\"' && $1[strlen($1)-1] == '\"') /* already quoted? */
- $$ = $1;
- else /* not quoted => convert to lowercase */
- {
- size_t i;
+prepared_name: name
+ {
+ if ($1[0] == '\"' && $1[strlen($1)-1] == '\"') /* already quoted? */
+ $$ = $1;
+ else /* not quoted => convert to lowercase */
+ {
+ size_t i;
- for (i = 0; i< strlen($1); i++)
- $1[i] = tolower((unsigned char) $1[i]);
+ for (i = 0; i< strlen($1); i++)
+ $1[i] = tolower((unsigned char) $1[i]);
- $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
- }
- }
- | char_variable { $$ = $1; }
- ;
+ $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
+ }
+ }
+ | char_variable { $$ = $1; }
+ ;
/*
* Declare a prepared cursor. The syntax is different from the standard
{
/* re-definition is a bug */
if ($2[0] == ':')
- mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
- else
+ mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
+ else
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
}
}
| vt_declarations CPP_LINE { $$ = cat2_str($1, $2); }
;
-variable_declarations: var_declaration { $$ = $1; }
- | variable_declarations var_declaration { $$ = cat2_str($1, $2); }
+variable_declarations: var_declaration { $$ = $1; }
+ | variable_declarations var_declaration { $$ = cat2_str($1, $2); }
;
type_declaration: S_TYPEDEF
ECPGstruct_sizeof = mm_strdup(""); /* This must not be NULL to distinguish from simple types. */
$$ = mm_strdup("struct");
}
- | UNION { $$ = mm_strdup("union"); }
+ | UNION
+ {
+ $$ = mm_strdup("union");
+ }
;
simple_type: unsigned_type { $$=$1; }
variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initializer
{
struct ECPGtype * type;
- char *dimension = $3.index1; /* dimension of array */
- char *length = $3.index2; /* length of string */
+ char *dimension = $3.index1; /* dimension of array */
+ char *length = $3.index2; /* length of string */
char *dim_str;
char *vcn;
| ecpg_using { $$ = $1; }
;
-ecpg_using: USING using_list { $$ = EMPTY; }
- | using_descriptor { $$ = $1; }
+ecpg_using: USING using_list { $$ = EMPTY; }
+ | using_descriptor { $$ = $1; }
;
using_descriptor: USING SQL_SQL SQL_DESCRIPTOR quoted_ident_stringvar
UsingConst: Iconst { $$ = $1; }
| '+' Iconst { $$ = cat_str(2, mm_strdup("+"), $2); }
- | '-' Iconst { $$ = cat_str(2, mm_strdup("-"), $2); }
+ | '-' Iconst { $$ = cat_str(2, mm_strdup("-"), $2); }
| ecpg_fconst { $$ = $1; }
| '+' ecpg_fconst { $$ = cat_str(2, mm_strdup("+"), $2); }
- | '-' ecpg_fconst { $$ = cat_str(2, mm_strdup("-"), $2); }
+ | '-' ecpg_fconst { $$ = cat_str(2, mm_strdup("-"), $2); }
| ecpg_sconst { $$ = $1; }
| ecpg_bconst { $$ = $1; }
| ecpg_xconst { $$ = $1; }
;
opt_output: SQL_OUTPUT { $$ = mm_strdup("output"); }
- | /* EMPTY */ { $$ = EMPTY; }
+ | /* EMPTY */ { $$ = EMPTY; }
;
/*
/*
* allocate a descriptor
*/
-ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
+ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
{
add_descriptor($3,connection);
$$ = $3;
}
;
-IntConstVar: Iconst
- {
- char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
+IntConstVar: Iconst
+ {
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
- sprintf(length, "%d", (int) strlen($1));
- new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
- $$ = $1;
- }
- | cvariable { $$ = $1; }
- ;
+ sprintf(length, "%d", (int) strlen($1));
+ new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
+ $$ = $1;
+ }
+ | cvariable
+ {
+ $$ = $1;
+ }
+ ;
desc_header_item: SQL_COUNT { $$ = ECPGd_count; }
;
}
;
-AllConstVar: ecpg_fconst
- {
- char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
-
- sprintf(length, "%d", (int) strlen($1));
- new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
- $$ = $1;
- }
- | IntConstVar { $$ = $1; }
- | '-' ecpg_fconst
- {
- char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
- char *var = cat2_str(mm_strdup("-"), $2);
-
- sprintf(length, "%d", (int) strlen(var));
- new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
- $$ = var;
- }
- | '-' Iconst
- {
- char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
- char *var = cat2_str(mm_strdup("-"), $2);
-
- sprintf(length, "%d", (int) strlen(var));
- new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
- $$ = var;
- }
- | ecpg_sconst
- {
- char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
- char *var = $1 + 1;
-
- var[strlen(var) - 1] = '\0';
- sprintf(length, "%d", (int) strlen(var));
- new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
- $$ = var;
- }
+AllConstVar: ecpg_fconst
+ {
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
+
+ sprintf(length, "%d", (int) strlen($1));
+ new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
+ $$ = $1;
+ }
+
+ | IntConstVar
+ {
+ $$ = $1;
+ }
+
+ | '-' ecpg_fconst
+ {
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
+ char *var = cat2_str(mm_strdup("-"), $2);
+
+ sprintf(length, "%d", (int) strlen(var));
+ new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
+ $$ = var;
+ }
+
+ | '-' Iconst
+ {
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
+ char *var = cat2_str(mm_strdup("-"), $2);
+
+ sprintf(length, "%d", (int) strlen(var));
+ new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
+ $$ = var;
+ }
+
+ | ecpg_sconst
+ {
+ char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
+ char *var = $1 + 1;
+
+ var[strlen(var) - 1] = '\0';
+ sprintf(length, "%d", (int) strlen(var));
+ new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
+ $$ = var;
+ }
;
descriptor_item: SQL_CARDINALITY { $$ = ECPGd_cardinality; }
| DATA_P { $$ = ECPGd_data; }
| SQL_DATETIME_INTERVAL_CODE { $$ = ECPGd_di_code; }
- | SQL_DATETIME_INTERVAL_PRECISION { $$ = ECPGd_di_precision; }
+ | SQL_DATETIME_INTERVAL_PRECISION { $$ = ECPGd_di_precision; }
| SQL_INDICATOR { $$ = ECPGd_indicator; }
| SQL_KEY_MEMBER { $$ = ECPGd_key_member; }
| SQL_LENGTH { $$ = ECPGd_length; }
}
;
-opt_reference: SQL_REFERENCE { $$ = mm_strdup("reference"); }
- | /*EMPTY*/ { $$ = EMPTY; }
+opt_reference: SQL_REFERENCE { $$ = mm_strdup("reference"); }
+ | /*EMPTY*/ { $$ = EMPTY; }
;
/*
/* additional unreserved keywords */
ECPGKeywords: ECPGKeywords_vanames { $$ = $1; }
- | ECPGKeywords_rest { $$ = $1; }
+ | ECPGKeywords_rest { $$ = $1; }
;
ECPGKeywords_vanames: SQL_BREAK { $$ = mm_strdup("break"); }
$$[strlen($1)+3]='\0';
free($1);
}
- | UCONST { $$ = $1; }
- | DOLCONST { $$ = $1; }
+ | UCONST { $$ = $1; }
+ | DOLCONST { $$ = $1; }
;
ecpg_xconst: XCONST { $$ = make_name(); } ;
| '[' { $$ = mm_strdup("["); }
| ']' { $$ = mm_strdup("]"); }
| '=' { $$ = mm_strdup("="); }
- | ':' { $$ = mm_strdup(":"); }
+ | ':' { $$ = mm_strdup(":"); }
;
DeallocateStmt: DEALLOCATE prepared_name { $$ = $2; }
execute_rest: /* EMPTY */ { $$ = EMPTY; }
| ecpg_using ecpg_into { $$ = EMPTY; }
| ecpg_into ecpg_using { $$ = EMPTY; }
- | ecpg_using { $$ = EMPTY; }
- | ecpg_into { $$ = EMPTY; }
+ | ecpg_using { $$ = EMPTY; }
+ | ecpg_into { $$ = EMPTY; }
;
ecpg_into: INTO into_list { $$ = EMPTY; }
- | into_descriptor { $$ = $1; }
+ | into_descriptor { $$ = $1; }
;
ecpg_fetch_into: ecpg_into { $$ = $1; }
extern YYSTYPE yylval;
static int xcdepth = 0; /* depth of nesting in slash-star comments */
-static char *dolqstart; /* current $foo$ quote start string */
+static char *dolqstart; /* current $foo$ quote start string */
static YY_BUFFER_STATE scanbufhandle;
static char *scanbuf;
* to empty, addlit to add text. Note that the buffer is permanently
* malloc'd to the largest size needed so far in the current run.
*/
-static char *literalbuf = NULL; /* expandable buffer */
+static char *literalbuf = NULL; /* expandable buffer */
static int literallen; /* actual current length */
static int literalalloc; /* current allocated buffer size */
{
YY_BUFFER_STATE buffer;
long lineno;
- char *filename;
- struct _yy_buffer *next;
+ char *filename;
+ struct _yy_buffer *next;
} *yy_buffer = NULL;
static char *old;
xnstart [nN]{quote}
/* Quoted string that allows backslash escapes */
-xestart [eE]{quote}
+xestart [eE]{quote}
xeinside [^\\']+
xeescape [\\][^0-7]
xeoctesc [\\][0-7]{1,3}
/* some stuff needed for ecpg */
exec [eE][xX][eE][cC]
-sql [sS][qQ][lL]
+sql [sS][qQ][lL]
define [dD][eE][fF][iI][nN][eE]
-include [iI][nN][cC][lL][uU][dD][eE]
-include_next [iI][nN][cC][lL][uU][dD][eE]_[nN][eE][xX][tT]
-import [iI][mM][pP][oO][rR][tT]
+include [iI][nN][cC][lL][uU][dD][eE]
+include_next [iI][nN][cC][lL][uU][dD][eE]_[nN][eE][xX][tT]
+import [iI][mM][pP][oO][rR][tT]
undef [uU][nN][dD][eE][fF]
-if [iI][fF]
+if [iI][fF]
ifdef [iI][fF][dD][eE][fF]
ifndef [iI][fF][nN][dD][eE][fF]
else [eE][lL][sS][eE]
exec_sql {exec}{space}*{sql}{space}*
ipdigit ({digit}|{digit}{digit}|{digit}{digit}{digit})
-ip {ipdigit}\.{ipdigit}\.{ipdigit}\.{ipdigit}
+ip {ipdigit}\.{ipdigit}\.{ipdigit}\.{ipdigit}
/* we might want to parse all cpp include files */
-cppinclude {space}*#{include}{space}*
+cppinclude {space}*#{include}{space}*
cppinclude_next {space}*#{include_next}{space}*
/* take care of cpp lines, they may also be continuated */
}
<xc>{xcstart} {
xcdepth++;
- /* Put back any characters past slash-star; see above */
- yyless(2);
+ /* Put back any characters past slash-star; see above */
+ yyless(2);
fputs("/*", yyout);
}
<xc>{xcinside} { ECHO; }
<xc>{op_chars} { ECHO; }
-<xc>\*+ { ECHO; }
+<xc>\*+ { ECHO; }
<xc><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated /* comment"); }
addlitchar('x');
}
<xh>{quotestop} |
-<xh>{quotefail} {
+<xh>{quotefail} {
yyless(1);
BEGIN(SQL);
yylval.str = mm_strdup(literalbuf);
}
<xh><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated hexadecimal string literal"); }
-<SQL>{xnstart} {
+<SQL>{xnstart} {
/* National character.
* Transfer it as-is to the backend.
*/
<xq,xqc,xn,xus>{xqinside} { addlit(yytext, yyleng); }
<xe>{xeinside} { addlit(yytext, yyleng); }
<xe>{xeunicode} { addlit(yytext, yyleng); }
-<xe>{xeescape} { addlit(yytext, yyleng); }
+<xe>{xeescape} { addlit(yytext, yyleng); }
<xe>{xeoctesc} { addlit(yytext, yyleng); }
<xe>{xehexesc} { addlit(yytext, yyleng); }
<xq,xqc,xe,xn,xus>{quotecontinue} { /* ignore */ }
-<xe>. {
+<xe>. {
/* This is only needed for \ just before EOF */
addlitchar(yytext[0]);
}
/* and treat it as {other} */
return yytext[0];
}
-<SQL>{dolqdelim} {
+<SQL>{dolqdelim} {
token_start = yytext;
dolqstart = mm_strdup(yytext);
BEGIN(xdolq);
startlit();
addlit(yytext, yyleng);
}
-<xdolq>{dolqdelim} {
+<xdolq>{dolqdelim} {
if (strcmp(yytext, dolqstart) == 0)
{
addlit(yytext, yyleng);
}
else
{
- /*
+ /*
* When we fail to match $...$ to dolqstart, transfer
* the $... part to the output, but put back the final
* $ for rescanning. Consider $delim$...$junk$delim$
*/
- addlit(yytext, yyleng-1);
- yyless(yyleng-1);
+ addlit(yytext, yyleng-1);
+ yyless(yyleng-1);
}
}
-<xdolq>{dolqinside} { addlit(yytext, yyleng); }
+<xdolq>{dolqinside} { addlit(yytext, yyleng); }
<xdolq>{dolqfailed} { addlit(yytext, yyleng); }
<xdolq>{other} {
/* single quote or dollar sign */
addlitchar(yytext[0]);
}
-<xdolq><<EOF>> { base_yyerror("unterminated dollar-quoted string"); }
+<xdolq><<EOF>> { base_yyerror("unterminated dollar-quoted string"); }
<SQL>{xdstart} {
state_before = YYSTATE;
BEGIN(xd);
return(CVARIABLE);
}
<SQL>{identifier} {
- const ScanKeyword *keyword;
+ const ScanKeyword *keyword;
if (!isdefine())
{
BEGIN(incl);
}
else
- {
+ {
yylval.str = mm_strdup(yytext);
return(CPP_LINE);
- }
+ }
}
<C>{cppinclude_next} {
if (system_includes)
BEGIN(incl);
}
else
- {
+ {
yylval.str = mm_strdup(yytext);
return(CPP_LINE);
- }
+ }
}
<C,SQL>{cppline} {
yylval.str = mm_strdup(yytext);
return(CPP_LINE);
}
-<C>{identifier} {
+<C>{identifier} {
const ScanKeyword *keyword;
/*
}
}
<C>{exec_sql}{undef}{space}* { BEGIN(undef); }
-<C>{informix_special}{undef}{space}* {
+<C>{informix_special}{undef}{space}* {
/* are we simulating Informix? */
if (INFORMIX_MODE)
{
BEGIN(C);
}
-<undef>{other}|\n {
- mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL UNDEF command");
- yyterminate();
+<undef>{other}|\n {
+ mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL UNDEF command");
+ yyterminate();
}
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
<C>{informix_special}{include}{space}* {
}
<<EOF>> {
- if (yy_buffer == NULL)
+ if (yy_buffer == NULL)
{
- if ( preproc_tos > 0 )
+ if ( preproc_tos > 0 )
{
- preproc_tos = 0;
+ preproc_tos = 0;
mmerror(PARSE_ERROR, ET_FATAL, "missing \"EXEC SQL ENDIF;\"");
- }
+ }
yyterminate();
}
- else
- {
+ else
+ {
struct _yy_buffer *yb = yy_buffer;
int i;
struct _defines *ptr;
if (i != 0)
output_line_number();
- }
+ }
}
-<INITIAL>{other}|\n
{ mmerror(PARSE_ERROR, ET_FATAL, "internal error: unreachable state; please report this to <
[email protected]>"); }
+<INITIAL>{other}|\n { mmerror(PARSE_ERROR, ET_FATAL, "internal error: unreachable state; please report this to <
[email protected]>"); }
%%
void
lex_init(void)
{
/* got the include file name */
struct _yy_buffer *yb;
- struct _include_path *ip;
- char inc_file[MAXPGPATH];
- unsigned int i;
+ struct _include_path *ip;
+ char inc_file[MAXPGPATH];
+ unsigned int i;
- yb = mm_alloc(sizeof(struct _yy_buffer));
+ yb = mm_alloc(sizeof(struct _yy_buffer));
- yb->buffer = YY_CURRENT_BUFFER;
- yb->lineno = yylineno;
- yb->filename = input_filename;
- yb->next = yy_buffer;
+ yb->buffer = YY_CURRENT_BUFFER;
+ yb->lineno = yylineno;
+ yb->filename = input_filename;
+ yb->next = yy_buffer;
- yy_buffer = yb;
+ yy_buffer = yb;
- /*
+ /*
* skip the ";" if there is one and trailing whitespace. Note that
* yytext contains at least one non-space character plus the ";"
*/
- for (i = strlen(yytext)-2;
+ for (i = strlen(yytext)-2;
i > 0 && ecpg_isspace(yytext[i]);
i--)
;
/* If file name is enclosed in '"' remove these and look only in '.' */
/* Informix does look into all include paths though, except filename starts with '/' */
if (yytext[0] == '"' && yytext[i] == '"' &&
- ((compat != ECPG_COMPAT_INFORMIX && compat != ECPG_COMPAT_INFORMIX_SE) || yytext[1] == '/'))
+ ((compat != ECPG_COMPAT_INFORMIX && compat != ECPG_COMPAT_INFORMIX_SE) || yytext[1] == '/'))
{
yytext[i] = '\0';
memmove(yytext, yytext+1, strlen(yytext));
memmove(yytext, yytext+1, strlen(yytext));
}
- for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
- {
+ for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
+ {
if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH)
{
fprintf(stderr, _("Error: include path \"%s/%s\" is too long on line %d, skipping\n"), ip->path, yytext, yylineno);
yylineno = 1;
output_line_number();
- BEGIN(C);
+ BEGIN(C);
}
/*
if (strcmp(yytext, "dec_t") == 0)
new = "decimal";
else if (strcmp(yytext, "intrvl_t") == 0)
- new = "interval";
+ new = "interval";
else if (strcmp(yytext, "dtime_t") == 0)
- new = "timestamp";
+ new = "timestamp";
if (new)
{
static PLpgSQL_stmt *make_return_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_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);
static char *NameOfDatum(PLwdatum *wdatum);
static void check_assignable(PLpgSQL_datum *datum, int location);
static void check_labels(const char *start_label,
const char *end_label,
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);
static List *read_raise_options(void);
char *name;
int lineno;
PLpgSQL_datum *scalar;
- PLpgSQL_rec *rec;
- PLpgSQL_row *row;
+ PLpgSQL_rec *rec;
+ PLpgSQL_row *row;
} forvariable;
struct
{
plpgsql_push_back_token(K_WHEN);
$$ = expr;
}
- ;
+ ;
case_when_list : case_when_list case_when
{
if ($2->cursor_explicit_expr == NULL)
{
/* be nice if we could use opt_scrollable here */
- tok = yylex();
+ tok = yylex();
if (tok_is_keyword(tok, &yylval,
K_NO, "no"))
{
PLpgSQL_exception *new;
new = palloc0(sizeof(PLpgSQL_exception));
- new->lineno = plpgsql_location_to_lineno(@1);
+ new->lineno = plpgsql_location_to_lineno(@1);
new->conditions = $2;
- new->action = $4;
+ new->action = $4;
$$ = new;
}
expr->query = pstrdup(ds.data);
expr->plan = NULL;
expr->paramnos = NULL;
- expr->ns = plpgsql_ns_top();
+ expr->ns = plpgsql_ns_top();
pfree(ds.data);
if (valid_sql)
expr->query = pstrdup(ds.data);
expr->plan = NULL;
expr->paramnos = NULL;
- expr->ns = plpgsql_ns_top();
+ expr->ns = plpgsql_ns_top();
pfree(ds.data);
check_sql_expr(expr->query, location, 0);
/* set direction defaults: */
fetch->direction = FETCH_FORWARD;
fetch->how_many = 1;
- fetch->expr = NULL;
+ fetch->expr = NULL;
fetch->returns_multiple_rows = false;
tok = yylex();
make_case(int location, PLpgSQL_expr *t_expr,
List *case_when_list, List *else_stmts)
{
- PLpgSQL_stmt_case *new;
+ PLpgSQL_stmt_case *new;
new = palloc(sizeof(PLpgSQL_stmt_case));
new->cmd_type = PLPGSQL_STMT_CASE;
static void
addlitchar(char c)
{
- if (litbufpos >= sizeof(litbuf) - 1)
- {
- fprintf(stderr, "SQL step too long\n");
- exit(1);
- }
- litbuf[litbufpos++] = c;
+ if (litbufpos >= sizeof(litbuf) - 1)
+ {
+ fprintf(stderr, "SQL step too long\n");
+ exit(1);
+ }
+ litbuf[litbufpos++] = c;
}
void