Suggest opening bracket for list keys
Change-Id: I570f11aebfd68614b7a9af80c42d9f172c64e32f
diff --git a/src/grammars.hpp b/src/grammars.hpp
index e6a7fc7..583a960 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -63,6 +63,7 @@
x3::rule<initializePath_class, x3::unused_type> const initializePath = "initializePath";
x3::rule<createPathSuggestions_class, x3::unused_type> const createPathSuggestions = "createPathSuggestions";
x3::rule<createKeySuggestions_class, x3::unused_type> const createKeySuggestions = "createKeySuggestions";
+x3::rule<suggestKeysStart_class, x3::unused_type> const suggestKeysStart = "suggestKeysStart";
x3::rule<suggestKeysEnd_class, x3::unused_type> const suggestKeysEnd = "suggestKeysEnd";
x3::rule<createCommandSuggestions_class, x3::unused_type> const createCommandSuggestions = "createCommandSuggestions";
x3::rule<completing_class, x3::unused_type> const completing = "completing";
@@ -89,6 +90,9 @@
auto const createKeySuggestions_def =
x3::eps;
+auto const suggestKeysStart_def =
+ x3::eps;
+
auto const suggestKeysEnd_def =
x3::eps;
@@ -109,14 +113,14 @@
];
auto const listPrefix_def =
- node_identifier >> &char_('[');
+ node_identifier;
// even though we don't allow no keys to be supplied, the star allows me to check which keys are missing
auto const listSuffix_def =
*keyValueWrapper;
auto const listElement_def =
- listPrefix > listSuffix;
+ listPrefix >> -(!char_('[') >> suggestKeysStart) >> &char_('[') > listSuffix;
auto const list_def =
node_identifier >> !char_('[');
@@ -348,6 +352,7 @@
BOOST_SPIRIT_DEFINE(command)
BOOST_SPIRIT_DEFINE(createPathSuggestions)
BOOST_SPIRIT_DEFINE(createKeySuggestions)
+BOOST_SPIRIT_DEFINE(suggestKeysStart)
BOOST_SPIRIT_DEFINE(suggestKeysEnd)
BOOST_SPIRIT_DEFINE(createCommandSuggestions)
BOOST_SPIRIT_DEFINE(completing)