Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit05b476c

Browse 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 commentsare 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 parentef8b3b0 commit05b476c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

‎doc/src/sgml/ecpg.sgml

Lines 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

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp