Added ability to read compact maps in a flow sequence

This commit is contained in:
Jesse Beder
2009-10-29 19:41:46 +00:00
parent a372bfdc60
commit 8c9c9d90da
8 changed files with 75 additions and 19 deletions

View File

@@ -38,9 +38,6 @@ namespace YAML
{
if(!m_simpleKeyAllowed)
return false;
if(InFlowContext() && m_flows.top() != FLOW_MAP)
return false;
return !ExistsActiveSimpleKey();
}
@@ -68,10 +65,15 @@ namespace YAML
SimpleKey key(INPUT.mark(), GetFlowLevel());
// first add a map start, if necessary
key.pIndent = PushIndentTo(INPUT.column(), IndentMarker::MAP);
if(key.pIndent) {
key.pIndent->status = IndentMarker::UNKNOWN;
key.pMapStart = key.pIndent->pStartToken;
if(InBlockContext()) {
key.pIndent = PushIndentTo(INPUT.column(), IndentMarker::MAP);
if(key.pIndent) {
key.pIndent->status = IndentMarker::UNKNOWN;
key.pMapStart = key.pIndent->pStartToken;
key.pMapStart->status = Token::UNVERIFIED;
}
} else if(m_flows.top() == FLOW_SEQ) {
key.pMapStart = PushToken(Token::FLOW_MAP_COMPACT);
key.pMapStart->status = Token::UNVERIFIED;
}