Skip to content

Commit c3b2c90

Browse files
committed
issue #11166 Doc fails on raw string literals
Adding the possibility of having raw strings on some other places based on original example and example provided by issue issuer
1 parent a2eec70 commit c3b2c90

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

src/scanner.l

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3090,7 +3090,7 @@ NONLopt [^\n]*
30903090
yyextra->current->initializer << *yytext;
30913091
}
30923092
}
3093-
<ReadBody,ReadNSBody,ReadBodyIntf,ReadInitializer,ReadInitializerPtr>{RAWBEGIN} { // C++11 raw string
3093+
<ReadInitializer,ReadInitializerPtr>{RAWBEGIN} { // C++11 raw string
30943094
if (!yyextra->insideCpp)
30953095
{
30963096
REJECT;
@@ -3109,13 +3109,17 @@ NONLopt [^\n]*
31093109
}
31103110
}
31113111
<RawGString>{RAWEND} {
3112-
*yyextra->pCopyRawGString << yytext;
31133112
QCString delimiter = yytext+1;
31143113
delimiter=delimiter.left(delimiter.length()-1);
31153114
if (delimiter==yyextra->delimiter)
31163115
{
3116+
*yyextra->pCopyRawGString << yytext;
31173117
BEGIN(yyextra->lastRawStringContext);
31183118
}
3119+
else
3120+
{
3121+
REJECT;
3122+
}
31193123
}
31203124
<RawGString>[^)\n]+ {
31213125
*yyextra->pCopyRawGString << yytext;
@@ -3472,9 +3476,19 @@ NONLopt [^\n]*
34723476
yyextra->pSkipVerbString=yyextra->pCopyRoundGString;
34733477
BEGIN(SkipVerbString);
34743478
}
3475-
<GCopyRound>[^"'()\n\/,]+ {
3479+
<GCopyRound>[^"'()\n\/,R]+ { // R because of raw string start
34763480
*yyextra->pCopyRoundGString << yytext;
34773481
}
3482+
<GCopyRound>{RAWBEGIN} {
3483+
QCString text=yytext;
3484+
*yyextra->pCopyRoundGString << yytext;
3485+
int i=text.find('"');
3486+
yyextra->delimiter = yytext+i+1;
3487+
yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
3488+
yyextra->lastRawStringContext = YY_START;
3489+
yyextra->pCopyRawGString = yyextra->pCopyRoundGString;
3490+
BEGIN(RawGString);
3491+
}
34783492
<GCopyRound>. {
34793493
*yyextra->pCopyRoundGString << *yytext;
34803494
}
@@ -4161,6 +4175,16 @@ NONLopt [^\n]*
41614175
REJECT;
41624176
}
41634177
}
4178+
<ReadBody,ReadNSBody,ReadBodyIntf>{RAWBEGIN} {
4179+
QCString text=yytext;
4180+
yyextra->current->program << text;
4181+
int i=text.find('"');
4182+
yyextra->delimiter = yytext+i+1;
4183+
yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
4184+
yyextra->lastRawStringContext = YY_START;
4185+
yyextra->pCopyRawGString = &yyextra->current->program;
4186+
BEGIN(RawGString);
4187+
}
41644188
<ReadBody,ReadNSBody,ReadBodyIntf>\" { yyextra->current->program << yytext ;
41654189
yyextra->pCopyQuotedGString = &yyextra->current->program;
41664190
yyextra->lastStringContext=YY_START;

0 commit comments

Comments
 (0)