Add a character cast operator to tok in lex.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
2425d19f9f
commit
74c5904d21
|
@ -26,6 +26,7 @@ struct tok {
|
|||
tok() = delete;
|
||||
tok(const type& Type, std::string_view Text, const decltype(line)& line = 1): toktype(Type), toktext(Text), line(line) {}
|
||||
explicit tok(const type& Type, const decltype(line)& line = 1): tok(Type, std::string(1, Type), line) {};
|
||||
operator char() const { return static_cast<char>(toktype); }
|
||||
friend std::ostream& operator<<(std::ostream& output, const tok& it) { return output << it.toktext; }
|
||||
};
|
||||
std::vector<tok> lex(const std::string& in);
|
||||
|
|
Loading…
Reference in New Issue