Commit 92fb6498 authored by Tom Lane's avatar Tom Lane

Use "%option prefix" to set API names in ecpg's lexer.

Clean up some technical debt left behind by commit 72b1e3a2: instead of
quickly hacking the name of base_yylex() with a #define, set it properly
with "%option prefix".  This causes the names of pgc.l's other exported
symbols to change as well, so run around and modify the outside references
to them as needed.  Similarly, make pgc.l's external references to
base_yylval use that variable's true name instead of a macro.

The reason for doing this now is that the quick-hack solution will fail
with future versions of flex, as reported by Дилян Палаузов.
Hence, back-patch into 9.6 where the previous commit appeared, since
it's likely people will build 9.6 with newer flex versions during
its lifetime.

Discussion: https://postgr.es/m/d845c1af-e18d-6651-178f-9f08cdf37e10@aegee.org
parent 0eaaaf00
...@@ -58,7 +58,7 @@ ECPGnumeric_lvalue(char *name) ...@@ -58,7 +58,7 @@ ECPGnumeric_lvalue(char *name)
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
case ECPGt_unsigned_long_long: case ECPGt_unsigned_long_long:
case ECPGt_const: case ECPGt_const:
fputs(name, yyout); fputs(name, base_yyout);
break; break;
default: default:
mmerror(PARSE_ERROR, ET_ERROR, "variable \"%s\" must have a numeric type", name); mmerror(PARSE_ERROR, ET_ERROR, "variable \"%s\" must have a numeric type", name);
...@@ -152,7 +152,7 @@ output_get_descr_header(char *desc_name) ...@@ -152,7 +152,7 @@ output_get_descr_header(char *desc_name)
{ {
struct assignment *results; struct assignment *results;
fprintf(yyout, "{ ECPGget_desc_header(__LINE__, %s, &(", desc_name); fprintf(base_yyout, "{ ECPGget_desc_header(__LINE__, %s, &(", desc_name);
for (results = assignments; results != NULL; results = results->next) for (results = assignments; results != NULL; results = results->next)
{ {
if (results->value == ECPGd_count) if (results->value == ECPGd_count)
...@@ -162,7 +162,7 @@ output_get_descr_header(char *desc_name) ...@@ -162,7 +162,7 @@ output_get_descr_header(char *desc_name)
} }
drop_assignments(); drop_assignments();
fprintf(yyout, "));\n"); fprintf(base_yyout, "));\n");
whenever_action(3); whenever_action(3);
} }
...@@ -171,7 +171,7 @@ output_get_descr(char *desc_name, char *index) ...@@ -171,7 +171,7 @@ output_get_descr(char *desc_name, char *index)
{ {
struct assignment *results; struct assignment *results;
fprintf(yyout, "{ ECPGget_desc(__LINE__, %s, %s,", desc_name, index); fprintf(base_yyout, "{ ECPGget_desc(__LINE__, %s, %s,", desc_name, index);
for (results = assignments; results != NULL; results = results->next) for (results = assignments; results != NULL; results = results->next)
{ {
const struct variable *v = find_variable(results->variable); const struct variable *v = find_variable(results->variable);
...@@ -188,12 +188,13 @@ output_get_descr(char *desc_name, char *index) ...@@ -188,12 +188,13 @@ output_get_descr(char *desc_name, char *index)
default: default:
break; break;
} }
fprintf(yyout, "%s,", get_dtype(results->value)); fprintf(base_yyout, "%s,", get_dtype(results->value));
ECPGdump_a_type(yyout, v->name, v->type, v->brace_level, NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL); ECPGdump_a_type(base_yyout, v->name, v->type, v->brace_level,
NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL);
free(str_zero); free(str_zero);
} }
drop_assignments(); drop_assignments();
fputs("ECPGd_EODT);\n", yyout); fputs("ECPGd_EODT);\n", base_yyout);
whenever_action(2 | 1); whenever_action(2 | 1);
} }
...@@ -203,7 +204,7 @@ output_set_descr_header(char *desc_name) ...@@ -203,7 +204,7 @@ output_set_descr_header(char *desc_name)
{ {
struct assignment *results; struct assignment *results;
fprintf(yyout, "{ ECPGset_desc_header(__LINE__, %s, (int)(", desc_name); fprintf(base_yyout, "{ ECPGset_desc_header(__LINE__, %s, (int)(", desc_name);
for (results = assignments; results != NULL; results = results->next) for (results = assignments; results != NULL; results = results->next)
{ {
if (results->value == ECPGd_count) if (results->value == ECPGd_count)
...@@ -213,7 +214,7 @@ output_set_descr_header(char *desc_name) ...@@ -213,7 +214,7 @@ output_set_descr_header(char *desc_name)
} }
drop_assignments(); drop_assignments();
fprintf(yyout, "));\n"); fprintf(base_yyout, "));\n");
whenever_action(3); whenever_action(3);
} }
...@@ -264,7 +265,7 @@ output_set_descr(char *desc_name, char *index) ...@@ -264,7 +265,7 @@ output_set_descr(char *desc_name, char *index)
{ {
struct assignment *results; struct assignment *results;
fprintf(yyout, "{ ECPGset_desc(__LINE__, %s, %s,", desc_name, index); fprintf(base_yyout, "{ ECPGset_desc(__LINE__, %s, %s,", desc_name, index);
for (results = assignments; results != NULL; results = results->next) for (results = assignments; results != NULL; results = results->next)
{ {
const struct variable *v = find_variable(results->variable); const struct variable *v = find_variable(results->variable);
...@@ -297,8 +298,9 @@ output_set_descr(char *desc_name, char *index) ...@@ -297,8 +298,9 @@ output_set_descr(char *desc_name, char *index)
{ {
char *str_zero = mm_strdup("0"); char *str_zero = mm_strdup("0");
fprintf(yyout, "%s,", get_dtype(results->value)); fprintf(base_yyout, "%s,", get_dtype(results->value));
ECPGdump_a_type(yyout, v->name, v->type, v->brace_level, NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL); ECPGdump_a_type(base_yyout, v->name, v->type, v->brace_level,
NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL);
free(str_zero); free(str_zero);
} }
break; break;
...@@ -308,7 +310,7 @@ output_set_descr(char *desc_name, char *index) ...@@ -308,7 +310,7 @@ output_set_descr(char *desc_name, char *index)
} }
} }
drop_assignments(); drop_assignments();
fputs("ECPGd_EODT);\n", yyout); fputs("ECPGd_EODT);\n", base_yyout);
whenever_action(2 | 1); whenever_action(2 | 1);
} }
......
...@@ -8,7 +8,7 @@ ECPG: stmtClosePortalStmt block ...@@ -8,7 +8,7 @@ ECPG: stmtClosePortalStmt block
if (connection) if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CLOSE DATABASE statement"); mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CLOSE DATABASE statement");
fprintf(yyout, "{ ECPGdisconnect(__LINE__, \"CURRENT\");"); fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, \"CURRENT\");");
whenever_action(2); whenever_action(2);
free($1); free($1);
break; break;
...@@ -42,14 +42,14 @@ ECPG: stmtPrepareStmt block ...@@ -42,14 +42,14 @@ ECPG: stmtPrepareStmt block
} }
ECPG: stmtTransactionStmt block ECPG: stmtTransactionStmt block
{ {
fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1); fprintf(base_yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
whenever_action(2); whenever_action(2);
free($1); free($1);
} }
ECPG: stmtViewStmt rule ECPG: stmtViewStmt rule
| ECPGAllocateDescr | ECPGAllocateDescr
{ {
fprintf(yyout,"ECPGallocate_desc(__LINE__, %s);",$1); fprintf(base_yyout,"ECPGallocate_desc(__LINE__, %s);",$1);
whenever_action(0); whenever_action(0);
free($1); free($1);
} }
...@@ -58,7 +58,7 @@ ECPG: stmtViewStmt rule ...@@ -58,7 +58,7 @@ ECPG: stmtViewStmt rule
if (connection) if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CONNECT statement"); mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CONNECT statement");
fprintf(yyout, "{ ECPGconnect(__LINE__, %d, %s, %d); ", compat, $1, autocommit); fprintf(base_yyout, "{ ECPGconnect(__LINE__, %d, %s, %d); ", compat, $1, autocommit);
reset_variables(); reset_variables();
whenever_action(2); whenever_action(2);
free($1); free($1);
...@@ -69,7 +69,7 @@ ECPG: stmtViewStmt rule ...@@ -69,7 +69,7 @@ ECPG: stmtViewStmt rule
} }
| ECPGDeallocateDescr | ECPGDeallocateDescr
{ {
fprintf(yyout,"ECPGdeallocate_desc(__LINE__, %s);",$1); fprintf(base_yyout,"ECPGdeallocate_desc(__LINE__, %s);",$1);
whenever_action(0); whenever_action(0);
free($1); free($1);
} }
...@@ -79,10 +79,10 @@ ECPG: stmtViewStmt rule ...@@ -79,10 +79,10 @@ ECPG: stmtViewStmt rule
} }
| ECPGDescribe | ECPGDescribe
{ {
fprintf(yyout, "{ ECPGdescribe(__LINE__, %d, %s,", compat, $1); fprintf(base_yyout, "{ ECPGdescribe(__LINE__, %d, %s,", compat, $1);
dump_variables(argsresult, 1); dump_variables(argsresult, 1);
fputs("ECPGt_EORT);", yyout); fputs("ECPGt_EORT);", base_yyout);
fprintf(yyout, "}"); fprintf(base_yyout, "}");
output_line_number(); output_line_number();
free($1); free($1);
...@@ -92,7 +92,7 @@ ECPG: stmtViewStmt rule ...@@ -92,7 +92,7 @@ ECPG: stmtViewStmt rule
if (connection) if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DISCONNECT statement"); mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DISCONNECT statement");
fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);", fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, %s);",
$1 ? $1 : "\"CURRENT\""); $1 ? $1 : "\"CURRENT\"");
whenever_action(2); whenever_action(2);
free($1); free($1);
...@@ -103,11 +103,11 @@ ECPG: stmtViewStmt rule ...@@ -103,11 +103,11 @@ ECPG: stmtViewStmt rule
const char *con = connection ? connection : "NULL"; const char *con = connection ? connection : "NULL";
if (strcmp($1, "all") == 0) if (strcmp($1, "all") == 0)
fprintf(yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con); fprintf(base_yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con);
else if ($1[0] == ':') else if ($1[0] == ':')
fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, %s);", compat, con, $1+1); fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, %s);", compat, con, $1+1);
else else
fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, \"%s\");", compat, con, $1); fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, \"%s\");", compat, con, $1);
whenever_action(2); whenever_action(2);
free($1); free($1);
...@@ -138,7 +138,7 @@ ECPG: stmtViewStmt rule ...@@ -138,7 +138,7 @@ ECPG: stmtViewStmt rule
} }
| ECPGSetAutocommit | ECPGSetAutocommit
{ {
fprintf(yyout, "{ ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL"); fprintf(base_yyout, "{ ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL");
whenever_action(2); whenever_action(2);
free($1); free($1);
} }
...@@ -147,7 +147,7 @@ ECPG: stmtViewStmt rule ...@@ -147,7 +147,7 @@ ECPG: stmtViewStmt rule
if (connection) if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in SET CONNECTION statement"); mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in SET CONNECTION statement");
fprintf(yyout, "{ ECPGsetconn(__LINE__, %s);", $1); fprintf(base_yyout, "{ ECPGsetconn(__LINE__, %s);", $1);
whenever_action(2); whenever_action(2);
free($1); free($1);
} }
...@@ -169,7 +169,7 @@ ECPG: stmtViewStmt rule ...@@ -169,7 +169,7 @@ ECPG: stmtViewStmt rule
if (connection) if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in TYPE statement"); mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in TYPE statement");
fprintf(yyout, "%s", $1); fprintf(base_yyout, "%s", $1);
free($1); free($1);
output_line_number(); output_line_number();
} }
......
...@@ -165,11 +165,11 @@ main(int argc, char *const argv[]) ...@@ -165,11 +165,11 @@ main(int argc, char *const argv[])
case 'o': case 'o':
output_filename = mm_strdup(optarg); output_filename = mm_strdup(optarg);
if (strcmp(output_filename, "-") == 0) if (strcmp(output_filename, "-") == 0)
yyout = stdout; base_yyout = stdout;
else else
yyout = fopen(output_filename, PG_BINARY_W); base_yyout = fopen(output_filename, PG_BINARY_W);
if (yyout == NULL) if (base_yyout == NULL)
{ {
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"), fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, output_filename, strerror(errno)); progname, output_filename, strerror(errno));
...@@ -232,7 +232,7 @@ main(int argc, char *const argv[]) ...@@ -232,7 +232,7 @@ main(int argc, char *const argv[])
break; break;
case 'd': case 'd':
#ifdef YYDEBUG #ifdef YYDEBUG
yydebug = 1; base_yydebug = 1;
#else #else
fprintf(stderr, _("%s: parser debug support (-d) not available\n"), fprintf(stderr, _("%s: parser debug support (-d) not available\n"),
progname); progname);
...@@ -280,7 +280,7 @@ main(int argc, char *const argv[]) ...@@ -280,7 +280,7 @@ main(int argc, char *const argv[])
{ {
input_filename = mm_alloc(strlen("stdin") + 1); input_filename = mm_alloc(strlen("stdin") + 1);
strcpy(input_filename, "stdin"); strcpy(input_filename, "stdin");
yyin = stdin; base_yyin = stdin;
} }
else else
{ {
...@@ -304,13 +304,13 @@ main(int argc, char *const argv[]) ...@@ -304,13 +304,13 @@ main(int argc, char *const argv[])
ptr2ext[4] = '\0'; ptr2ext[4] = '\0';
} }
yyin = fopen(input_filename, PG_BINARY_R); base_yyin = fopen(input_filename, PG_BINARY_R);
} }
if (out_option == 0) /* calculate the output name */ if (out_option == 0) /* calculate the output name */
{ {
if (strcmp(input_filename, "stdin") == 0) if (strcmp(input_filename, "stdin") == 0)
yyout = stdout; base_yyout = stdout;
else else
{ {
output_filename = mm_strdup(input_filename); output_filename = mm_strdup(input_filename);
...@@ -320,8 +320,8 @@ main(int argc, char *const argv[]) ...@@ -320,8 +320,8 @@ main(int argc, char *const argv[])
ptr2ext[1] = (header_mode == true) ? 'h' : 'c'; ptr2ext[1] = (header_mode == true) ? 'h' : 'c';
ptr2ext[2] = '\0'; ptr2ext[2] = '\0';
yyout = fopen(output_filename, PG_BINARY_W); base_yyout = fopen(output_filename, PG_BINARY_W);
if (yyout == NULL) if (base_yyout == NULL)
{ {
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"), fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, output_filename, strerror(errno)); progname, output_filename, strerror(errno));
...@@ -332,7 +332,7 @@ main(int argc, char *const argv[]) ...@@ -332,7 +332,7 @@ main(int argc, char *const argv[])
} }
} }
if (yyin == NULL) if (base_yyin == NULL)
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"), fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, argv[fnr], strerror(errno)); progname, argv[fnr], strerror(errno));
else else
...@@ -427,23 +427,23 @@ main(int argc, char *const argv[]) ...@@ -427,23 +427,23 @@ main(int argc, char *const argv[])
/* we need several includes */ /* we need several includes */
/* but not if we are in header mode */ /* but not if we are in header mode */
if (regression_mode) if (regression_mode)
fprintf(yyout, "/* Processed by ecpg (regression mode) */\n"); fprintf(base_yyout, "/* Processed by ecpg (regression mode) */\n");
else else
fprintf(yyout, "/* Processed by ecpg (%s) */\n", PG_VERSION); fprintf(base_yyout, "/* Processed by ecpg (%s) */\n", PG_VERSION);
if (header_mode == false) if (header_mode == false)
{ {
fprintf(yyout, "/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n"); fprintf(base_yyout, "/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
/* add some compatibility headers */ /* add some compatibility headers */
if (INFORMIX_MODE) if (INFORMIX_MODE)
fprintf(yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n"); fprintf(base_yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
fprintf(yyout, "/* End of automatic include section */\n"); fprintf(base_yyout, "/* End of automatic include section */\n");
} }
if (regression_mode) if (regression_mode)
fprintf(yyout, "#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))\n"); fprintf(base_yyout, "#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))\n");
output_line_number(); output_line_number();
...@@ -458,10 +458,10 @@ main(int argc, char *const argv[]) ...@@ -458,10 +458,10 @@ main(int argc, char *const argv[])
if (!(ptr->opened)) if (!(ptr->opened))
mmerror(PARSE_ERROR, ET_WARNING, "cursor \"%s\" has been declared but not opened", ptr->name); mmerror(PARSE_ERROR, ET_WARNING, "cursor \"%s\" has been declared but not opened", ptr->name);
if (yyin != NULL && yyin != stdin) if (base_yyin != NULL && base_yyin != stdin)
fclose(yyin); fclose(base_yyin);
if (out_option == 0 && yyout != stdout) if (out_option == 0 && base_yyout != stdout)
fclose(yyout); fclose(base_yyout);
/* /*
* If there was an error, delete the output file. * If there was an error, delete the output file.
......
...@@ -72,7 +72,7 @@ vmmerror(int error_code, enum errortype type, const char *error, va_list ap) ...@@ -72,7 +72,7 @@ vmmerror(int error_code, enum errortype type, const char *error, va_list ap)
/* localize the error message string */ /* localize the error message string */
error = _(error); error = _(error);
fprintf(stderr, "%s:%d: ", input_filename, yylineno); fprintf(stderr, "%s:%d: ", input_filename, base_yylineno);
switch(type) switch(type)
{ {
...@@ -117,10 +117,10 @@ mmfatal(int error_code, const char *error, ...) ...@@ -117,10 +117,10 @@ mmfatal(int error_code, const char *error, ...)
vmmerror(error_code, ET_ERROR, error, ap); vmmerror(error_code, ET_ERROR, error, ap);
va_end(ap); va_end(ap);
if (yyin) if (base_yyin)
fclose(yyin); fclose(base_yyin);
if (yyout) if (base_yyout)
fclose(yyout); fclose(base_yyout);
if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0) 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);
...@@ -195,7 +195,7 @@ make3_str(char *str1, char *str2, char *str3) ...@@ -195,7 +195,7 @@ make3_str(char *str1, char *str2, char *str3)
static char * static char *
make_name(void) make_name(void)
{ {
return mm_strdup(yytext); return mm_strdup(base_yytext);
} }
static char * static char *
......
...@@ -8,14 +8,14 @@ statement: ecpgstart at stmt ';' { connection = NULL; } ...@@ -8,14 +8,14 @@ statement: ecpgstart at stmt ';' { connection = NULL; }
| ecpgstart stmt ';' | ecpgstart stmt ';'
| ecpgstart ECPGVarDeclaration | ecpgstart ECPGVarDeclaration
{ {
fprintf(yyout, "%s", $2); fprintf(base_yyout, "%s", $2);
free($2); free($2);
output_line_number(); output_line_number();
} }
| ECPGDeclaration | ECPGDeclaration
| c_thing { fprintf(yyout, "%s", $1); free($1); } | c_thing { fprintf(base_yyout, "%s", $1); free($1); }
| CPP_LINE { fprintf(yyout, "%s", $1); free($1); } | CPP_LINE { fprintf(base_yyout, "%s", $1); free($1); }
| '{' { braces_open++; fputs("{", yyout); } | '{' { braces_open++; fputs("{", base_yyout); }
| '}' | '}'
{ {
remove_typedefs(braces_open); remove_typedefs(braces_open);
...@@ -25,7 +25,7 @@ statement: ecpgstart at stmt ';' { connection = NULL; } ...@@ -25,7 +25,7 @@ statement: ecpgstart at stmt ';' { connection = NULL; }
free(current_function); free(current_function);
current_function = NULL; current_function = NULL;
} }
fputs("}", yyout); fputs("}", base_yyout);
} }
; ;
...@@ -380,10 +380,10 @@ ecpg_interval: opt_interval { $$ = $1; } ...@@ -380,10 +380,10 @@ ecpg_interval: opt_interval { $$ = $1; }
* variable declaration inside exec sql declare block * variable declaration inside exec sql declare block
*/ */
ECPGDeclaration: sql_startdeclare ECPGDeclaration: sql_startdeclare
{ fputs("/* exec sql begin declare section */", yyout); } { fputs("/* exec sql begin declare section */", base_yyout); }
var_type_declarations sql_enddeclare var_type_declarations sql_enddeclare
{ {
fprintf(yyout, "%s/* exec sql end declare section */", $3); fprintf(base_yyout, "%s/* exec sql end declare section */", $3);
free($3); free($3);
output_line_number(); output_line_number();
} }
...@@ -417,7 +417,7 @@ type_declaration: S_TYPEDEF ...@@ -417,7 +417,7 @@ type_declaration: S_TYPEDEF
{ {
add_typedef($5, $6.index1, $6.index2, $3.type_enum, $3.type_dimension, $3.type_index, initializer, *$4 ? 1 : 0); add_typedef($5, $6.index1, $6.index2, $3.type_enum, $3.type_dimension, $3.type_index, initializer, *$4 ? 1 : 0);
fprintf(yyout, "typedef %s %s %s %s;\n", $3.type_str, *$4 ? "*" : "", $5, $6.str); fprintf(base_yyout, "typedef %s %s %s %s;\n", $3.type_str, *$4 ? "*" : "", $5, $6.str);
output_line_number(); output_line_number();
$$ = mm_strdup(""); $$ = mm_strdup("");
}; };
...@@ -1909,7 +1909,7 @@ void base_yyerror(const char *error) ...@@ -1909,7 +1909,7 @@ void base_yyerror(const char *error)
{ {
/* translator: %s is typically the translation of "syntax error" */ /* translator: %s is typically the translation of "syntax error" */
mmerror(PARSE_ERROR, ET_ERROR, "%s at or near \"%s\"", mmerror(PARSE_ERROR, ET_ERROR, "%s at or near \"%s\"",
_(error), token_start ? token_start : yytext); _(error), token_start ? token_start : base_yytext);
} }
void parser_init(void) void parser_init(void)
......
...@@ -35,15 +35,15 @@ extern char *descriptor_index; ...@@ -35,15 +35,15 @@ extern char *descriptor_index;
extern char *descriptor_name; extern char *descriptor_name;
extern char *connection; extern char *connection;
extern char *input_filename; extern char *input_filename;
extern char *yytext, extern char *base_yytext,
*token_start; *token_start;
#ifdef YYDEBUG #ifdef YYDEBUG
extern int yydebug; extern int base_yydebug;
#endif #endif
extern int yylineno; extern int base_yylineno;
extern FILE *yyin, extern FILE *base_yyin,
*yyout; *base_yyout;
extern char *output_filename; extern char *output_filename;
extern struct _include_path *include_paths; extern struct _include_path *include_paths;
......
...@@ -11,7 +11,7 @@ output_line_number(void) ...@@ -11,7 +11,7 @@ output_line_number(void)
{ {
char *line = hashline_number(); char *line = hashline_number();
fprintf(yyout, "%s", line); fprintf(base_yyout, "%s", line);
free(line); free(line);
} }
...@@ -37,22 +37,22 @@ print_action(struct when * w) ...@@ -37,22 +37,22 @@ print_action(struct when * w)
switch (w->code) switch (w->code)
{ {
case W_SQLPRINT: case W_SQLPRINT:
fprintf(yyout, "sqlprint();"); fprintf(base_yyout, "sqlprint();");
break; break;
case W_GOTO: case W_GOTO:
fprintf(yyout, "goto %s;", w->command); fprintf(base_yyout, "goto %s;", w->command);
break; break;
case W_DO: case W_DO:
fprintf(yyout, "%s;", w->command); fprintf(base_yyout, "%s;", w->command);
break; break;
case W_STOP: case W_STOP:
fprintf(yyout, "exit (1);"); fprintf(base_yyout, "exit (1);");
break; break;
case W_BREAK: case W_BREAK:
fprintf(yyout, "break;"); fprintf(base_yyout, "break;");
break; break;
default: default:
fprintf(yyout, "{/* %d not implemented yet */}", w->code); fprintf(base_yyout, "{/* %d not implemented yet */}", w->code);
break; break;
} }
} }
...@@ -63,24 +63,24 @@ whenever_action(int mode) ...@@ -63,24 +63,24 @@ whenever_action(int mode)
if ((mode & 1) == 1 && when_nf.code != W_NOTHING) if ((mode & 1) == 1 && when_nf.code != W_NOTHING)
{ {
output_line_number(); output_line_number();
fprintf(yyout, "\nif (sqlca.sqlcode == ECPG_NOT_FOUND) "); fprintf(base_yyout, "\nif (sqlca.sqlcode == ECPG_NOT_FOUND) ");
print_action(&when_nf); print_action(&when_nf);
} }
if (when_warn.code != W_NOTHING) if (when_warn.code != W_NOTHING)
{ {
output_line_number(); output_line_number();
fprintf(yyout, "\nif (sqlca.sqlwarn[0] == 'W') "); fprintf(base_yyout, "\nif (sqlca.sqlwarn[0] == 'W') ");
print_action(&when_warn); print_action(&when_warn);
} }
if (when_error.code != W_NOTHING) if (when_error.code != W_NOTHING)
{ {
output_line_number(); output_line_number();
fprintf(yyout, "\nif (sqlca.sqlcode < 0) "); fprintf(base_yyout, "\nif (sqlca.sqlcode < 0) ");
print_action(&when_error); print_action(&when_error);
} }
if ((mode & 2) == 2) if ((mode & 2) == 2)
fputc('}', yyout); fputc('}', base_yyout);
output_line_number(); output_line_number();
} }
...@@ -91,7 +91,7 @@ hashline_number(void) ...@@ -91,7 +91,7 @@ hashline_number(void)
/* do not print line numbers if we are in debug mode */ /* do not print line numbers if we are in debug mode */
if (input_filename if (input_filename
#ifdef YYDEBUG #ifdef YYDEBUG
&& !yydebug && !base_yydebug
#endif #endif
) )
{ {
...@@ -100,7 +100,7 @@ hashline_number(void) ...@@ -100,7 +100,7 @@ hashline_number(void)
char *src, char *src,
*dest; *dest;
sprintf(line, "\n#line %d \"", yylineno); sprintf(line, "\n#line %d \"", base_yylineno);
src = input_filename; src = input_filename;
dest = line + strlen(line); dest = line + strlen(line);
while (*src) while (*src)
...@@ -128,27 +128,27 @@ static char *ecpg_statement_type_name[] = { ...@@ -128,27 +128,27 @@ static char *ecpg_statement_type_name[] = {
void void
output_statement(char *stmt, int whenever_mode, enum ECPG_statement_type st) output_statement(char *stmt, int whenever_mode, enum ECPG_statement_type st)
{ {
fprintf(yyout, "{ ECPGdo(__LINE__, %d, %d, %s, %d, ", compat, force_indicator, connection ? connection : "NULL", questionmarks); fprintf(base_yyout, "{ ECPGdo(__LINE__, %d, %d, %s, %d, ", compat, force_indicator, connection ? connection : "NULL", questionmarks);
if (st == ECPGst_execute || st == ECPGst_exec_immediate) if (st == ECPGst_execute || st == ECPGst_exec_immediate)
{ {
fprintf(yyout, "%s, %s, ", ecpg_statement_type_name[st], stmt); fprintf(base_yyout, "%s, %s, ", ecpg_statement_type_name[st], stmt);
} }
else else
{ {
if (st == ECPGst_prepnormal && auto_prepare) if (st == ECPGst_prepnormal && auto_prepare)
fputs("ECPGst_prepnormal, \"", yyout); fputs("ECPGst_prepnormal, \"", base_yyout);
else else
fputs("ECPGst_normal, \"", yyout); fputs("ECPGst_normal, \"", base_yyout);
output_escaped_str(stmt, false); output_escaped_str(stmt, false);
fputs("\", ", yyout); fputs("\", ", base_yyout);
} }
/* dump variables to C file */ /* dump variables to C file */
dump_variables(argsinsert, 1); dump_variables(argsinsert, 1);
fputs("ECPGt_EOIT, ", yyout); fputs("ECPGt_EOIT, ", base_yyout);
dump_variables(argsresult, 1); dump_variables(argsresult, 1);
fputs("ECPGt_EORT);", yyout); fputs("ECPGt_EORT);", base_yyout);
reset_variables(); reset_variables();
whenever_action(whenever_mode | 2); whenever_action(whenever_mode | 2);
...@@ -160,11 +160,11 @@ output_statement(char *stmt, int whenever_mode, enum ECPG_statement_type st) ...@@ -160,11 +160,11 @@ output_statement(char *stmt, int whenever_mode, enum ECPG_statement_type st)
void void
output_prepare_statement(char *name, char *stmt) output_prepare_statement(char *name, char *stmt)
{ {
fprintf(yyout, "{ ECPGprepare(__LINE__, %s, %d, ", connection ? connection : "NULL", questionmarks); fprintf(base_yyout, "{ ECPGprepare(__LINE__, %s, %d, ", connection ? connection : "NULL", questionmarks);
output_escaped_str(name, true); output_escaped_str(name, true);
fputs(", ", yyout); fputs(", ", base_yyout);
output_escaped_str(stmt, true); output_escaped_str(stmt, true);
fputs(");", yyout); fputs(");", base_yyout);
whenever_action(2); whenever_action(2);
free(name); free(name);
if (connection != NULL) if (connection != NULL)
...@@ -178,12 +178,12 @@ output_deallocate_prepare_statement(char *name) ...@@ -178,12 +178,12 @@ output_deallocate_prepare_statement(char *name)
if (strcmp(name, "all") != 0) if (strcmp(name, "all") != 0)
{ {
fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, ", compat, con); fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, ", compat, con);
output_escaped_str(name, true); output_escaped_str(name, true);
fputs(");", yyout); fputs(");", base_yyout);
} }
else else
fprintf(yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con); fprintf(base_yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con);
whenever_action(2); whenever_action(2);
free(name); free(name);
...@@ -203,16 +203,16 @@ output_escaped_str(char *str, bool quoted) ...@@ -203,16 +203,16 @@ output_escaped_str(char *str, bool quoted)
{ {
i = 1; i = 1;
len--; len--;
fputs("\"", yyout); fputs("\"", base_yyout);
} }
/* output this char by char as we have to filter " and \n */ /* output this char by char as we have to filter " and \n */
for (; i < len; i++) for (; i < len; i++)
{ {
if (str[i] == '"') if (str[i] == '"')
fputs("\\\"", yyout); fputs("\\\"", base_yyout);
else if (str[i] == '\n') else if (str[i] == '\n')
fputs("\\\n", yyout); fputs("\\\n", base_yyout);
else if (str[i] == '\\') else if (str[i] == '\\')
{ {
int j = i; int j = i;
...@@ -230,17 +230,17 @@ output_escaped_str(char *str, bool quoted) ...@@ -230,17 +230,17 @@ output_escaped_str(char *str, bool quoted)
if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a
* newline */ * newline */
fputs("\\\\", yyout); fputs("\\\\", base_yyout);
} }
else if (str[i] == '\r' && str[i + 1] == '\n') else if (str[i] == '\r' && str[i + 1] == '\n')
{ {
fputs("\\\r\n", yyout); fputs("\\\r\n", base_yyout);
i++; i++;
} }
else else
fputc(str[i], yyout); fputc(str[i], base_yyout);
} }
if (quoted && str[0] == '"' && str[len] == '"') if (quoted && str[0] == '"' && str[len] == '"')
fputs("\"", yyout); fputs("\"", base_yyout);
} }
...@@ -60,7 +60,7 @@ filtered_base_yylex(void) ...@@ -60,7 +60,7 @@ filtered_base_yylex(void)
cur_token = lookahead_token; cur_token = lookahead_token;
base_yylval = lookahead_yylval; base_yylval = lookahead_yylval;
base_yylloc = lookahead_yylloc; base_yylloc = lookahead_yylloc;
yytext = lookahead_yytext; base_yytext = lookahead_yytext;
*lookahead_end = lookahead_hold_char; *lookahead_end = lookahead_hold_char;
have_lookahead = false; have_lookahead = false;
} }
...@@ -93,13 +93,13 @@ filtered_base_yylex(void) ...@@ -93,13 +93,13 @@ filtered_base_yylex(void)
* '\0' here, and will undo that when we call it again. We need to redo * '\0' here, and will undo that when we call it again. We need to redo
* it to fully revert the lookahead call for error reporting purposes. * it to fully revert the lookahead call for error reporting purposes.
*/ */
lookahead_end = yytext + cur_token_length; lookahead_end = base_yytext + cur_token_length;
Assert(*lookahead_end == '\0'); Assert(*lookahead_end == '\0');
/* Save and restore lexer output variables around the call */ /* Save and restore lexer output variables around the call */
cur_yylval = base_yylval; cur_yylval = base_yylval;
cur_yylloc = base_yylloc; cur_yylloc = base_yylloc;
cur_yytext = yytext; cur_yytext = base_yytext;
/* Get next token, saving outputs into lookahead variables */ /* Get next token, saving outputs into lookahead variables */
next_token = base_yylex(); next_token = base_yylex();
...@@ -107,11 +107,11 @@ filtered_base_yylex(void) ...@@ -107,11 +107,11 @@ filtered_base_yylex(void)
lookahead_token = next_token; lookahead_token = next_token;
lookahead_yylval = base_yylval; lookahead_yylval = base_yylval;
lookahead_yylloc = base_yylloc; lookahead_yylloc = base_yylloc;
lookahead_yytext = yytext; lookahead_yytext = base_yytext;
base_yylval = cur_yylval; base_yylval = cur_yylval;
base_yylloc = cur_yylloc; base_yylloc = cur_yylloc;
yytext = cur_yytext; base_yytext = cur_yytext;
/* Now revert the un-truncation of the current token */ /* Now revert the un-truncation of the current token */
lookahead_hold_char = *lookahead_end; lookahead_hold_char = *lookahead_end;
......
...@@ -24,19 +24,10 @@ ...@@ -24,19 +24,10 @@
#include "extern.h" #include "extern.h"
#include "preproc.h" #include "preproc.h"
/*
* Change symbol names as expected by preproc.y. It'd be better to do this
* with %option prefix="base_yy", but that affects some other names that
* various files expect *not* to be prefixed with "base_". Cleaning it up
* is not worth the trouble right now.
*/
#define yylex base_yylex
#define yylval base_yylval
} }
%{ %{
extern YYSTYPE yylval; extern YYSTYPE base_yylval;
static int xcdepth = 0; /* depth of nesting in slash-star comments */ static int xcdepth = 0; /* depth of nesting in slash-star comments */
static char *dolqstart = NULL; /* current $foo$ quote start string */ static char *dolqstart = NULL; /* current $foo$ quote start string */
...@@ -97,6 +88,7 @@ static struct _if_value ...@@ -97,6 +88,7 @@ static struct _if_value
%option noinput %option noinput
%option noyywrap %option noyywrap
%option warn %option warn
%option prefix="base_yy"
%option yylineno %option yylineno
...@@ -451,7 +443,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -451,7 +443,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
BEGIN(SQL); BEGIN(SQL);
if (literalbuf[strspn(literalbuf, "01") + 1] != '\0') if (literalbuf[strspn(literalbuf, "01") + 1] != '\0')
mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string literal"); mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string literal");
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return BCONST; return BCONST;
} }
...@@ -471,7 +463,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -471,7 +463,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
<xh>{quotefail} { <xh>{quotefail} {
yyless(1); yyless(1);
BEGIN(SQL); BEGIN(SQL);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return XCONST; return XCONST;
} }
...@@ -514,27 +506,27 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -514,27 +506,27 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
<xq,xqc>{quotefail} { <xq,xqc>{quotefail} {
yyless(1); yyless(1);
BEGIN(state_before); BEGIN(state_before);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return SCONST; return SCONST;
} }
<xe>{quotestop} | <xe>{quotestop} |
<xe>{quotefail} { <xe>{quotefail} {
yyless(1); yyless(1);
BEGIN(state_before); BEGIN(state_before);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return ECONST; return ECONST;
} }
<xn>{quotestop} | <xn>{quotestop} |
<xn>{quotefail} { <xn>{quotefail} {
yyless(1); yyless(1);
BEGIN(state_before); BEGIN(state_before);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return NCONST; return NCONST;
} }
<xus>{xusstop} { <xus>{xusstop} {
addlit(yytext, yyleng); addlit(yytext, yyleng);
BEGIN(state_before); BEGIN(state_before);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return UCONST; return UCONST;
} }
<xq,xe,xn,xus>{xqdouble} { addlitchar('\''); } <xq,xe,xn,xus>{xqdouble} { addlitchar('\''); }
...@@ -575,7 +567,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -575,7 +567,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
addlit(yytext, yyleng); addlit(yytext, yyleng);
free(dolqstart); free(dolqstart);
BEGIN(SQL); BEGIN(SQL);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return DOLCONST; return DOLCONST;
} }
else else
...@@ -612,12 +604,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -612,12 +604,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
if (literallen == 0) if (literallen == 0)
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier"); mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
/* The backend will truncate the identifier here. We do not as it does not change the result. */ /* The backend will truncate the identifier here. We do not as it does not change the result. */
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return CSTRING; return CSTRING;
} }
<xdc>{xdstop} { <xdc>{xdstop} {
BEGIN(state_before); BEGIN(state_before);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return CSTRING; return CSTRING;
} }
<xui>{xuistop} { <xui>{xuistop} {
...@@ -626,7 +618,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -626,7 +618,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier"); mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
/* The backend will truncate the identifier here. We do not as it does not change the result. */ /* The backend will truncate the identifier here. We do not as it does not change the result. */
addlit(yytext, yyleng); addlit(yytext, yyleng);
yylval.str = mm_strdup(literalbuf); base_yylval.str = mm_strdup(literalbuf);
return UIDENT; return UIDENT;
} }
<xd,xui>{xddouble} { addlitchar('"'); } <xd,xui>{xddouble} { addlitchar('"'); }
...@@ -725,11 +717,11 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -725,11 +717,11 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
return yytext[0]; return yytext[0];
} }
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return Op; return Op;
} }
<SQL>{param} { <SQL>{param} {
yylval.ival = atol(yytext+1); base_yylval.ival = atol(yytext+1);
return PARAM; return PARAM;
} }
<C,SQL>{integer} { <C,SQL>{integer} {
...@@ -746,36 +738,36 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -746,36 +738,36 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
) )
{ {
errno = 0; errno = 0;
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return FCONST; return FCONST;
} }
yylval.ival = val; base_yylval.ival = val;
return ICONST; return ICONST;
} }
<SQL>{ip} { <SQL>{ip} {
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return IP; return IP;
} }
<C,SQL>{decimal} { <C,SQL>{decimal} {
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return FCONST; return FCONST;
} }
<C,SQL>{real} { <C,SQL>{real} {
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return FCONST; return FCONST;
} }
<SQL>{realfail1} { <SQL>{realfail1} {
yyless(yyleng-1); yyless(yyleng-1);
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return FCONST; return FCONST;
} }
<SQL>{realfail2} { <SQL>{realfail2} {
yyless(yyleng-2); yyless(yyleng-2);
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return FCONST; return FCONST;
} }
<SQL>:{identifier}((("->"|\.){identifier})|(\[{array}\]))* { <SQL>:{identifier}((("->"|\.){identifier})|(\[{array}\]))* {
yylval.str = mm_strdup(yytext+1); base_yylval.str = mm_strdup(yytext+1);
return(CVARIABLE); return(CVARIABLE);
} }
<SQL>{identifier} { <SQL>{identifier} {
...@@ -801,7 +793,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -801,7 +793,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
* to do so; that's just another way that ecpg could get * to do so; that's just another way that ecpg could get
* out of step with the backend. * out of step with the backend.
*/ */
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return IDENT; return IDENT;
} }
} }
...@@ -822,11 +814,11 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -822,11 +814,11 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
char* endptr; char* endptr;
errno = 0; errno = 0;
yylval.ival = strtoul((char *)yytext,&endptr,16); base_yylval.ival = strtoul((char *)yytext,&endptr,16);
if (*endptr != '\0' || errno == ERANGE) if (*endptr != '\0' || errno == ERANGE)
{ {
errno = 0; errno = 0;
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return SCONST; return SCONST;
} }
return ICONST; return ICONST;
...@@ -839,7 +831,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -839,7 +831,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
} }
else else
{ {
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return(CPP_LINE); return(CPP_LINE);
} }
} }
...@@ -851,12 +843,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -851,12 +843,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
} }
else else
{ {
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return(CPP_LINE); return(CPP_LINE);
} }
} }
<C,SQL>{cppline} { <C,SQL>{cppline} {
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return(CPP_LINE); return(CPP_LINE);
} }
<C>{identifier} { <C>{identifier} {
...@@ -881,7 +873,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -881,7 +873,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
return keyword->value; return keyword->value;
else else
{ {
yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return IDENT; return IDENT;
} }
} }
......
...@@ -452,7 +452,7 @@ dump_variables(struct arguments * list, int mode) ...@@ -452,7 +452,7 @@ dump_variables(struct arguments * list, int mode)
dump_variables(list->next, mode); dump_variables(list->next, mode);
/* Then the current element and its indicator */ /* Then the current element and its indicator */
ECPGdump_a_type(yyout, list->variable->name, list->variable->type, list->variable->brace_level, ECPGdump_a_type(base_yyout, list->variable->name, list->variable->type, list->variable->brace_level,
list->indicator->name, list->indicator->type, list->indicator->brace_level, list->indicator->name, list->indicator->type, list->indicator->brace_level,
NULL, NULL, str_zero, NULL, NULL); NULL, NULL, str_zero, NULL, NULL);
......
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