Fixed two bugs in define command in pgc.l

This commit is contained in:
Michael Meskes 2002-03-10 12:09:54 +00:00
parent a9f268dcb3
commit 7f7fb4e64c
2 changed files with 16 additions and 7 deletions

View File

@ -1221,6 +1221,10 @@ Wed Jan 23 17:35:23 CET 2002
Wed Mar 6 10:40:28 CET 2002 Wed Mar 6 10:40:28 CET 2002
- Synced preproc.y with gram.y. - Synced preproc.y with gram.y.
Sun Mar 10 13:08:22 CET 2002
- Fixed two bugs in define command in lexer.
- Set ecpg version to 2.10.0. - Set ecpg version to 2.10.0.
- Set library version to 3.4.0. - Set library version to 3.4.0.

View File

@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.86 2002/03/06 06:10:36 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.87 2002/03/10 12:09:54 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -352,7 +352,7 @@ cppline {space}*#(.*\\{space})*.*
<xh><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated hexadecimal integer"); } <xh><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated hexadecimal integer"); }
{xqstart} { <C,SQL>{xqstart} {
state_before = YYSTATE; state_before = YYSTATE;
BEGIN(xq); BEGIN(xq);
startlit(); startlit();
@ -412,7 +412,7 @@ cppline {space}*#(.*\\{space})*.*
addlit(yytext, yyleng); addlit(yytext, yyleng);
} }
<xd,xdc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted identifier"); } <xd,xdc><<EOF>> { mmerror(PARSE_ERROR, ET_ERROR, "Unterminated quoted identifier"); }
{xdstart} { <C,SQL>{xdstart} {
state_before = YYSTATE; state_before = YYSTATE;
BEGIN(xdc); BEGIN(xdc);
startlit(); startlit();
@ -789,7 +789,6 @@ cppline {space}*#(.*\\{space})*.*
/* initial definition */ /* initial definition */
this->old = old; this->old = old;
/* this->new = mm_strdup(scanstr(literalbuf));*/
this->new = mm_strdup(literalbuf); this->new = mm_strdup(literalbuf);
this->next = defines; this->next = defines;
defines = this; defines = this;
@ -797,11 +796,11 @@ cppline {space}*#(.*\\{space})*.*
BEGIN(C); BEGIN(C);
} }
<def>[^";"] { <def>[^;] {
addlit(yytext, yyleng); addlit(yytext, yyleng);
} }
<incl>[^";"]+";" { /* got the include file name */ <incl>[^;]+";" { /* got the include file name */
struct _yy_buffer *yb; struct _yy_buffer *yb;
struct _include_path *ip; struct _include_path *ip;
char inc_file[MAXPGPATH]; char inc_file[MAXPGPATH];
@ -870,6 +869,7 @@ cppline {space}*#(.*\\{space})*.*
else else
{ {
struct _yy_buffer *yb = yy_buffer; struct _yy_buffer *yb = yy_buffer;
int i;
if (yyin != NULL) if (yyin != NULL)
fclose(yyin); fclose(yyin);
@ -879,11 +879,16 @@ cppline {space}*#(.*\\{space})*.*
yylineno = yy_buffer->lineno; yylineno = yy_buffer->lineno;
/* We have to output the filename only if we change files here */
i = strcmp(input_filename, yy_buffer->filename);
free(input_filename); free(input_filename);
input_filename = yy_buffer->filename; input_filename = yy_buffer->filename;
yy_buffer = yy_buffer->next; yy_buffer = yy_buffer->next;
free(yb); free(yb);
if (i != 0)
output_line_number(); output_line_number();
} }
} }