Commit 62761897 authored by Jesse Beder's avatar Jesse Beder
Browse files

Merged ? fix from core

parents bcdda402 8c517bf0
...@@ -91,7 +91,7 @@ namespace YAML ...@@ -91,7 +91,7 @@ namespace YAML
return e; return e;
} }
inline const RegEx& Key() { inline const RegEx& Key() {
static const RegEx e = RegEx('?'); static const RegEx e = RegEx('?') + BlankOrBreak();
return e; return e;
} }
inline const RegEx& KeyInFlow() { inline const RegEx& KeyInFlow() {
......
...@@ -16,6 +16,18 @@ namespace Test ...@@ -16,6 +16,18 @@ namespace Test
} }
return " no exception caught"; return " no exception caught";
} }
TEST PlainScalarStartingWithQuestionMark()
{
HANDLE("foo: ?bar");
EXPECT_DOC_START();
EXPECT_MAP_START("?", 0);
EXPECT_SCALAR("?", 0, "foo");
EXPECT_SCALAR("?", 0, "?bar");
EXPECT_MAP_END();
EXPECT_DOC_END();
DONE();
}
} }
namespace { namespace {
...@@ -44,6 +56,7 @@ namespace Test ...@@ -44,6 +56,7 @@ namespace Test
int passed = 0; int passed = 0;
int total = 0; int total = 0;
RunParserTest(&Parser::NoEndOfMapFlow, "No end of map flow", passed, total); RunParserTest(&Parser::NoEndOfMapFlow, "No end of map flow", passed, total);
RunParserTest(&Parser::PlainScalarStartingWithQuestionMark, "Plain scalar starting with question mark", passed, total);
std::cout << "Parser tests: " << passed << "/" << total << " passed\n"; std::cout << "Parser tests: " << passed << "/" << total << " passed\n";
return passed == total; return passed == total;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment