Change how create/delete path argument is parsed
The handler for create/delete was an inherited class from
presenceContainerPathHandler class, so that the code is shared between
create/delete. However, this means that it is impossible to change the
grammar for create/delete to include other types of paths (because the
handler was hardcoded to presence containers). This change ties the
handler to the "path" rule rather than to the create/delete rule. This
method is also in line with the "set" command where the path is checked
in the "leafPath" rule rather than in the "set" rule.
Change-Id: Ic41aa26bf4bc93f762435f43312489e10472e475
diff --git a/src/grammars.hpp b/src/grammars.hpp
index 5878053..abdd9ce 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -34,6 +34,7 @@
x3::rule<dataPathListEnd_class, dataPath_> const dataPathListEnd = "dataPathListEnd";
x3::rule<dataPath_class, dataPath_> const dataPath = "dataPath";
x3::rule<leaf_path_class, dataPath_> const leafPath = "leafPath";
+x3::rule<presenceContainerPath_class, dataPath_> const presenceContainerPath = "presenceContainerPath";
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";
@@ -178,6 +179,9 @@
auto const leafPath_def =
dataPath;
+auto const presenceContainerPath_def =
+ dataPath;
+
auto const createEnumSuggestions_def =
x3::eps;
@@ -240,10 +244,10 @@
cd_::name >> space_separator > dataPath;
auto const create_def =
- create_::name >> space_separator > dataPath;
+ create_::name >> space_separator > presenceContainerPath;
auto const delete_rule_def =
- delete_::name >> space_separator > dataPath;
+ delete_::name >> space_separator > presenceContainerPath;
auto const get_def =
get_::name >> -(space_separator >> (dataPathListEnd | dataPath));
@@ -293,6 +297,7 @@
BOOST_SPIRIT_DEFINE(container)
BOOST_SPIRIT_DEFINE(leaf)
BOOST_SPIRIT_DEFINE(leafPath)
+BOOST_SPIRIT_DEFINE(presenceContainerPath)
BOOST_SPIRIT_DEFINE(schemaPath)
BOOST_SPIRIT_DEFINE(dataPath)
BOOST_SPIRIT_DEFINE(dataNodeList)