Add types for leaves
Change-Id: Ibea2945920e523d2f3439eed2c12a5d719d178f1
diff --git a/src/ast_commands.hpp b/src/ast_commands.hpp
index 5caeb2e..90af8ea 100644
--- a/src/ast_commands.hpp
+++ b/src/ast_commands.hpp
@@ -17,9 +17,12 @@
using x3::alnum;
using x3::alpha;
using x3::char_;
+using x3::double_;
using x3::expect;
+using x3::int_;
using x3::lexeme;
using x3::lit;
+using x3::uint_;
struct parser_context_tag;
@@ -40,10 +43,24 @@
path_ m_path;
};
+struct enum_ {
+ enum_();
+ enum_(const std::string& value);
+ bool operator==(const enum_& b) const;
+ std::string m_value;
+};
+
+using leaf_data_ = boost::variant<enum_,
+ double,
+ bool,
+ int32_t,
+ uint32_t,
+ std::string>;
+
struct set_ : x3::position_tagged {
bool operator==(const set_& b) const;
path_ m_path;
- std::string m_data;
+ leaf_data_ m_data;
};
using command_ = boost::variant<cd_, create_, delete_, set_>;
@@ -51,4 +68,5 @@
BOOST_FUSION_ADAPT_STRUCT(cd_, m_path)
BOOST_FUSION_ADAPT_STRUCT(create_, m_path)
BOOST_FUSION_ADAPT_STRUCT(delete_, m_path)
+BOOST_FUSION_ADAPT_STRUCT(enum_, m_value)
BOOST_FUSION_ADAPT_STRUCT(set_, m_path, m_data)