fix remove_extra_brackets undoing work of post-processing step
This commit is contained in:
@@ -277,6 +277,21 @@ public:
|
|||||||
return "Invalid operator";
|
return "Invalid operator";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int negative_operator(void) const
|
||||||
|
{
|
||||||
|
if (t != OPERATOR)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (v.o == SUB || v.o == DIV);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int is_negative(Operator o)
|
||||||
|
{
|
||||||
|
return (o == SUB || o == DIV);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Operation
|
struct Operation
|
||||||
|
|||||||
@@ -709,6 +709,12 @@ static void remove_extra_brackets(std::vector<Expression::Token>& tv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check specifically if the opening undoes applied fixes
|
||||||
|
if (Expression::Token::is_negative(get_prior_mop(tv, get_mop_location(tv, r.start))))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
open_brackets(tv, r);
|
open_brackets(tv, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user