shared: qssquery: checkParanthesis(): Ignore paranthesis in quotes

Fixes #12
This commit is contained in:
Albert S. 2020-12-19 12:51:52 +01:00
förälder 0cba6f3fa4
incheckning dd053f87f9

Visa fil

@ -34,7 +34,11 @@ bool QSSQuery::checkParanthesis(QString expression)
QStack<QChar> open; QStack<QChar> open;
QStack<QChar> close; QStack<QChar> close;
bool inQuotes = false;
for(QChar &c : expression) for(QChar &c : expression)
{
if(!inQuotes)
{ {
if(c == '(') if(c == '(')
{ {
@ -45,6 +49,11 @@ bool QSSQuery::checkParanthesis(QString expression)
close.push(c); close.push(c);
} }
} }
if(c == '"')
{
inQuotes = ! inQuotes;
}
}
if(open.size() != close.size()) if(open.size() != close.size())
{ {
return false; return false;