mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
tools/nxstyle: can use ',' in the string when declaring it
Signed-off-by: yangjian11 <yangjian11@xiaomi.com>
This commit is contained in:
parent
8bef8ee9d5
commit
b3b8ec35a6
1 changed files with 7 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue