diff --git a/furc/include/furc/front/token.hpp b/furc/include/furc/front/token.hpp index 386e6c4..ff05de4 100644 --- a/furc/include/furc/front/token.hpp +++ b/furc/include/furc/front/token.hpp @@ -54,6 +54,9 @@ enum class token_t { GreaterThan, /**< `>` */ LessEq, /**< `<=` */ GreaterEq, /**< `>=` */ + + SlimArrow, /**< `->` */ + FatArrow, /**< `=>` */ }; static inline std::ostream& operator<<(std::ostream& os, token_t type) { @@ -92,6 +95,8 @@ static inline std::ostream& operator<<(std::ostream& os, token_t type) { case token_t::GreaterThan: return os << ">"; case token_t::LessEq: return os << "<="; case token_t::GreaterEq: return os << ">="; + case token_t::SlimArrow: return os << "->"; + case token_t::FatArrow: return os << "=>"; } return os; } @@ -132,6 +137,8 @@ static inline std::string operator+(const std::string& str, token_t type) { case token_t::GreaterThan: return str + ">"; case token_t::LessEq: return str + "<="; case token_t::GreaterEq: return str + ">="; + case token_t::SlimArrow: return str + "->"; + case token_t::FatArrow: return str + "=>"; } return str; } diff --git a/furc/src/front/lexer.cpp b/furc/src/front/lexer.cpp index 70007c0..b7adee0 100644 --- a/furc/src/front/lexer.cpp +++ b/furc/src/front/lexer.cpp @@ -144,6 +144,8 @@ token_r lexer::next_token() { { ">", token_t::GreaterThan }, { "<=", token_t::LessEq }, { ">=", token_t::GreaterEq }, + { "->", token_t::SlimArrow }, + { "=>", token_t::FatArrow }, }; token_t type = token_t::None;