tools/nxstyle: can use ',' in the string when declaring it

Signed-off-by: yangjian11 <yangjian11@xiaomi.com>
This commit is contained in:
yangjian11
2024-01-26 15:06:23 +08:00
committed by Xiang Xiao
parent 8bef8ee9d5
commit b3b8ec35a6
+7 -2
View File
@@ -1860,6 +1860,7 @@ int main(int argc, char **argv, char **envp)
if (pnest == 0)
{
int tmppnest;
bool tmpbstring;
/* Note, we have not yet parsed each character on the line so
* a comma have have been be preceded by '(' on the same line.
@@ -1867,11 +1868,11 @@ int main(int argc, char **argv, char **envp)
* case.
*/
for (i = indent, tmppnest = 0;
for (i = indent, tmppnest = 0, tmpbstring = false;
line[i] != '\n' && line[i] != '\0';
i++)
{
if (tmppnest == 0 && line[i] == ',')
if (tmppnest == 0 && !tmpbstring && line[i] == ',')
{
ERROR("Multiple data definitions", lineno, i + 1);
break;
@@ -1891,6 +1892,10 @@ int main(int argc, char **argv, char **envp)
tmppnest--;
}
else if (line[i] == '"')
{
tmpbstring = !tmpbstring;
}
else if (line[i] == ';')
{
/* Break out if the semicolon terminates the