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 {