shared: qssquery: checkParanthesis(): Ignore paranthesis in quotes
Fixes #12
Tá an tiomantas seo le fáil i:
tuismitheoir
33b145e6d2
tiomantas
64b87dd595
@ -33,15 +33,24 @@ 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 == '(')
|
||||||
|
{
|
||||||
|
open.push(c);
|
||||||
|
}
|
||||||
|
if(c == ')')
|
||||||
|
{
|
||||||
|
close.push(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(c == ')')
|
if(c == '"')
|
||||||
{
|
{
|
||||||
close.push(c);
|
inQuotes = !inQuotes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(open.size() != close.size())
|
if(open.size() != close.size())
|
||||||
|
Á lódáil...
x
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir