aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/server/parser/operator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/parser/operator.hpp')
-rw-r--r--server/parser/operator.hpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/parser/operator.hpp b/server/parser/operator.hpp
index 86b9eb1..fd45aa2 100644
--- a/server/parser/operator.hpp
+++ b/server/parser/operator.hpp
@@ -42,8 +42,8 @@ public:
static constexpr unsigned min_precedence() { return 0; }
- unsigned get_precedence() const {
- switch (m_type) {
+ static unsigned get_precedence(Type type) {
+ switch (type) {
case Type::PLUS:
case Type::MINUS:
return min_precedence();
@@ -53,13 +53,15 @@ public:
return min_precedence() + 1;
case Type::CARET:
- return min_precedence() + 2;
+ return min_precedence() + 3;
default:
throw ParserError{"internal: undefined operator precedence"};
}
}
+ unsigned get_precedence() const { return get_precedence(m_type); }
+
bool is_right_associative() const {
switch (m_type) {
case Type::CARET: