don't merge predicate to negated and group

This commit is contained in:
Ari Lazier 2015-11-25 18:32:13 -08:00
parent e89259c746
commit be2a3fab47
2 changed files with 4 additions and 4 deletions

View File

@ -179,9 +179,8 @@ struct ParserState
auto &sub_preds = current_group()->cpnd.sub_predicates; auto &sub_preds = current_group()->cpnd.sub_predicates;
auto second_last = sub_preds.end() - 2; auto second_last = sub_preds.end() - 2;
if (second_last->type == Predicate::Type::And) { if (second_last->type == Predicate::Type::And && !second_last->negate) {
// if we are in an OR group and second to last predicate group is // make a new and group populated with the last two predicates
// an AND group then move the last predicate inside
second_last->cpnd.sub_predicates.push_back(std::move(sub_preds.back())); second_last->cpnd.sub_predicates.push_back(std::move(sub_preds.back()));
sub_preds.pop_back(); sub_preds.pop_back();
} }

View File

@ -273,7 +273,8 @@
["ObjectSet", [0, 1], "IntObject", "intCol == 0 || intCol == 1 && intCol >= 1"], ["ObjectSet", [0, 1], "IntObject", "intCol == 0 || intCol == 1 && intCol >= 1"],
["ObjectSet", [0, 1, 2],"IntObject", "intCol == 0 || intCol == 1 || intCol <= 2"], ["ObjectSet", [0, 1, 2],"IntObject", "intCol == 0 || intCol == 1 || intCol <= 2"],
["ObjectSet", [0, 1], "IntObject", "intCol == 1 && intCol >= 1 || intCol == 0"], ["ObjectSet", [0, 1], "IntObject", "intCol == 1 && intCol >= 1 || intCol == 0"],
["ObjectSet", [0, 1], "IntObject", "intCol == 1 || intCol == 0 && intCol <= 0 && intCol >= 0"] ["ObjectSet", [0, 1], "IntObject", "intCol == 1 || intCol == 0 && intCol <= 0 && intCol >= 0"],
["ObjectSet", [0, 1], "IntObject", "intCol == 0 || NOT (intCol == 3 && intCol >= 0) && intCol == 1"]
] ]
} }