diff --git a/src/headers/lex.hpp b/src/headers/lex.hpp index e00b19d..baed249 100644 --- a/src/headers/lex.hpp +++ b/src/headers/lex.hpp @@ -19,6 +19,15 @@ struct tok { const type toktype; const std::string toktext; const unsigned long line; + tok& operator=(const tok& other) { + if (this != &other) { + const_cast(toktype) = other.toktype; + const_cast(toktext) = other.toktext; + const_cast(line) = other.line; + } + return *this; + } + tok(): toktype(UNEXPECTED), toktext(), line(0) {}; tok(const type& Type, std::string_view Text, const decltype(line)& line = 0): toktype(Type), toktext(Text), line(line) {} explicit tok(const type& Type, const decltype(line)& line = 0): tok(Type, std::string(1, Type), line) {}; friend std::ostream& operator<<(std::ostream& output, const tok& it) { return output << it.toktext; }