Skip to content

Commit

Permalink
Problem in case using PREDEFINED with comma
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
albert-github committed Feb 20, 2020
1 parent 597d113 commit 00b45f7
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/configimpl.l
Expand Up @@ -713,6 +713,7 @@ static void readIncludeFile(const char *incName)
%x GetString
%x GetBool
%x GetStrList
%x GetStrList1
%x GetQuotedString
%x GetEnvVar
%x Include
Expand All @@ -725,8 +726,8 @@ static void readIncludeFile(const char *incName)
BEGIN(Start);
unput(*yytext);
}
<Start,GetString,GetStrList,GetBool,SkipInvalid>"##".*"\n" { config->appendUserComment(yytext);yyLineNr++;}
<Start,GetString,GetStrList,GetBool,SkipInvalid>"#" { BEGIN(SkipComment); }
<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"##".*"\n" { config->appendUserComment(yytext);yyLineNr++;}
<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"#" { BEGIN(SkipComment); }
<Start>[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);
Expand All @@ -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();
Expand Down Expand Up @@ -880,7 +888,7 @@ static void readIncludeFile(const char *incName)

<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); }
<GetString,GetBool,SkipInvalid>\n { yyLineNr++; BEGIN(Start); }
<GetStrList>\n {
<GetStrList,GetStrList1>\n {
yyLineNr++;
if (!elemStr.isEmpty())
{
Expand All @@ -889,6 +897,14 @@ static void readIncludeFile(const char *incName)
}
BEGIN(Start);
}
<GetStrList1>[ \t]+ {
if (!elemStr.isEmpty())
{
//printf("elemStr2='%s'\n",elemStr.data());
l->append(elemStr);
}
elemStr.resize(0);
}
<GetStrList>[ \t,]+ {
if (!elemStr.isEmpty())
{
Expand All @@ -900,7 +916,7 @@ static void readIncludeFile(const char *incName)
<GetString>[^ \"\t\r\n]+ { (*s)+=configStringRecode(yytext,encoding,"UTF-8");
checkEncoding();
}
<GetString,GetStrList,SkipInvalid>"\"" { lastState=YY_START;
<GetString,GetStrList,GetStrList1,SkipInvalid>"\"" { lastState=YY_START;
BEGIN(GetQuotedString);
tmpString.resize(0);
}
Expand Down Expand Up @@ -943,6 +959,9 @@ static void readIncludeFile(const char *incName)
bs.data(),yyLineNr,yyFileName.data());
}
}
<GetStrList1>[^ \#\"\t\r\n]+ {
elemStr+=configStringRecode(yytext,encoding,"UTF-8");
}
<GetStrList>[^ \#\"\t\r\n,]+ {
elemStr+=configStringRecode(yytext,encoding,"UTF-8");
}
Expand Down

0 comments on commit 00b45f7

Please sign in to comment.