Rework x3::phrase_parse into x3::parse

For commands, there is predefined places where we want to skip spaces:
on the start of the command, in between command arguments and at the
end of the command. Using phrase_parse just makes everything more
complicated, since I have to actually disable space skipping a lot of
the time.

For ls: the ">>" did unexpected stuff, because for example this input:
  > ls foo
could fail if "foo" wasn't a valid node. However, because the ls path
argument is wrapped in in the optional parser, it would still parse it as
valid.

For get: same as ls.

Change-Id: I90b32e1a270da0c228691935cc7206d73248025a
diff --git a/src/common_parsers.hpp b/src/common_parsers.hpp
index 71aedb9..e7bedd3 100644
--- a/src/common_parsers.hpp
+++ b/src/common_parsers.hpp
@@ -16,23 +16,19 @@
 
 // This is a pseudo-parser, that fails if we're not completing a command
 auto const completing_def =
-    x3::no_skip[x3::eps];
+    x3::eps;
 
 auto const node_identifier_def =
-    x3::lexeme[
-            ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_(".")))
-    ];
+    ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_(".")));
 
 auto const module_def =
-    module_identifier >> x3::no_skip[':'] >> !x3::no_skip[x3::space];
+    module_identifier >> ':' >> !x3::space;
 
 auto const module_identifier_def =
-    x3::lexeme[
-            ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_(".")))
-    ];
+    ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_(".")));
 
 auto const space_separator_def =
-    x3::omit[x3::no_skip[+x3::space]];
+    x3::omit[+x3::space];
 
 template <typename CoerceTo>
 struct as_type {
diff --git a/src/grammars.hpp b/src/grammars.hpp
index b8d9456..b1f2878 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -105,7 +105,7 @@
 } const ls_options;
 
 auto const ls_def =
-    ls_::name >> *(space_separator >> ls_options) >> -(space_separator >> (anyPath | (module >> "*")));
+    ls_::name >> *(space_separator >> ls_options) >> -(space_separator > (anyPath | (module >> "*")));
 
 auto const cd_def =
     cd_::name >> space_separator > cdPath;
@@ -146,7 +146,7 @@
 auto const get_def =
     get_::name
     >> -(space_separator >> "-" > staticSuggestions({"-datastore"}) > "-datastore" > space_separator > dsTargetSuggestions > ds_target_table)
-    >> -(space_separator >> getPath);
+    >> -(space_separator > getPath);
 
 auto const set_def =
     set_::name >> space_separator > writableLeafPath > space_separator > leaf_data;
@@ -190,7 +190,7 @@
     {
         auto& parserContext = x3::get<parser_context_tag>(ctx);
         auto iterBeforeDestination = begin;
-        auto save_iter = x3::no_skip[x3::eps[([&iterBeforeDestination](auto& ctx) { iterBeforeDestination = _where(ctx).begin(); })]];
+        auto save_iter = x3::eps[([&iterBeforeDestination](auto& ctx) { iterBeforeDestination = _where(ctx).begin(); })];
         auto grammar = datastoreSuggestions > copy_source > space_separator > datastoreSuggestions > save_iter > copy_destination;
 
         try {
@@ -365,7 +365,7 @@
 #if BOOST_VERSION <= 107800
     x3::eps >>
 #endif
-    createCommandSuggestions >> x3::expect[cd | copy | create | delete_rule | set | commit | get | ls | discard | describe | help | move | dump | prepare | exec | cancel | switch_rule | quit];
+    -space_separator >> createCommandSuggestions >> x3::expect[cd | copy | create | delete_rule | set | commit | get | ls | discard | describe | help | move | dump | prepare | exec | cancel | switch_rule | quit] >> -space_separator;
 
 #if __clang__
 #pragma GCC diagnostic pop
diff --git a/src/leaf_data.hpp b/src/leaf_data.hpp
index df0f9b3..4f11b44 100644
--- a/src/leaf_data.hpp
+++ b/src/leaf_data.hpp
@@ -210,7 +210,7 @@
     }
 };
 
-auto const leaf_data = x3::no_skip[LeafData()];
+auto const leaf_data = LeafData();
 
 BOOST_SPIRIT_DEFINE(leaf_data_string)
 BOOST_SPIRIT_DEFINE(leaf_data_binary)
diff --git a/src/parser.cpp b/src/parser.cpp
index d37e37e..982be11 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -40,7 +40,7 @@
             x3::with<x3::error_handler_tag>(std::ref(errorHandler))[
             x3::with<writableOps_tag>(m_writableOps)[command]]
     ];
-    bool result = x3::phrase_parse(it, line.end(), grammar, x3::space, parsedCommand);
+    bool result = x3::parse(it, line.end(), grammar, parsedCommand);
 
     if (!result || it != line.end()) {
         throw InvalidCommandException(std::string(it, line.end()) + " this was left of input");
@@ -63,7 +63,7 @@
             x3::with<x3::error_handler_tag>(std::ref(errorHandler))[
             x3::with<writableOps_tag>(m_writableOps)[command]]
     ];
-    x3::phrase_parse(it, line.end(), grammar, x3::space, parsedCommand);
+    x3::parse(it, line.end(), grammar, parsedCommand);
 
     auto completionIterator = ctx.m_completionIterator ? *ctx.m_completionIterator : line.end();
 
diff --git a/src/path_parser.hpp b/src/path_parser.hpp
index 1800ffa..638feeb 100644
--- a/src/path_parser.hpp
+++ b/src/path_parser.hpp
@@ -364,9 +364,7 @@
     '[' >> leaf_data >> suggestLeafListEnd >> ']';
 
 auto const key_identifier_def =
-    x3::lexeme[
-        ((x3::alpha | char_("_")) >> *(x3::alnum | char_("_") | char_("-") | char_(".")))
-    ];
+    ((x3::alpha | char_("_")) >> *(x3::alnum | char_("_") | char_("-") | char_(".")));
 
 auto const createKeySuggestions_def =
     x3::eps;
@@ -381,7 +379,7 @@
     key_identifier > '=' > createValueSuggestions > leaf_data;
 
 auto const keyValueWrapper =
-    x3::no_skip['[' > createKeySuggestions > keyValue > suggestKeysEnd > ']'];
+    '[' > createKeySuggestions > keyValue > suggestKeysEnd > ']';
 
 // 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 =
@@ -394,7 +392,7 @@
     x3::omit['/'] >> x3::attr(Scope::Absolute);
 
 auto const trailingSlash_def =
-    x3::no_skip[x3::omit['/']];
+    x3::omit['/'];
 
 auto const filterConfigFalse = [](const Schema& schema, const std::string& path) {
     return schema.isConfig(path);