Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 05b476c

Browse filesBrowse files
author
Michael Meskes
committed
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.
1 parent ef8b3b0 commit 05b476c
Copy full SHA for 05b476c

File tree

Expand file treeCollapse file tree

2 files changed

+10
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-4
lines changed

‎doc/src/sgml/ecpg.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/ecpg.sgml
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ EXEC SQL ...;
6464
These statements syntactically take the place of a C statement.
6565
Depending on the particular statement, they can appear at the
6666
global level or within a function. Embedded
67-
<acronym>SQL</acronym> statements follow the case-sensitivity rules
68-
of normal <acronym>SQL</acronym> code, and not those of C.
67+
<acronym>SQL</acronym> statements follow the case-sensitivity rules of
68+
normal <acronym>SQL</acronym> code, and not those of C. Also they allow nested
69+
C-style comments that are part of the SQL standard. The C part of the
70+
program, however, follows the C standard of not accepting nested comments.
6971
</para>
7072

7173
<para>

‎src/interfaces/ecpg/preproc/pgc.l

Copy file name to clipboardExpand all lines: src/interfaces/ecpg/preproc/pgc.l
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,20 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
394394
xcdepth++;
395395
/* Put back any characters past slash-star; see above */
396396
yyless(2);
397-
fputs("/*", yyout);
397+
fputs("/_*", yyout);
398398
}
399399
<xcsql>{xcstop} {
400-
ECHO;
401400
if (xcdepth <= 0)
402401
{
402+
ECHO;
403403
BEGIN(state_before);
404404
token_start = NULL;
405405
}
406406
else
407+
{
407408
xcdepth--;
409+
fputs("*_/", yyout);
410+
}
408411
}
409412
<xcc>{xcstop} {
410413
ECHO;
@@ -861,6 +864,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
861864
}
862865
}
863866
}
867+
<C>{xcstop} { mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments"); }
864868
<C>":" { return(':'); }
865869
<C>";" { return(';'); }
866870
<C>"," { return(','); }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.