1
0

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

Fixes #12
Este cometimento está contido em:
Albert S. 2020-12-19 12:51:52 +01:00
ascendente 0cba6f3fa4
cometimento dd053f87f9

Ver ficheiro

@ -34,16 +34,25 @@ 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(c == '(') if(!inQuotes)
{ {
open.push(c); if(c == '(')
} {
if(c == ')') open.push(c);
{ }
close.push(c); if(c == ')')
} {
close.push(c);
}
}
if(c == '"')
{
inQuotes = ! inQuotes;
}
} }
if(open.size() != close.size()) if(open.size() != close.size())
{ {