@@ -102,7 +102,8 @@ static struct _if_value
102
102
* and to eliminate parsing troubles for numeric strings.
103
103
* Exclusive states:
104
104
* <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
106
107
* <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27
107
108
* <xh> hexadecimal numeric string - thomas 1997-11-16
108
109
* <xq> standard quoted strings - thomas 1997-07-30
@@ -115,7 +116,8 @@ static struct _if_value
115
116
*/
116
117
117
118
%x xb
118
- %x xc
119
+ %x xcc
120
+ %x xcsql
119
121
%x xd
120
122
%x xdc
121
123
%x xh
@@ -369,23 +371,32 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
369
371
370
372
<SQL >{whitespace } { /* ignore */ }
371
373
372
- <C , SQL >{xcstart } {
374
+ <C >{xcstart } {
373
375
token_start = yytext;
374
376
state_before = YYSTATE;
375
377
xcdepth = 0 ;
376
- BEGIN (xc );
378
+ BEGIN (xcc );
377
379
/* Put back any characters past slash-star; see above */
378
380
yyless (2 );
379
381
fputs (" /*" , yyout);
380
382
}
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 } {
382
394
xcdepth++;
383
395
/* Put back any characters past slash-star; see above */
384
396
yyless (2 );
385
397
fputs (" /*" , yyout);
386
398
}
387
-
388
- <xc >{xcstop } {
399
+ <xcsql >{xcstop } {
389
400
ECHO;
390
401
if (xcdepth <= 0 )
391
402
{
@@ -395,12 +406,16 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
395
406
else
396
407
xcdepth--;
397
408
}
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; }
398
417
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" ); }
404
419
405
420
<SQL >{xbstart } {
406
421
token_start = yytext;
0 commit comments