ScalarMappingParser::mShouldExpectKey should be true to start/end the top-level mapping
This commit is contained in:
parent
49e3395a4c
commit
523eaef902
1 changed files with 7 additions and 1 deletions
|
@ -28,7 +28,12 @@ ScalarMappingParser::~ScalarMappingParser()
|
|||
void
|
||||
ScalarMappingParser::HandleEvent(yaml_event_t& event)
|
||||
{
|
||||
if (event.type == YAML_MAPPING_END_EVENT) {
|
||||
if (mShouldExpectKey && event.type == YAML_MAPPING_START_EVENT) {
|
||||
printf("%s: start scalar mapping: tag = %s\n", __PRETTY_FUNCTION__,
|
||||
event.data.mapping_start.tag);
|
||||
return;
|
||||
}
|
||||
else if (mShouldExpectKey && event.type == YAML_MAPPING_END_EVENT) {
|
||||
SetDone(true);
|
||||
return;
|
||||
}
|
||||
|
@ -36,6 +41,7 @@ ScalarMappingParser::HandleEvent(yaml_event_t& event)
|
|||
if (mShouldExpectKey && event.type == YAML_SCALAR_EVENT) {
|
||||
HandleKeyEvent(std::string((char*)event.data.scalar.value,
|
||||
event.data.scalar.length));
|
||||
mShouldExpectKey = false;
|
||||
}
|
||||
else {
|
||||
HandleValueEvent(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue