Add types for leaves

Change-Id: Ibea2945920e523d2f3439eed2c12a5d719d178f1
diff --git a/src/grammars.hpp b/src/grammars.hpp
index ab410c8..443b28d 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -21,7 +21,15 @@
 x3::rule<container_class, container_> const container = "container";
 x3::rule<leaf_class, leaf_> const leaf = "leaf";
 x3::rule<path_class, path_> const path = "path";
-x3::rule<data_string_class, std::string> const data_string = "data_string";
+
+x3::rule<leaf_data_class, leaf_data_> const leaf_data = "leaf_data";
+x3::rule<leaf_data_enum_class, enum_> const leaf_data_enum = "leaf_data_enum";
+x3::rule<leaf_data_decimal_class, double> const leaf_data_decimal = "leaf_data_decimal";
+x3::rule<leaf_data_bool_class, bool> const leaf_data_bool = "leaf_data_bool";
+x3::rule<leaf_data_int_class, int32_t> const leaf_data_int = "leaf_data_int";
+x3::rule<leaf_data_uint_class, uint32_t> const leaf_data_uint = "leaf_data_uint";
+x3::rule<leaf_data_string_class, std::string> const leaf_data_string = "leaf_data_string";
+
 x3::rule<cd_class, cd_> const cd = "cd";
 x3::rule<set_class, set_> const set = "set";
 x3::rule<create_class, create_> const create = "create";
@@ -64,8 +72,36 @@
 auto const path_def =
         (x3::expect[container | listElement | nodeup | leaf]) % '/';
 
-auto const data_string_def =
-        lexeme[+char_];
+auto const leaf_data_enum_def =
+        +char_;
+auto const leaf_data_decimal_def =
+        double_;
+
+struct bool_symbol_table : x3::symbols<bool> {
+    bool_symbol_table()
+    {
+        add
+            ("true", true)
+            ("false", false);
+    }
+} const bool_rule;
+
+auto const leaf_data_bool_def =
+        bool_rule;
+auto const leaf_data_int_def =
+        int_;
+auto const leaf_data_uint_def =
+        uint_;
+auto const leaf_data_string_def =
+        *char_;
+
+auto const leaf_data_def =
+        leaf_data_enum |
+        leaf_data_decimal |
+        leaf_data_bool |
+        leaf_data_int |
+        leaf_data_uint |
+        leaf_data_string;
 
 auto const space_separator =
         x3::omit[x3::no_skip[space]];
@@ -80,7 +116,7 @@
         lit("delete") >> space_separator > path;
 
 auto const set_def =
-        lit("set") >> space_separator > path > data_string;
+        lit("set") >> space_separator > path > leaf_data;
 
 auto const command_def =
         x3::expect[cd | create | delete_rule | set] >> x3::eoi;
@@ -98,7 +134,13 @@
 BOOST_SPIRIT_DEFINE(container)
 BOOST_SPIRIT_DEFINE(leaf)
 BOOST_SPIRIT_DEFINE(path)
-BOOST_SPIRIT_DEFINE(data_string)
+BOOST_SPIRIT_DEFINE(leaf_data)
+BOOST_SPIRIT_DEFINE(leaf_data_enum)
+BOOST_SPIRIT_DEFINE(leaf_data_decimal)
+BOOST_SPIRIT_DEFINE(leaf_data_bool)
+BOOST_SPIRIT_DEFINE(leaf_data_int)
+BOOST_SPIRIT_DEFINE(leaf_data_uint)
+BOOST_SPIRIT_DEFINE(leaf_data_string)
 BOOST_SPIRIT_DEFINE(set)
 BOOST_SPIRIT_DEFINE(cd)
 BOOST_SPIRIT_DEFINE(create)