1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

More improvement to comment parsing in ecpg.

ECPG is not supposed to allow and output nested comments in C. These comments
are only allowed in the SQL parts and must not be written into the C file.
Also the different handling of different comments is documented.
This commit is contained in:
Michael Meskes
2013-11-25 15:29:51 +01:00
parent ef8b3b00b5
commit 05b476c298
2 changed files with 10 additions and 4 deletions

View File

@@ -394,17 +394,20 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
xcdepth++;
/* Put back any characters past slash-star; see above */
yyless(2);
fputs("/*", yyout);
fputs("/_*", yyout);
}
<xcsql>{xcstop} {
ECHO;
if (xcdepth <= 0)
{
ECHO;
BEGIN(state_before);
token_start = NULL;
}
else
{
xcdepth--;
fputs("*_/", yyout);
}
}
<xcc>{xcstop} {
ECHO;
@@ -861,6 +864,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
}
}
}
<C>{xcstop} { mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments"); }
<C>":" { return(':'); }
<C>";" { return(';'); }
<C>"," { return(','); }