Disallow space between list suffix and list prefix
This is also needed for the move command: random parsers
eating random spaces was messing with the parser. I want
spaces to be eaten by space_separator.
Change-Id: I4e515168888e054ccd7708d722730890bf4ab2de
diff --git a/src/path_parser.hpp b/src/path_parser.hpp
index 6d9a304..8129d86 100644
--- a/src/path_parser.hpp
+++ b/src/path_parser.hpp
@@ -370,7 +370,7 @@
key_identifier > '=' > createValueSuggestions > leaf_data;
auto const keyValueWrapper =
- x3::lexeme['[' > createKeySuggestions > keyValue > suggestKeysEnd > ']'];
+ x3::no_skip['[' > 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 =
diff --git a/tests/cd.cpp b/tests/cd.cpp
index 32d7230..ec9133a 100644
--- a/tests/cd.cpp
+++ b/tests/cd.cpp
@@ -294,6 +294,12 @@
input = "cd example:twoKeyList[number=4][name=abcd]";
}
}
+
+ SECTION("no space between list prefix and suffix")
+ {
+ input = "cd example:list [number=10]";
+ }
+
REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException);
}
}