From 3a22138af78d2e98c142bf94ab23229950dd118a Mon Sep 17 00:00:00 2001 From: dota17 Date: Sat, 13 Jun 2020 17:08:16 +0800 Subject: [PATCH] tag_null --- src/singledocparser.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/singledocparser.cpp b/src/singledocparser.cpp index 3e5638b..65602af 100644 --- a/src/singledocparser.cpp +++ b/src/singledocparser.cpp @@ -90,16 +90,17 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) { const Token& token = m_scanner.peek(); - if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) { + // add non-specific tags + if (tag.empty()) + tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?"); + + if (token.type == Token::PLAIN_SCALAR + && tag.compare("?") == 0 && IsNullString(token.value)) { eventHandler.OnNull(mark, anchor); m_scanner.pop(); return; } - // add non-specific tags - if (tag.empty()) - tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?"); - // now split based on what kind of node we should be switch (token.type) { case Token::PLAIN_SCALAR: