Add EmitterStyle, which will allow sequence or map style (i.e., flow or block) to be preserved between parsing and emitting

This commit is contained in:
Jesse Beder
2015-01-24 12:19:20 -06:00
parent a397ad2925
commit ad712c4f2d
22 changed files with 1451 additions and 1369 deletions

View File

@@ -44,9 +44,20 @@ void EmitFromEvents::OnScalar(const Mark&, const std::string& tag,
}
void EmitFromEvents::OnSequenceStart(const Mark&, const std::string& tag,
anchor_t anchor) {
anchor_t anchor,
EmitterStyle::value style) {
BeginNode();
EmitProps(tag, anchor);
switch (style) {
case EmitterStyle::Block:
m_emitter << Block;
break;
case EmitterStyle::Flow:
m_emitter << Flow;
break;
default:
break;
}
m_emitter << BeginSeq;
m_stateStack.push(State::WaitingForSequenceEntry);
}
@@ -58,9 +69,19 @@ void EmitFromEvents::OnSequenceEnd() {
}
void EmitFromEvents::OnMapStart(const Mark&, const std::string& tag,
anchor_t anchor) {
anchor_t anchor, EmitterStyle::value style) {
BeginNode();
EmitProps(tag, anchor);
switch (style) {
case EmitterStyle::Block:
m_emitter << Block;
break;
case EmitterStyle::Flow:
m_emitter << Flow;
break;
default:
break;
}
m_emitter << BeginMap;
m_stateStack.push(State::WaitingForKey);
}