From 148162e48b8337fafffc61e5a1b5cdf86077d6ac Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 8 Oct 2019 18:50:53 +0200 Subject: issue 7302: Parsing of template args in single-quotes is incorrect. 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. --- src/scanner.l | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/scanner.l b/src/scanner.l index fe20543..242a106 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -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 @@ -6145,6 +6147,19 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) "typename"{BN}+ { lineCount(); } "(" { *specName += *yytext; roundCount++; } ")" { *specName += *yytext; roundCount--; } + +"\\\\" { *specName += *yytext;} +"\\'" { *specName += *yytext;} +"\\\"" { *specName += *yytext;} +"'" { *specName += *yytext;BEGIN(SpecializationSingleQuote);} +"\"" { *specName += *yytext;BEGIN(SpecializationDoubleQuote);} +"\\\\" { *specName += *yytext;} +"\\'" { *specName += *yytext;} +"'" { *specName += *yytext; BEGIN(Specialization);} +"\\\"" { *specName += *yytext;} +"\"" { *specName += *yytext; BEGIN(Specialization);} +. { *specName += *yytext;} + . { *specName += *yytext; } -- cgit v0.12