#ifndef OBJECT_HH #define OBJECT_HH #include #include #include enum class StringObjectType : uint8_t { IDENTIFIER, LITERAL, }; enum class ObjectType : uint8_t { NIL, BOOL, IDENTIFIER, STRING_LIT, NUMBER, }; struct Object { Object() : type{ObjectType::NIL}, value{std::monostate{}} {}; Object(bool value) : type{ObjectType::BOOL}, value{value} {}; Object(double number) : type{ObjectType::NUMBER}, value{number} {}; Object(StringObjectType string_type, std::string value) : type{ string_type == StringObjectType::IDENTIFIER ? ObjectType::IDENTIFIER : ObjectType::STRING_LIT }, value{std::move(value)} {}; std::string to_string(); ObjectType type; std::variant value; }; std::ostream &operator<<(std::ostream &os, const ObjectType &type); std::ostream &operator<<(std::ostream &os, const Object &obj); #endif