From 372064af20a456989c2a9ea2fda6e535d74dbafd Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 30 Dec 2019 13:06:13 +0300 Subject: support the power (^) operator It doesn't work with the unary minus currently (as is reflected in the tests), it should have a higher precedence. --- server/lexer/token_type.cpp | 1 + server/lexer/token_type.hpp | 1 + 2 files changed, 2 insertions(+) (limited to 'server/lexer') diff --git a/server/lexer/token_type.cpp b/server/lexer/token_type.cpp index cafb403..6a42a3d 100644 --- a/server/lexer/token_type.cpp +++ b/server/lexer/token_type.cpp @@ -35,6 +35,7 @@ private: {Type::MINUS, "-"}, {Type::ASTERISK, "*"}, {Type::SLASH, "/"}, + {Type::CARET, "^"}, {Type::LEFT_PAREN, "("}, {Type::RIGHT_PAREN, ")"}, {Type::NUMBER, "number"}, diff --git a/server/lexer/token_type.hpp b/server/lexer/token_type.hpp index fba2abb..2040d28 100644 --- a/server/lexer/token_type.hpp +++ b/server/lexer/token_type.hpp @@ -18,6 +18,7 @@ enum class Type { MINUS, ASTERISK, SLASH, + CARET, LEFT_PAREN, RIGHT_PAREN, NUMBER, -- cgit v1.2.3