aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2013-11-25 15:29:51 +0100
committerMichael Meskes <meskes@postgresql.org>2013-11-25 15:38:09 +0100
commit05b476c2983a8d38bf6a0254553b4a0776896aa7 (patch)
tree0f869b7154a00325083620eac3464d9bb620caf1 /src
parentef8b3b00b55ef1feedb352a8a26f94845b6437dc (diff)
downloadpostgresql-05b476c2983a8d38bf6a0254553b4a0776896aa7.tar.gz
postgresql-05b476c2983a8d38bf6a0254553b4a0776896aa7.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/preproc/pgc.l8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index 6deef59d53f..f04e34a53de 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -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(','); }