Add bool type to object
This commit is contained in:
parent
1118e825f3
commit
6f156c0487
@ -12,6 +12,7 @@ enum class StringObjectType : uint8_t {
|
|||||||
|
|
||||||
enum class ObjectType : uint8_t {
|
enum class ObjectType : uint8_t {
|
||||||
NIL,
|
NIL,
|
||||||
|
BOOL,
|
||||||
IDENTIFIER,
|
IDENTIFIER,
|
||||||
STRING_LIT,
|
STRING_LIT,
|
||||||
NUMBER,
|
NUMBER,
|
||||||
@ -19,6 +20,7 @@ enum class ObjectType : uint8_t {
|
|||||||
|
|
||||||
struct Object {
|
struct Object {
|
||||||
Object() : type{ObjectType::NIL}, value{std::monostate{}} {};
|
Object() : type{ObjectType::NIL}, value{std::monostate{}} {};
|
||||||
|
Object(bool value) : type{ObjectType::BOOL}, value{value} {};
|
||||||
Object(double number) : type{ObjectType::NUMBER}, value{number} {};
|
Object(double number) : type{ObjectType::NUMBER}, value{number} {};
|
||||||
Object(StringObjectType string_type, std::string value)
|
Object(StringObjectType string_type, std::string value)
|
||||||
: type{
|
: type{
|
||||||
@ -29,7 +31,7 @@ struct Object {
|
|||||||
value{std::move(value)} {};
|
value{std::move(value)} {};
|
||||||
|
|
||||||
ObjectType type;
|
ObjectType type;
|
||||||
std::variant<std::monostate, std::string, double> value;
|
std::variant<std::monostate, std::string, double, bool> value;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &os, const ObjectType &type);
|
std::ostream &operator<<(std::ostream &os, const ObjectType &type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user