Skip to content

Commit

Permalink
Modified code to accept single element expressions without [] as a sp…
Browse files Browse the repository at this point in the history
…ecific case of list of elements with only one element in string specification for properties
  • Loading branch information
hkbinaurics committed Apr 23, 2024
1 parent 453f035 commit 6076258
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions sources/jvxLibraries/jvx-helpers/src/HjvxMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5092,6 +5092,8 @@ jvx_parseNumericExpression(std::string txt, jvxBool& err, std::vector<std::vecto
std::string oneToken;
jvxData val;
err = false;
jvxBool leadingBraces = false;

for (i = 0; i < txt.size(); i++)
{
char oneChar = txt[i];
Expand All @@ -5102,14 +5104,16 @@ jvx_parseNumericExpression(std::string txt, jvxBool& err, std::vector<std::vecto
if (
(oneChar != ' ') && (oneChar != '\t'))
{
state = 1;
oneToken = "";
if (oneChar == '[')
{
state = 1;
oneToken = "";
leadingBraces = true;
}
else
{
state = -1;
i--;
leadingBraces = false;
}
}
break;
Expand Down Expand Up @@ -5201,7 +5205,31 @@ jvx_parseNumericExpression(std::string txt, jvxBool& err, std::vector<std::vecto
}
break;
}
}
}// for (i = 0; i < txt.size(); i++)
if (!leadingBraces)
{
if (!oneToken.empty())
{
jvxBool errL = false;
if (
(oneToken.size() >= 2) &&
((oneToken.substr(0, 2) == "0x") || (oneToken.substr(0, 2) == "0X")))
{
val = (jvxData)jvx_string2Int64(oneToken, errL);
}
else
{
val = jvx_string2Data(oneToken, errL);
}
if (errL)
err = true;
myRow.push_back(val);
}
if (!myRow.empty())
{
returnMe.push_back(myRow);
}
}
}

void
Expand Down

0 comments on commit 6076258

Please sign in to comment.