// Common definitions #pragma once #include #include #include #include #include #include using namespace std::string_literals; using index_t = size_t; namespace fs = std::filesystem; std::vector split(std::string s); struct Location { size_t line{1}; size_t column{1}; size_t pos{0}; void advance(bool newline = false); ///< advance 1 char std::string toString() const; }; bool operator==(const Location &a, const Location &b); struct Token { std::string type; std::string value; Location location; std::string toString() const; }; // For printing via Google Test bool operator==(const Token &a, const Token &b); std::ostream& operator<<(std::ostream& os, const Token& token); struct PairHashSS { size_t operator()(const std::pair& p) const noexcept { size_t h0 {std::hash{}(p.first)}; size_t h1 {std::hash{}(p.second)}; return h0 ^ (h1 << 1); } }; std::string demangle(const std::type_info& type); std::vector to_little_endian(uint32_t value); uint32_t from_little_endian(const std::vector& value);