@@ -85,6 +85,8 @@ struct scannerYY_state
85
85
int lastClassTemplSpecContext = 0 ;
86
86
int lastPreLineCtrlContext = 0 ;
87
87
int lastSkipVerbStringContext = 0 ;
88
+ int lastSkipInterpStringContext = 0 ;
89
+ int lastSkipInterpVerbStringContext = 0 ;
88
90
int lastCommentInArgContext = 0 ;
89
91
int lastRawStringContext = 0 ;
90
92
int lastCSConstraint = 0 ;
@@ -167,6 +169,8 @@ struct scannerYY_state
167
169
TextStream *pCopyHereDocGString = 0 ;
168
170
TextStream *pCopyRawGString = 0 ;
169
171
TextStream *pSkipVerbString = 0 ;
172
+ TextStream *pSkipInterpString = 0 ;
173
+ TextStream *pSkipInterpVerbString = 0 ;
170
174
171
175
bool insideFormula = false ;
172
176
bool insideTryBlock = false ;
@@ -253,6 +257,8 @@ BNopt {BN}*
253
257
BL [ \t\r]*" \n "
254
258
B [ \t]
255
259
Bopt {B}*
260
+ DIGIT [0 -9 ]
261
+ HEXDIGIT ({DIGIT}|[a-f]|[A-F])
256
262
ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
257
263
SCOPENAME "$"?(({ID}?{BN}*" ::" {BN}*)*)(((~|!){BN}*)?{ID})
258
264
TSCOPE {ID}(" <" [a-z_A-Z0-9 \t\*\&,:]*" >" )?
@@ -367,6 +373,8 @@ NONLopt [^\n]*
367
373
%x DefinePHPEnd
368
374
%x OldStyleArgs
369
375
%x SkipVerbString
376
+ %x SkipInterpString
377
+ %x SkipInterpVerbString
370
378
%x ObjCMethod
371
379
%x ObjCReturnType
372
380
%x ObjCParams
@@ -2966,7 +2974,7 @@ NONLopt [^\n]*
2966
2974
yyextra->fullArgString+=yytext;
2967
2975
lineCount(yyscanner);
2968
2976
}
2969
- <ReadInitializer,ReadInitializerPtr>\" {
2977
+ <ReadInitializer,ReadInitializerPtr>\" {
2970
2978
if (yyextra->insideIDL && yyextra->insideCppQuote)
2971
2979
{
2972
2980
BEGIN(EndCppQuote);
@@ -3880,13 +3888,48 @@ NONLopt [^\n]*
3880
3888
yyextra->lastSquareContext = YY_START;
3881
3889
BEGIN(SkipSquare);
3882
3890
}
3883
- <ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n \# {}"@' /<\\]* { yyextra->current ->program << yytext ; }
3891
+ <ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n \# {}"@' /<\\\$]* { yyextra->current ->program << yytext ; }
3884
3892
<ReadBody,ReadNSBody,ReadBodyIntf>{CPPC}.* { yyextra->current ->program << yytext ; }
3885
3893
<ReadBody,ReadNSBody,ReadBodyIntf>" #" .* { if (!yyextra->insidePHP )
3886
3894
REJECT;
3887
3895
// append PHP comment.
3888
3896
yyextra->current ->program << yytext ;
3889
3897
}
3898
+ /* Interpolated string C# */
3899
+ <CopyGString,SkipString,SkipCurly,ReadBody,ReadNSBody,ReadBodyIntf>$\" { if (!yyextra->insideCS) REJECT
3900
+ yyextra->current->program << yytext ;
3901
+ yyextra->pSkipInterpString = &yyextra->current->program;
3902
+ yyextra->lastSkipInterpStringContext=YY_START;
3903
+ BEGIN( SkipInterpString );
3904
+ }
3905
+ <SkipInterpString>([^" \\{}\x000D\x000A\x0085\x2028\x2029]|" {{" |" }}" |" \\ '" |" \\\" " |" \\\\ " |" \\ 0" |" \\ a" |" \\ b" |" \\ f" |" \\ n" |" \\ r" |" \\ t" |" \\ v" |" \\ x" {HEXDIGIT}{HEXDIGIT}?{HEXDIGIT}?{HEXDIGIT}?|" \\ " [uU]{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT})* {
3906
+ *yyextra->pSkipInterpString << yytext;
3907
+ }
3908
+ <SkipInterpString>\" {
3909
+ *yyextra->pSkipInterpString << *yytext;
3910
+ BEGIN( yyextra->lastSkipInterpStringContext );
3911
+ }
3912
+ /* Verbatim Interpolated string C# */
3913
+ <SkipCurly,ReadBody,ReadNSBody,ReadBodyIntf>$@\" { if (!yyextra->insideCS) REJECT
3914
+ yyextra->current->program << yytext ;
3915
+ yyextra->pSkipInterpVerbString = &yyextra->current->program;
3916
+ yyextra->lastSkipInterpVerbStringContext=YY_START;
3917
+ BEGIN( SkipInterpVerbString );
3918
+ }
3919
+ <SkipInterpVerbString>([^\" {}]|" {{" |" }}" |" \" \" " )* {
3920
+ *yyextra->pSkipInterpVerbString << yytext;
3921
+ }
3922
+ <SkipInterpString>" {" [^}]*" }" {
3923
+ *yyextra->pSkipInterpString << yytext;
3924
+ }
3925
+ <SkipInterpVerbString>" {" [^}]*" }" {
3926
+ *yyextra->pSkipInterpVerbString << yytext;
3927
+ }
3928
+ <SkipInterpVerbString>\" {
3929
+ *yyextra->pSkipInterpVerbString << *yytext;
3930
+ BEGIN( yyextra->lastSkipInterpVerbStringContext );
3931
+ }
3932
+ <ReadBody,ReadNSBody,ReadBodyIntf>" \$" { yyextra->current->program << yytext ; }
3890
3933
<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program << yytext ;
3891
3934
yyextra->pSkipVerbString = &yyextra->current->program;
3892
3935
yyextra->lastSkipVerbStringContext=YY_START;
@@ -5435,10 +5478,11 @@ NONLopt [^\n]*
5435
5478
*yyextra->pCopyRawString += yytext;
5436
5479
BEGIN(RawString);
5437
5480
}
5438
- <SkipCurly,SkipCurlyCpp>[^\n #" ' @\\ /{}<]+ {
5481
+ <SkipCurly,SkipCurlyCpp>[^\n #" ' @\\ /{}<\$ ]+ {
5439
5482
lineCount(yyscanner); // for yyextra->column updates
5440
5483
//addToBody(yytext);
5441
5484
}
5485
+ <SkipCurly,SkipCurlyCpp>"\$ " {}
5442
5486
<SkipCurlyCpp>\n {
5443
5487
//addToBody(yytext);
5444
5488
lineCount(yyscanner);
0 commit comments