mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
tools/nxstyle: can use ',' in the string when declaring it
Signed-off-by: yangjian11 <yangjian11@xiaomi.com>
This commit is contained in:
+7
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user