diff options
author | Mikhail Borisov <borisov.mikhail@gmail.com> | 2022-02-10 16:45:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:39 +0300 |
commit | a6a92afe03e02795227d2641b49819b687f088f8 (patch) | |
tree | f6984a1d27d5a7ec88a6fdd6e20cd5b7693b6ece /library/cpp/yson_pull/read_ops.cpp | |
parent | c6dc8b8bd530985bc4cce0137e9a5de32f1087cb (diff) | |
download | ydb-a6a92afe03e02795227d2641b49819b687f088f8.tar.gz |
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yson_pull/read_ops.cpp')
-rw-r--r-- | library/cpp/yson_pull/read_ops.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/yson_pull/read_ops.cpp b/library/cpp/yson_pull/read_ops.cpp index 9d7e6a4a2d..9fa1fe79b3 100644 --- a/library/cpp/yson_pull/read_ops.cpp +++ b/library/cpp/yson_pull/read_ops.cpp @@ -1,66 +1,66 @@ -#include "read_ops.h" - -using namespace NYsonPull; -using namespace NYsonPull::NReadOps; - -namespace { +#include "read_ops.h" + +using namespace NYsonPull; +using namespace NYsonPull::NReadOps; + +namespace { bool TrySkipValueUntil(EEventType end, TReader& reader) { - const auto& event = reader.NextEvent(); - if (event.Type() == end) { + const auto& event = reader.NextEvent(); + if (event.Type() == end) { return false; } SkipCurrentValue(event, reader); return true; } - + bool TrySkipKeyValueUntil(EEventType end, TReader& reader) { - const auto& event = reader.NextEvent(); - if (event.Type() == end) { + const auto& event = reader.NextEvent(); + if (event.Type() == end) { return false; } - Expect(event, EEventType::Key); + Expect(event, EEventType::Key); SkipValue(reader); return true; } -} - -void NYsonPull::NReadOps::SkipCurrentValue(const TEvent& event, TReader& reader) { - switch (event.Type()) { - case EEventType::BeginList: - while (TrySkipValueUntil(EEventType::EndList, reader)) { +} + +void NYsonPull::NReadOps::SkipCurrentValue(const TEvent& event, TReader& reader) { + switch (event.Type()) { + case EEventType::BeginList: + while (TrySkipValueUntil(EEventType::EndList, reader)) { } return; - - case EEventType::BeginMap: - while (TrySkipKeyValueUntil(EEventType::EndMap, reader)) { + + case EEventType::BeginMap: + while (TrySkipKeyValueUntil(EEventType::EndMap, reader)) { } return; - - case EEventType::BeginAttributes: - while (TrySkipKeyValueUntil(EEventType::EndAttributes, reader)) { + + case EEventType::BeginAttributes: + while (TrySkipKeyValueUntil(EEventType::EndAttributes, reader)) { } // attributes after attributes are disallowed in TReader SkipValue(reader); return; - - case EEventType::Scalar: + + case EEventType::Scalar: return; - + default: throw yexception() << "Unexpected event: " << event; } -} - -void NYsonPull::NReadOps::SkipValue(TReader& reader) { - const auto& event = reader.NextEvent(); +} + +void NYsonPull::NReadOps::SkipValue(TReader& reader) { + const auto& event = reader.NextEvent(); SkipCurrentValue(event, reader); -} - -void NYsonPull::NReadOps::SkipControlRecords(TReader& reader) { - const auto* event = &reader.LastEvent(); - while (event->Type() == EEventType::BeginAttributes) { - SkipCurrentValue(*event, reader); - event = &reader.NextEvent(); - } - Expect(*event, EEventType::BeginMap); -} +} + +void NYsonPull::NReadOps::SkipControlRecords(TReader& reader) { + const auto* event = &reader.LastEvent(); + while (event->Type() == EEventType::BeginAttributes) { + SkipCurrentValue(*event, reader); + event = &reader.NextEvent(); + } + Expect(*event, EEventType::BeginMap); +} |