fix get_prior_mop selector, loosen overly strict checks in remove_extra_brackets logic
This commit is contained in:
+6
-9
@@ -800,7 +800,11 @@ static Expression::Token::Operator get_prior_mop(const std::vector<Expression::T
|
|||||||
|
|
||||||
if (t.t == Expression::Token::OPERATOR)
|
if (t.t == Expression::Token::OPERATOR)
|
||||||
{
|
{
|
||||||
if (t.v.o == Expression::Token::OPA)
|
if (t.v.o == Expression::Token::CPA)
|
||||||
|
{
|
||||||
|
lv++;
|
||||||
|
}
|
||||||
|
else if (t.v.o == Expression::Token::OPA)
|
||||||
{
|
{
|
||||||
lv--;
|
lv--;
|
||||||
|
|
||||||
@@ -810,7 +814,7 @@ static Expression::Token::Operator get_prior_mop(const std::vector<Expression::T
|
|||||||
return Expression::Token::ADD;
|
return Expression::Token::ADD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (lv < 0)
|
||||||
{
|
{
|
||||||
return t.v.o;
|
return t.v.o;
|
||||||
}
|
}
|
||||||
@@ -939,13 +943,6 @@ static void remove_extra_brackets(std::vector<Expression::Token>& tv)
|
|||||||
|
|
||||||
Range parent_r;
|
Range parent_r;
|
||||||
find_parent_level_range(tv, parent_r, r);
|
find_parent_level_range(tv, parent_r, r);
|
||||||
int max_parent_rank = max_rank(tv, mp, parent_r, current_prio);
|
|
||||||
|
|
||||||
if (max_parent_rank > max_child_rank)
|
|
||||||
{
|
|
||||||
pr_debug("Fails in rank comp: parent=" << max_parent_rank << " > child=" << max_child_rank);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int min_child_rank = min_rank(tv, mp, r, current_prio);
|
int min_child_rank = min_rank(tv, mp, r, current_prio);
|
||||||
if (int nr = get_max_neighbour_rank(tv, r); nr > min_child_rank)
|
if (int nr = get_max_neighbour_rank(tv, r); nr > min_child_rank)
|
||||||
|
|||||||
Reference in New Issue
Block a user