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

@@ -103,8 +103,12 @@ namespace YAML
throw ParserException(INPUT.mark(), ErrorMsg::FLOW_END);
// we might have a solo entry in the flow context
if(VerifySimpleKey())
m_tokens.push(Token(Token::VALUE, INPUT.mark()));
if(InFlowContext()) {
if(m_flows.top() == FLOW_MAP && VerifySimpleKey())
m_tokens.push(Token(Token::VALUE, INPUT.mark()));
else if(m_flows.top() == FLOW_SEQ)
InvalidateSimpleKey();
}
m_simpleKeyAllowed = false;
@@ -125,9 +129,13 @@ namespace YAML
// FlowEntry
void Scanner::ScanFlowEntry()
{
// we might have a solo entry in the flow context
if(VerifySimpleKey())
m_tokens.push(Token(Token::VALUE, INPUT.mark()));
// we might have a solo entry in the flow context
if(InFlowContext()) {
if(m_flows.top() == FLOW_MAP && VerifySimpleKey())
m_tokens.push(Token(Token::VALUE, INPUT.mark()));
else if(m_flows.top() == FLOW_SEQ)
InvalidateSimpleKey();
}
m_simpleKeyAllowed = true;