Commit 2160bb2b by Jesse Beder

Fixed bug with simple keys that are quoted scalars

parent 946d3260
...@@ -309,8 +309,8 @@ namespace YAML ...@@ -309,8 +309,8 @@ namespace YAML
{ {
std::string scalar; std::string scalar;
// eat single or double quote // peek at single or double quote (don't eat because we need to preserve (for the time being) the input position)
char quote = INPUT.get(); char quote = INPUT.peek();
bool single = (quote == '\''); bool single = (quote == '\'');
// setup the scanning parameters // setup the scanning parameters
...@@ -330,6 +330,11 @@ namespace YAML ...@@ -330,6 +330,11 @@ namespace YAML
InsertSimpleKey(); InsertSimpleKey();
int line = INPUT.line, column = INPUT.column; int line = INPUT.line, column = INPUT.column;
// now eat that opening quote
INPUT.get();
// and scan
scalar = ScanScalar(INPUT, params); scalar = ScanScalar(INPUT, params);
m_simpleKeyAllowed = false; m_simpleKeyAllowed = false;
......
...@@ -262,6 +262,7 @@ namespace Test ...@@ -262,6 +262,7 @@ namespace Test
RunParserTest(&Parser::SimpleMap, "simple map", passed); RunParserTest(&Parser::SimpleMap, "simple map", passed);
RunParserTest(&Parser::FlowSeq, "flow seq", passed); RunParserTest(&Parser::FlowSeq, "flow seq", passed);
RunParserTest(&Parser::FlowMap, "flow map", passed); RunParserTest(&Parser::FlowMap, "flow map", passed);
RunParserTest(&Parser::QuotedSimpleKeys, "quoted simple keys", passed);
RunEncodingTest(&EncodeToUtf8, false, "UTF-8, no BOM", passed); RunEncodingTest(&EncodeToUtf8, false, "UTF-8, no BOM", passed);
RunEncodingTest(&EncodeToUtf8, true, "UTF-8 with BOM", passed); RunEncodingTest(&EncodeToUtf8, true, "UTF-8 with BOM", passed);
......
...@@ -28,6 +28,7 @@ namespace Test { ...@@ -28,6 +28,7 @@ namespace Test {
bool SimpleMap(); bool SimpleMap();
bool FlowSeq(); bool FlowSeq();
bool FlowMap(); bool FlowMap();
bool QuotedSimpleKeys();
} }
namespace Emitter { namespace Emitter {
......
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