lab3 feature: add negative operation sorting
This commit is contained in:
+7
-2
@@ -37,7 +37,6 @@ public:
|
||||
case Expression::Token::OPA:
|
||||
case Expression::Token::CPA:
|
||||
case Expression::Token::NOP:
|
||||
pr_warn("Unweightable operator - this is probably a bug!");
|
||||
return 0;
|
||||
case Expression::Token::ADD:
|
||||
return 1;
|
||||
@@ -315,7 +314,13 @@ public:
|
||||
return (v.o == SUB || v.o == DIV);
|
||||
}
|
||||
|
||||
static int is_negative(Operator o)
|
||||
// alias
|
||||
[[nodiscard]] int is_negative(void) const
|
||||
{
|
||||
return negative_operator();
|
||||
}
|
||||
|
||||
[[nodiscard]] static int is_negative(Operator o)
|
||||
{
|
||||
return (o == SUB || o == DIV);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user