Allow whitespace before ] in inline collection
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
parent
572375180e
commit
f164acad0b
|
@ -256,8 +256,8 @@ using LinesCache = StackVec<Line, 512>;
|
|||
|
||||
std::string constructYamlError(size_t lineNumber, const char *lineBeg, const char *parsePos, const char *reason = nullptr);
|
||||
|
||||
static std::regex inlineCollectionRegex(R"regex(^\[(\s*(\d|\w)+,?)+\]\s*\n)regex");
|
||||
constexpr ConstStringRef inlineCollectionYamlErrorMsg = "NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\]\\s*\\n";
|
||||
static std::regex inlineCollectionRegex(R"regex(^\[(\s*(\d|\w)+,?)+\s*\]\s*\n)regex");
|
||||
constexpr ConstStringRef inlineCollectionYamlErrorMsg = "NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\s*\\]\\s*\\n";
|
||||
|
||||
bool tokenize(ConstStringRef text, LinesCache &outLines, TokensCache &outTokens, std::string &outErrReason, std::string &outWarning);
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ TEST(YamlTokenize, GivenInvalidInlineCollectionThenEmitsError) {
|
|||
|
||||
bool success = NEO::Yaml::tokenize("]\n", lines, tokens, errors, warnings);
|
||||
EXPECT_FALSE(success);
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : []] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : []] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\s*\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_TRUE(warnings.empty()) << warnings;
|
||||
|
||||
lines.clear();
|
||||
|
@ -451,7 +451,7 @@ TEST(YamlTokenize, GivenInvalidInlineCollectionThenEmitsError) {
|
|||
|
||||
success = NEO::Yaml::tokenize(",\n", lines, tokens, errors, warnings);
|
||||
EXPECT_FALSE(success);
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [,] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [,] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\s*\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_TRUE(warnings.empty()) << warnings;
|
||||
|
||||
lines.clear();
|
||||
|
@ -461,7 +461,7 @@ TEST(YamlTokenize, GivenInvalidInlineCollectionThenEmitsError) {
|
|||
|
||||
success = NEO::Yaml::tokenize("[123,32,,]\n", lines, tokens, errors, warnings);
|
||||
EXPECT_FALSE(success);
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [[] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [[] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\s*\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_TRUE(warnings.empty()) << warnings;
|
||||
|
||||
lines.clear();
|
||||
|
@ -471,7 +471,7 @@ TEST(YamlTokenize, GivenInvalidInlineCollectionThenEmitsError) {
|
|||
|
||||
success = NEO::Yaml::tokenize("[1,2,3,4]]\n", lines, tokens, errors, warnings);
|
||||
EXPECT_FALSE(success);
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [[] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [[] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\s*\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_TRUE(warnings.empty()) << warnings;
|
||||
|
||||
lines.clear();
|
||||
|
@ -481,7 +481,7 @@ TEST(YamlTokenize, GivenInvalidInlineCollectionThenEmitsError) {
|
|||
|
||||
success = NEO::Yaml::tokenize("[[1,2,3,4]]\n", lines, tokens, errors, warnings);
|
||||
EXPECT_FALSE(success);
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [[] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_STREQ("NEO::Yaml : Could not parse line : [0] : [[] <-- parser position on error. Reason : NEO::Yaml : Inline collection is not in valid regex format - ^\\[(\\s*(\\d|\\w)+,?)+\\s*\\]\\s*\\n\n", errors.c_str());
|
||||
EXPECT_TRUE(warnings.empty()) << warnings;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue