Skip to content

Commit

Permalink
issue 7302: Parsing of template args in single-quotes is incorrect.
Browse files Browse the repository at this point in the history
In case we encounter an unescaped single or double quote during specialization we search for the closing quote.
We are cionnsidering potential escape sequences in the strings as well.
  • Loading branch information
albert-github committed Oct 8, 2019
1 parent d2b8ae1 commit 148162e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
%x GCopyCurly
%x SkipUnionSwitch
%x Specialization
%x SpecializationSingleQuote
%x SpecializationDoubleQuote
%x FuncPtrInit
%x FuncFunc
%x FuncFuncEnd
Expand Down Expand Up @@ -6145,6 +6147,19 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
<Specialization>"typename"{BN}+ { lineCount(); }
<Specialization>"(" { *specName += *yytext; roundCount++; }
<Specialization>")" { *specName += *yytext; roundCount--; }
<Specialization>"\\\\" { *specName += *yytext;}
<Specialization>"\\'" { *specName += *yytext;}
<Specialization>"\\\"" { *specName += *yytext;}
<Specialization>"'" { *specName += *yytext;BEGIN(SpecializationSingleQuote);}
<Specialization>"\"" { *specName += *yytext;BEGIN(SpecializationDoubleQuote);}
<SpecializationSingleQuote,SpecializationDoubleQuote>"\\\\" { *specName += *yytext;}
<SpecializationSingleQuote>"\\'" { *specName += *yytext;}
<SpecializationSingleQuote>"'" { *specName += *yytext; BEGIN(Specialization);}
<SpecializationDoubleQuote>"\\\"" { *specName += *yytext;}
<SpecializationDoubleQuote>"\"" { *specName += *yytext; BEGIN(Specialization);}
<SpecializationSingleQuote,SpecializationDoubleQuote>. { *specName += *yytext;}
<Specialization>. {
*specName += *yytext;
}
Expand Down

0 comments on commit 148162e

Please sign in to comment.