From 00b45f73c67f5c57407e6e2a783af7f0820afa4d Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 20 Feb 2020 14:16:26 +0100 Subject: Problem in case using PREDEFINED with comma In the pull request "Enable comma as separator in configuration lists enhancement " (#6563) it was made possible to have commas as separators for lists. In case we have: ``` PREDEFINED = A(x,y)=sin(x),cos(y) ``` and use `doxygen -x` (or usethe define): this results in: ``` PREDEFINED = A(x \ y)=sin(x) \ cos(y) ``` this can be overcome by means of: ``` PREDEFINED = "A(x,y)=sin(x),cos(y)" ``` But for a lot of existing packages this poses a problem. (Found by looking at the doxygen configuration files as used by Fossies). --- src/configimpl.l | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/configimpl.l b/src/configimpl.l index eb33610..dfdeb4a 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -713,6 +713,7 @@ static void readIncludeFile(const char *incName) %x GetString %x GetBool %x GetStrList +%x GetStrList1 %x GetQuotedString %x GetEnvVar %x Include @@ -725,8 +726,8 @@ static void readIncludeFile(const char *incName) BEGIN(Start); unput(*yytext); } -"##".*"\n" { config->appendUserComment(yytext);yyLineNr++;} -"#" { BEGIN(SkipComment); } +"##".*"\n" { config->appendUserComment(yytext);yyLineNr++;} +"#" { BEGIN(SkipComment); } [a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { QCString cmd=yytext; cmd=cmd.left(cmd.length()-1).stripWhiteSpace(); ConfigOption *option = config->get(cmd); @@ -750,7 +751,14 @@ static void readIncludeFile(const char *incName) l = ((ConfigList *)option)->valueRef(); l->clear(); elemStr=""; - BEGIN(GetStrList); + if (cmd == "PREDEFINED") + { + BEGIN(GetStrList1); + } + else + { + BEGIN(GetStrList); + } break; case ConfigOption::O_Enum: s = ((ConfigEnum *)option)->valueRef(); @@ -880,7 +888,7 @@ static void readIncludeFile(const char *incName) [a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); } \n { yyLineNr++; BEGIN(Start); } -\n { +\n { yyLineNr++; if (!elemStr.isEmpty()) { @@ -889,6 +897,14 @@ static void readIncludeFile(const char *incName) } BEGIN(Start); } +[ \t]+ { + if (!elemStr.isEmpty()) + { + //printf("elemStr2='%s'\n",elemStr.data()); + l->append(elemStr); + } + elemStr.resize(0); + } [ \t,]+ { if (!elemStr.isEmpty()) { @@ -900,7 +916,7 @@ static void readIncludeFile(const char *incName) [^ \"\t\r\n]+ { (*s)+=configStringRecode(yytext,encoding,"UTF-8"); checkEncoding(); } -"\"" { lastState=YY_START; +"\"" { lastState=YY_START; BEGIN(GetQuotedString); tmpString.resize(0); } @@ -943,6 +959,9 @@ static void readIncludeFile(const char *incName) bs.data(),yyLineNr,yyFileName.data()); } } +[^ \#\"\t\r\n]+ { + elemStr+=configStringRecode(yytext,encoding,"UTF-8"); + } [^ \#\"\t\r\n,]+ { elemStr+=configStringRecode(yytext,encoding,"UTF-8"); } -- cgit v0.12