@@ -102,7 +102,8 @@ static struct _if_value
102102 * and to eliminate parsing troubles for numeric strings.
103103 * Exclusive states:
104104 * <xb> bit string literal
105- * <xc> extended C-style comments - thomas 1997-07-12
105+ * <xcc> extended C-style comments in C
106+ * <xcsql> extended C-style comments in SQL
106107 * <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27
107108 * <xh> hexadecimal numeric string - thomas 1997-11-16
108109 * <xq> standard quoted strings - thomas 1997-07-30
@@ -115,7 +116,8 @@ static struct _if_value
115116 */
116117
117118%x xb
118- %x xc
119+ %x xcc
120+ %x xcsql
119121%x xd
120122%x xdc
121123%x xh
@@ -369,23 +371,32 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
369371
370372<SQL >{whitespace } { /* ignore */ }
371373
372- <C , SQL >{xcstart } {
374+ <C >{xcstart } {
373375 token_start = yytext;
374376 state_before = YYSTATE;
375377 xcdepth = 0 ;
376- BEGIN (xc );
378+ BEGIN (xcc );
377379 /* Put back any characters past slash-star; see above */
378380 yyless (2 );
379381 fputs (" /*" , yyout);
380382 }
381- <xc >{xcstart } {
383+ <SQL >{xcstart } {
384+ token_start = yytext;
385+ state_before = YYSTATE;
386+ xcdepth = 0 ;
387+ BEGIN (xcsql);
388+ /* Put back any characters past slash-star; see above */
389+ yyless (2 );
390+ fputs (" /*" , yyout);
391+ }
392+ <xcc >{xcstart } { ECHO; }
393+ <xcsql >{xcstart } {
382394 xcdepth++;
383395 /* Put back any characters past slash-star; see above */
384396 yyless (2 );
385397 fputs (" /*" , yyout);
386398 }
387-
388- <xc >{xcstop } {
399+ <xcsql >{xcstop } {
389400 ECHO;
390401 if (xcdepth <= 0 )
391402 {
@@ -395,12 +406,16 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
395406 else
396407 xcdepth--;
397408 }
409+ <xcc >{xcstop } {
410+ ECHO;
411+ BEGIN (state_before);
412+ token_start = NULL ;
413+ }
414+ <xcc ,xcsql >{xcinside } { ECHO; }
415+ <xcc ,xcsql >{op_chars } { ECHO; }
416+ <xcc ,xcsql >\* + { ECHO; }
398417
399- <xc >{xcinside } { ECHO; }
400- <xc >{op_chars } { ECHO; }
401- <xc >\* + { ECHO; }
402-
403- <xc ><<EOF>> { mmfatal (PARSE_ERROR, " unterminated /* comment" ); }
418+ <xcc ,xcsql ><<EOF>> { mmfatal (PARSE_ERROR, " unterminated /* comment" ); }
404419
405420<SQL >{xbstart } {
406421 token_start = yytext;
0 commit comments