Fixed empty scalar in sequence bug

This commit is contained in:
Jesse Beder
2009-07-30 05:54:40 +00:00
parent ae41e58ca3
commit 382f1ba3c7
3 changed files with 14 additions and 3 deletions

View File

@@ -264,7 +264,7 @@ namespace YAML
if(node.m_pContent) if(node.m_pContent)
node.m_pContent->Write(out); node.m_pContent->Write(out);
else else
out << ""; out << Null;
return out; return out;
} }

View File

@@ -4,6 +4,7 @@
#include "scanner.h" #include "scanner.h"
#include "token.h" #include "token.h"
#include "emitter.h" #include "emitter.h"
#include <stdexcept>
namespace YAML namespace YAML
{ {
@@ -80,6 +81,14 @@ namespace YAML
Node *pNode = new Node; Node *pNode = new Node;
m_data.push_back(pNode); m_data.push_back(pNode);
// check for null
if(!pScanner->empty()) {
const Token& token = pScanner->peek();
if(token.type == TT_BLOCK_ENTRY || token.type == TT_BLOCK_END)
continue;
}
pNode->Parse(pScanner, state); pNode->Parse(pScanner, state);
} }
} }

View File

@@ -30,7 +30,8 @@ namespace YAML
TT_ANCHOR, TT_ANCHOR,
TT_ALIAS, TT_ALIAS,
TT_TAG, TT_TAG,
TT_SCALAR TT_SCALAR,
TT_NULL
}; };
const std::string TokenNames[] = { const std::string TokenNames[] = {
@@ -51,7 +52,8 @@ namespace YAML
"ANCHOR", "ANCHOR",
"ALIAS", "ALIAS",
"TAG", "TAG",
"SCALAR" "SCALAR",
"NULL"
}; };
struct Token { struct Token {