file_systems/QueryParser: Only increment within the operators loop.
If we have a matching operator, we will replace the current item with a new item, and we may need to process it again. For example, in cases like "A||B||C", the first pass will turn this into "(A||B)||C", and so we need to re-process the first item to get "((A||B)||C". Fixes "Open with..." and some other things following the query parser refactorings.
This commit is contained in:
@@ -1285,10 +1285,12 @@ Expression<QueryPolicy>::Init(const char* expr, const char** position)
|
||||
// Second & third passes: && and ||.
|
||||
int32 nodes = currentExpr->CountItems();
|
||||
for (ops op = OP_AND; op <= OP_OR; op = (ops)(op + 1)) {
|
||||
for (int32 i = 0; i < (currentExpr->CountItems() - 1); i++) {
|
||||
for (int32 i = 0; i < (currentExpr->CountItems() - 1); ) {
|
||||
ExpressionNode* left = currentExpr->Array() + i;
|
||||
if (left->op != op)
|
||||
if (left->op != op) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find the right-hand expression (may have to jump over now-unused nodes.)
|
||||
ExpressionNode* right = NULL;
|
||||
|
||||
Reference in New Issue
Block a user