lab3 feature: add negative operation sorting

This commit is contained in:
2026-11-19 21:50:09 +02:00
parent 6a84d9b1b5
commit 2c6009ae83
9 changed files with 437 additions and 50 deletions
+7 -2
View File
@@ -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);
}