Fix PathParser attribute_type
This took me a while... For some reason, Spirit does not really NEED
this `attribute_type` thing to work properly. Or maybe it does, but
doesn't care if it's invalid, because obviously, `::type` has to be
used, otherwise the using is just the ModeToAttribute type.
Anyway, fixing this revealed another bug on the code: until now, the
getPath parser used decltype(get_::m_path) as the attribute, which is
`boost::optional<boost::variant<dataPath_, module_>>. However, this is
not the correct attribute, because the getPath parser can only parse a
dataPath_, or a module_. The "optional wrapping" is done via the
optional parser directly in the rule for the get command.
The reason I found all of this is that I wanted add an optional argument
for `get` and I kept getting errors for "can't assign
boost::optional<boost::variant<...>> to boost::variant<...>".
Change-Id: I76ff8d3f201b58bb83b68c428f6b95f5c87f3a75
diff --git a/src/path_parser.hpp b/src/path_parser.hpp
index e69eef1..1800ffa 100644
--- a/src/path_parser.hpp
+++ b/src/path_parser.hpp
@@ -15,7 +15,7 @@
namespace x3 = boost::spirit::x3;
x3::rule<cdPath_class, dataPath_> const cdPath = "cdPath";
-x3::rule<getPath_class, decltype(get_::m_path)> const getPath = "getPath";
+x3::rule<getPath_class, decltype(get_::m_path)::value_type> const getPath = "getPath";
x3::rule<rpcPath_class, dataPath_> const rpcPath = "rpcPath";
x3::rule<presenceContainerPath_class, dataPath_> const presenceContainerPath = "presenceContainerPath";
x3::rule<listInstancePath_class, dataPath_> const listInstancePath = "listInstancePath";
@@ -265,7 +265,7 @@
template <PathParserMode PARSER_MODE, CompletionMode COMPLETION_MODE>
struct PathParser : x3::parser<PathParser<PARSER_MODE, COMPLETION_MODE>> {
- using attribute_type = ModeToAttribute<PARSER_MODE>;
+ using attribute_type = typename ModeToAttribute<PARSER_MODE>::type;
std::function<bool(const Schema&, const std::string& path)> m_filterFunction;
PathParser(const std::function<bool(const Schema&, const std::string& path)>& filterFunction = [](const auto&, const auto&) { return true; })