diff options
author | sobols <sobols@yandex-team.ru> | 2022-02-10 16:47:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:08 +0300 |
commit | 09961b69c61f471ddd594e0fd877df62a8021562 (patch) | |
tree | 54a7b60a9526a7104557a033eb0a8d70d64b604c /contrib/libs/yaml-cpp/src | |
parent | 4ce8835206f981afa4a61915a49a21fb750416ec (diff) | |
download | ydb-09961b69c61f471ddd594e0fd877df62a8021562.tar.gz |
Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/yaml-cpp/src')
24 files changed, 400 insertions, 400 deletions
diff --git a/contrib/libs/yaml-cpp/src/collectionstack.h b/contrib/libs/yaml-cpp/src/collectionstack.h index 46c463ebce..23e1bd397a 100644 --- a/contrib/libs/yaml-cpp/src/collectionstack.h +++ b/contrib/libs/yaml-cpp/src/collectionstack.h @@ -27,7 +27,7 @@ class CollectionStack { collectionStack.push(type); } void PopCollectionType(CollectionType::value type) { - (void)type; + (void)type; assert(type == GetCurCollectionType()); collectionStack.pop(); } diff --git a/contrib/libs/yaml-cpp/src/emit.cpp b/contrib/libs/yaml-cpp/src/emit.cpp index 51bc791533..4eac410986 100644 --- a/contrib/libs/yaml-cpp/src/emit.cpp +++ b/contrib/libs/yaml-cpp/src/emit.cpp @@ -22,4 +22,4 @@ std::string Dump(const Node& node) { emitter << node; return emitter.c_str(); } -} // namespace YAML +} // namespace YAML diff --git a/contrib/libs/yaml-cpp/src/emitfromevents.cpp b/contrib/libs/yaml-cpp/src/emitfromevents.cpp index 4832649f3c..3d72822bd5 100644 --- a/contrib/libs/yaml-cpp/src/emitfromevents.cpp +++ b/contrib/libs/yaml-cpp/src/emitfromevents.cpp @@ -111,7 +111,7 @@ void EmitFromEvents::BeginNode() { } void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) { - if (!tag.empty() && tag != "?" && tag != "!") + if (!tag.empty() && tag != "?" && tag != "!") m_emitter << VerbatimTag(tag); if (anchor) m_emitter << Anchor(ToString(anchor)); diff --git a/contrib/libs/yaml-cpp/src/emitterstate.cpp b/contrib/libs/yaml-cpp/src/emitterstate.cpp index 3542aaf507..8b785e852b 100644 --- a/contrib/libs/yaml-cpp/src/emitterstate.cpp +++ b/contrib/libs/yaml-cpp/src/emitterstate.cpp @@ -53,31 +53,31 @@ void EmitterState::SetNonContent() { m_hasNonContent = true; } void EmitterState::SetLongKey() { assert(!m_groups.empty()); - if (m_groups.empty()) { + if (m_groups.empty()) { return; - } + } - assert(m_groups.back()->type == GroupType::Map); - m_groups.back()->longKey = true; + assert(m_groups.back()->type == GroupType::Map); + m_groups.back()->longKey = true; } void EmitterState::ForceFlow() { assert(!m_groups.empty()); - if (m_groups.empty()) { + if (m_groups.empty()) { return; - } + } - m_groups.back()->flowType = FlowType::Flow; + m_groups.back()->flowType = FlowType::Flow; } void EmitterState::StartedNode() { if (m_groups.empty()) { m_docCount++; } else { - m_groups.back()->childCount++; - if (m_groups.back()->childCount % 2 == 0) { - m_groups.back()->longKey = false; - } + m_groups.back()->childCount++; + if (m_groups.back()->childCount % 2 == 0) { + m_groups.back()->longKey = false; + } } m_hasAnchor = false; @@ -124,50 +124,50 @@ void EmitterState::StartedScalar() { void EmitterState::StartedGroup(GroupType::value type) { StartedNode(); - const std::size_t lastGroupIndent = - (m_groups.empty() ? 0 : m_groups.back()->indent); + const std::size_t lastGroupIndent = + (m_groups.empty() ? 0 : m_groups.back()->indent); m_curIndent += lastGroupIndent; - // TODO: Create move constructors for settings types to simplify transfer - std::unique_ptr<Group> pGroup(new Group(type)); + // TODO: Create move constructors for settings types to simplify transfer + std::unique_ptr<Group> pGroup(new Group(type)); // transfer settings (which last until this group is done) - // - // NB: if pGroup->modifiedSettings == m_modifiedSettings, - // m_modifiedSettings is not changed! - pGroup->modifiedSettings = std::move(m_modifiedSettings); + // + // NB: if pGroup->modifiedSettings == m_modifiedSettings, + // m_modifiedSettings is not changed! + pGroup->modifiedSettings = std::move(m_modifiedSettings); // set up group - if (GetFlowType(type) == Block) { + if (GetFlowType(type) == Block) { pGroup->flowType = FlowType::Block; - } else { + } else { pGroup->flowType = FlowType::Flow; - } + } pGroup->indent = GetIndent(); - m_groups.push_back(std::move(pGroup)); + m_groups.push_back(std::move(pGroup)); } void EmitterState::EndedGroup(GroupType::value type) { if (m_groups.empty()) { - if (type == GroupType::Seq) { + if (type == GroupType::Seq) { return SetError(ErrorMsg::UNEXPECTED_END_SEQ); - } else { + } else { return SetError(ErrorMsg::UNEXPECTED_END_MAP); - } + } } // get rid of the current group { - std::unique_ptr<Group> pFinishedGroup = std::move(m_groups.back()); - m_groups.pop_back(); - if (pFinishedGroup->type != type) { + std::unique_ptr<Group> pFinishedGroup = std::move(m_groups.back()); + m_groups.pop_back(); + if (pFinishedGroup->type != type) { return SetError(ErrorMsg::UNMATCHED_GROUP_TAG); - } + } } // reset old settings - std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent); + std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent); assert(m_curIndent >= lastIndent); m_curIndent -= lastIndent; @@ -179,39 +179,39 @@ void EmitterState::EndedGroup(GroupType::value type) { } EmitterNodeType::value EmitterState::CurGroupNodeType() const { - if (m_groups.empty()) { + if (m_groups.empty()) { return EmitterNodeType::NoType; - } + } - return m_groups.back()->NodeType(); + return m_groups.back()->NodeType(); } GroupType::value EmitterState::CurGroupType() const { - return m_groups.empty() ? GroupType::NoType : m_groups.back()->type; + return m_groups.empty() ? GroupType::NoType : m_groups.back()->type; } FlowType::value EmitterState::CurGroupFlowType() const { - return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType; + return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType; } -std::size_t EmitterState::CurGroupIndent() const { - return m_groups.empty() ? 0 : m_groups.back()->indent; +std::size_t EmitterState::CurGroupIndent() const { + return m_groups.empty() ? 0 : m_groups.back()->indent; } std::size_t EmitterState::CurGroupChildCount() const { - return m_groups.empty() ? m_docCount : m_groups.back()->childCount; + return m_groups.empty() ? m_docCount : m_groups.back()->childCount; } bool EmitterState::CurGroupLongKey() const { - return m_groups.empty() ? false : m_groups.back()->longKey; + return m_groups.empty() ? false : m_groups.back()->longKey; } -std::size_t EmitterState::LastIndent() const { - if (m_groups.size() <= 1) { +std::size_t EmitterState::LastIndent() const { + if (m_groups.size() <= 1) { return 0; - } + } - return m_curIndent - m_groups[m_groups.size() - 2]->indent; + return m_curIndent - m_groups[m_groups.size() - 2]->indent; } void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); } @@ -348,16 +348,16 @@ bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) { } } -bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) { - if (value > std::numeric_limits<float>::digits10 + 1) +bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) { + if (value > std::numeric_limits<float>::digits10 + 1) return false; _Set(m_floatPrecision, value, scope); return true; } -bool EmitterState::SetDoublePrecision(std::size_t value, - FmtScope::value scope) { - if (value > std::numeric_limits<double>::digits10 + 1) +bool EmitterState::SetDoublePrecision(std::size_t value, + FmtScope::value scope) { + if (value > std::numeric_limits<double>::digits10 + 1) return false; _Set(m_doublePrecision, value, scope); return true; diff --git a/contrib/libs/yaml-cpp/src/emitterstate.h b/contrib/libs/yaml-cpp/src/emitterstate.h index 0937f000d9..a6f4ba7b8e 100644 --- a/contrib/libs/yaml-cpp/src/emitterstate.h +++ b/contrib/libs/yaml-cpp/src/emitterstate.h @@ -10,12 +10,12 @@ #include "setting.h" #include "yaml-cpp/emitterdef.h" #include "yaml-cpp/emittermanip.h" - + #include <cassert> -#include <memory> +#include <memory> #include <stack> #include <stdexcept> -#include <vector> +#include <vector> namespace YAML { struct FmtScope { @@ -58,12 +58,12 @@ class EmitterState { GroupType::value CurGroupType() const; FlowType::value CurGroupFlowType() const; - std::size_t CurGroupIndent() const; + std::size_t CurGroupIndent() const; std::size_t CurGroupChildCount() const; bool CurGroupLongKey() const; - std::size_t LastIndent() const; - std::size_t CurIndent() const { return m_curIndent; } + std::size_t LastIndent() const; + std::size_t CurIndent() const { return m_curIndent; } bool HasAnchor() const { return m_hasAnchor; } bool HasTag() const { return m_hasTag; } bool HasBegunNode() const { @@ -95,12 +95,12 @@ class EmitterState { EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); } bool SetIndent(std::size_t value, FmtScope::value scope); - std::size_t GetIndent() const { return m_indent.get(); } + std::size_t GetIndent() const { return m_indent.get(); } bool SetPreCommentIndent(std::size_t value, FmtScope::value scope); - std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); } + std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); } bool SetPostCommentIndent(std::size_t value, FmtScope::value scope); - std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); } + std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); } bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value, FmtScope::value scope); @@ -109,9 +109,9 @@ class EmitterState { bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope); EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); } - bool SetFloatPrecision(std::size_t value, FmtScope::value scope); + bool SetFloatPrecision(std::size_t value, FmtScope::value scope); std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); } - bool SetDoublePrecision(std::size_t value, FmtScope::value scope); + bool SetDoublePrecision(std::size_t value, FmtScope::value scope); std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); } private: @@ -137,8 +137,8 @@ class EmitterState { Setting<EMITTER_MANIP> m_seqFmt; Setting<EMITTER_MANIP> m_mapFmt; Setting<EMITTER_MANIP> m_mapKeyFmt; - Setting<std::size_t> m_floatPrecision; - Setting<std::size_t> m_doublePrecision; + Setting<std::size_t> m_floatPrecision; + Setting<std::size_t> m_doublePrecision; SettingChanges m_modifiedSettings; SettingChanges m_globalModifiedSettings; @@ -149,7 +149,7 @@ class EmitterState { GroupType::value type; FlowType::value flowType; - std::size_t indent; + std::size_t indent; std::size_t childCount; bool longKey; @@ -174,7 +174,7 @@ class EmitterState { } }; - std::vector<std::unique_ptr<Group>> m_groups; + std::vector<std::unique_ptr<Group>> m_groups; std::size_t m_curIndent; bool m_hasAnchor; bool m_hasTag; diff --git a/contrib/libs/yaml-cpp/src/emitterutils.cpp b/contrib/libs/yaml-cpp/src/emitterutils.cpp index 147738ad8a..cbb68e50fc 100644 --- a/contrib/libs/yaml-cpp/src/emitterutils.cpp +++ b/contrib/libs/yaml-cpp/src/emitterutils.cpp @@ -9,7 +9,7 @@ #include "stringsource.h" #include "yaml-cpp/binary.h" // IWYU pragma: keep #include "yaml-cpp/ostream_wrapper.h" -#include "yaml-cpp/null.h" +#include "yaml-cpp/null.h" namespace YAML { namespace Utils { @@ -154,7 +154,7 @@ void WriteCodePoint(ostream_wrapper& out, int codePoint) { bool IsValidPlainScalar(const std::string& str, FlowType::value flowType, bool allowOnlyAscii) { // check against null - if (IsNullString(str)) { + if (IsNullString(str)) { return false; } @@ -354,7 +354,7 @@ bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str, } bool WriteLiteralString(ostream_wrapper& out, const std::string& str, - std::size_t indent) { + std::size_t indent) { out << "|\n"; out << IndentTo(indent); int codePoint; @@ -380,8 +380,8 @@ bool WriteChar(ostream_wrapper& out, char ch) { out << "\"\\n\""; } else if (ch == '\b') { out << "\"\\b\""; - } else if (ch == '\\') { - out << "\"\\\\\""; + } else if (ch == '\\') { + out << "\"\\\\\""; } else if ((0x20 <= ch && ch <= 0x7e) || ch == ' ') { out << "\"" << ch << "\""; } else { @@ -393,7 +393,7 @@ bool WriteChar(ostream_wrapper& out, char ch) { } bool WriteComment(ostream_wrapper& out, const std::string& str, - std::size_t postCommentIndent) { + std::size_t postCommentIndent) { const std::size_t curIndent = out.col(); out << "#" << Indentation(postCommentIndent); out.set_comment(); diff --git a/contrib/libs/yaml-cpp/src/emitterutils.h b/contrib/libs/yaml-cpp/src/emitterutils.h index 6cc7319147..04777e9299 100644 --- a/contrib/libs/yaml-cpp/src/emitterutils.h +++ b/contrib/libs/yaml-cpp/src/emitterutils.h @@ -34,10 +34,10 @@ bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str); bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str, bool escapeNonAscii); bool WriteLiteralString(ostream_wrapper& out, const std::string& str, - std::size_t indent); + std::size_t indent); bool WriteChar(ostream_wrapper& out, char ch); bool WriteComment(ostream_wrapper& out, const std::string& str, - std::size_t postCommentIndent); + std::size_t postCommentIndent); bool WriteAlias(ostream_wrapper& out, const std::string& str); bool WriteAnchor(ostream_wrapper& out, const std::string& str); bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim); diff --git a/contrib/libs/yaml-cpp/src/exceptions.cpp b/contrib/libs/yaml-cpp/src/exceptions.cpp index 9b6d8912c1..50387db489 100644 --- a/contrib/libs/yaml-cpp/src/exceptions.cpp +++ b/contrib/libs/yaml-cpp/src/exceptions.cpp @@ -1,31 +1,31 @@ -#include "yaml-cpp/exceptions.h" - -// This is here for compatibility with older versions of Visual Studio -// which don't support noexcept -#ifdef _MSC_VER - #define YAML_CPP_NOEXCEPT _NOEXCEPT -#else - #define YAML_CPP_NOEXCEPT noexcept -#endif - -namespace YAML { - -// These destructors are defined out-of-line so the vtable is only emitted once. -Exception::~Exception() YAML_CPP_NOEXCEPT {} -ParserException::~ParserException() YAML_CPP_NOEXCEPT {} -RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {} -InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {} -KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {} -InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {} -BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {} -BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {} -BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {} -BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {} -BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {} -EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {} -BadFile::~BadFile() YAML_CPP_NOEXCEPT {} -} - -#undef YAML_CPP_NOEXCEPT - - +#include "yaml-cpp/exceptions.h" + +// This is here for compatibility with older versions of Visual Studio +// which don't support noexcept +#ifdef _MSC_VER + #define YAML_CPP_NOEXCEPT _NOEXCEPT +#else + #define YAML_CPP_NOEXCEPT noexcept +#endif + +namespace YAML { + +// These destructors are defined out-of-line so the vtable is only emitted once. +Exception::~Exception() YAML_CPP_NOEXCEPT {} +ParserException::~ParserException() YAML_CPP_NOEXCEPT {} +RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {} +InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {} +KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {} +InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {} +BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {} +BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {} +BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {} +BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {} +BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {} +EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {} +BadFile::~BadFile() YAML_CPP_NOEXCEPT {} +} + +#undef YAML_CPP_NOEXCEPT + + diff --git a/contrib/libs/yaml-cpp/src/exp.h b/contrib/libs/yaml-cpp/src/exp.h index 50b0220b81..a17a21750a 100644 --- a/contrib/libs/yaml-cpp/src/exp.h +++ b/contrib/libs/yaml-cpp/src/exp.h @@ -20,10 +20,10 @@ namespace YAML { namespace Exp { // misc -inline const RegEx& Empty() { - static const RegEx e; - return e; -} +inline const RegEx& Empty() { + static const RegEx e; + return e; +} inline const RegEx& Space() { static const RegEx e = RegEx(' '); return e; @@ -169,15 +169,15 @@ inline const RegEx& EndScalarInFlow() { return e; } -inline const RegEx& ScanScalarEndInFlow() { - static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment())); - return e; -} - -inline const RegEx& ScanScalarEnd() { - static const RegEx e = EndScalar() || (BlankOrBreak() + Comment()); - return e; -} +inline const RegEx& ScanScalarEndInFlow() { + static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment())); + return e; +} + +inline const RegEx& ScanScalarEnd() { + static const RegEx e = EndScalar() || (BlankOrBreak() + Comment()); + return e; +} inline const RegEx& EscSingleQuote() { static const RegEx e = RegEx("\'\'"); return e; diff --git a/contrib/libs/yaml-cpp/src/node_data.cpp b/contrib/libs/yaml-cpp/src/node_data.cpp index 77cd465780..0e613a4113 100644 --- a/contrib/libs/yaml-cpp/src/node_data.cpp +++ b/contrib/libs/yaml-cpp/src/node_data.cpp @@ -1,5 +1,5 @@ #include <assert.h> -#include <iterator> +#include <iterator> #include <sstream> #include "yaml-cpp/exceptions.h" @@ -28,7 +28,7 @@ void node_data::mark_defined() { m_isDefined = true; } -void node_data::set_mark(const Mark& mark) { m_mark = mark; } +void node_data::set_mark(const Mark& mark) { m_mark = mark; } void node_data::set_type(NodeType::value type) { if (type == NodeType::Undefined) { @@ -102,7 +102,7 @@ void node_data::compute_seq_size() const { void node_data::compute_map_size() const { kv_pairs::iterator it = m_undefinedPairs.begin(); while (it != m_undefinedPairs.end()) { - kv_pairs::iterator jt = std::next(it); + kv_pairs::iterator jt = std::next(it); if (it->first->is_defined() && it->second->is_defined()) m_undefinedPairs.erase(it); it = jt; @@ -256,10 +256,10 @@ void node_data::reset_map() { } void node_data::insert_map_pair(node& key, node& value) { - m_map.emplace_back(&key, &value); - + m_map.emplace_back(&key, &value); + if (!key.is_defined() || !value.is_defined()) - m_undefinedPairs.emplace_back(&key, &value); + m_undefinedPairs.emplace_back(&key, &value); } void node_data::convert_to_map(shared_memory_holder pMemory) { diff --git a/contrib/libs/yaml-cpp/src/nodebuilder.cpp b/contrib/libs/yaml-cpp/src/nodebuilder.cpp index 093d2efeb7..3b9417ea7f 100644 --- a/contrib/libs/yaml-cpp/src/nodebuilder.cpp +++ b/contrib/libs/yaml-cpp/src/nodebuilder.cpp @@ -48,8 +48,8 @@ void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag, Pop(); } -void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag, - anchor_t anchor, EmitterStyle::value style) { +void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) { detail::node& node = Push(mark, anchor); node.set_tag(tag); node.set_type(NodeType::Sequence); diff --git a/contrib/libs/yaml-cpp/src/null.cpp b/contrib/libs/yaml-cpp/src/null.cpp index d12dd08ce4..443e4f98da 100644 --- a/contrib/libs/yaml-cpp/src/null.cpp +++ b/contrib/libs/yaml-cpp/src/null.cpp @@ -2,9 +2,9 @@ namespace YAML { _Null Null; - -bool IsNullString(const std::string& str) { - return str.empty() || str == "~" || str == "null" || str == "Null" || - str == "NULL"; -} + +bool IsNullString(const std::string& str) { + return str.empty() || str == "~" || str == "null" || str == "Null" || + str == "NULL"; } +} diff --git a/contrib/libs/yaml-cpp/src/parse.cpp b/contrib/libs/yaml-cpp/src/parse.cpp index 0b2ae4a4f6..9e0efdc8c2 100644 --- a/contrib/libs/yaml-cpp/src/parse.cpp +++ b/contrib/libs/yaml-cpp/src/parse.cpp @@ -22,18 +22,18 @@ Node Load(const char* input) { Node Load(std::istream& input) { Parser parser(input); NodeBuilder builder; - if (!parser.HandleNextDocument(builder)) { + if (!parser.HandleNextDocument(builder)) { return Node(); - } + } return builder.Root(); } Node LoadFile(const std::string& filename) { std::ifstream fin(filename.c_str()); - if (!fin) { + if (!fin) { throw BadFile(); - } + } return Load(fin); } @@ -53,9 +53,9 @@ std::vector<Node> LoadAll(std::istream& input) { Parser parser(input); while (1) { NodeBuilder builder; - if (!parser.HandleNextDocument(builder)) { + if (!parser.HandleNextDocument(builder)) { break; - } + } docs.push_back(builder.Root()); } @@ -64,9 +64,9 @@ std::vector<Node> LoadAll(std::istream& input) { std::vector<Node> LoadAllFromFile(const std::string& filename) { std::ifstream fin(filename.c_str()); - if (!fin) { + if (!fin) { throw BadFile(); - } + } return LoadAll(fin); } -} // namespace YAML +} // namespace YAML diff --git a/contrib/libs/yaml-cpp/src/parser.cpp b/contrib/libs/yaml-cpp/src/parser.cpp index cd69f39fce..d5d9e20a4e 100644 --- a/contrib/libs/yaml-cpp/src/parser.cpp +++ b/contrib/libs/yaml-cpp/src/parser.cpp @@ -31,9 +31,9 @@ bool Parser::HandleNextDocument(EventHandler& eventHandler) { return false; ParseDirectives(); - if (m_pScanner->empty()) { + if (m_pScanner->empty()) { return false; - } + } SingleDocParser sdp(*m_pScanner, *m_pDirectives); sdp.HandleDocument(eventHandler); @@ -44,20 +44,20 @@ void Parser::ParseDirectives() { bool readDirective = false; while (1) { - if (m_pScanner->empty()) { + if (m_pScanner->empty()) { break; - } + } Token& token = m_pScanner->peek(); - if (token.type != Token::DIRECTIVE) { + if (token.type != Token::DIRECTIVE) { break; - } + } // we keep the directives from the last document if none are specified; // but if any directives are specific, then we reset them - if (!readDirective) { + if (!readDirective) { m_pDirectives.reset(new Directives); - } + } readDirective = true; HandleDirective(token); @@ -66,34 +66,34 @@ void Parser::ParseDirectives() { } void Parser::HandleDirective(const Token& token) { - if (token.value == "YAML") { + if (token.value == "YAML") { HandleYamlDirective(token); - } else if (token.value == "TAG") { + } else if (token.value == "TAG") { HandleTagDirective(token); - } + } } void Parser::HandleYamlDirective(const Token& token) { - if (token.params.size() != 1) { + if (token.params.size() != 1) { throw ParserException(token.mark, ErrorMsg::YAML_DIRECTIVE_ARGS); - } + } - if (!m_pDirectives->version.isDefault) { + if (!m_pDirectives->version.isDefault) { throw ParserException(token.mark, ErrorMsg::REPEATED_YAML_DIRECTIVE); - } + } std::stringstream str(token.params[0]); str >> m_pDirectives->version.major; str.get(); str >> m_pDirectives->version.minor; - if (!str || str.peek() != EOF) { + if (!str || str.peek() != EOF) { throw ParserException( token.mark, std::string(ErrorMsg::YAML_VERSION) + token.params[0]); - } + } - if (m_pDirectives->version.major > 1) { + if (m_pDirectives->version.major > 1) { throw ParserException(token.mark, ErrorMsg::YAML_MAJOR_VERSION); - } + } m_pDirectives->version.isDefault = false; // TODO: warning on major == 1, minor > 2? @@ -105,22 +105,22 @@ void Parser::HandleTagDirective(const Token& token) { const std::string& handle = token.params[0]; const std::string& prefix = token.params[1]; - if (m_pDirectives->tags.find(handle) != m_pDirectives->tags.end()) { + if (m_pDirectives->tags.find(handle) != m_pDirectives->tags.end()) { throw ParserException(token.mark, ErrorMsg::REPEATED_TAG_DIRECTIVE); - } + } m_pDirectives->tags[handle] = prefix; } void Parser::PrintTokens(std::ostream& out) { - if (!m_pScanner.get()) { + if (!m_pScanner.get()) { return; - } + } while (1) { - if (m_pScanner->empty()) { + if (m_pScanner->empty()) { break; - } + } out << m_pScanner->peek() << "\n"; m_pScanner->pop(); diff --git a/contrib/libs/yaml-cpp/src/ptr_vector.h b/contrib/libs/yaml-cpp/src/ptr_vector.h index 955aebd8d5..b4f899035b 100644 --- a/contrib/libs/yaml-cpp/src/ptr_vector.h +++ b/contrib/libs/yaml-cpp/src/ptr_vector.h @@ -16,27 +16,27 @@ namespace YAML { -// TODO: This class is no longer needed +// TODO: This class is no longer needed template <typename T> class ptr_vector : private YAML::noncopyable { public: ptr_vector() {} - void clear() { m_data.clear(); } + void clear() { m_data.clear(); } std::size_t size() const { return m_data.size(); } bool empty() const { return m_data.empty(); } - void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); } + void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); } T& operator[](std::size_t i) { return *m_data[i]; } const T& operator[](std::size_t i) const { return *m_data[i]; } - T& back() { return *(m_data.back().get()); } - - const T& back() const { return *(m_data.back().get()); } + T& back() { return *(m_data.back().get()); } + const T& back() const { return *(m_data.back().get()); } + private: - std::vector<std::unique_ptr<T>> m_data; + std::vector<std::unique_ptr<T>> m_data; }; } diff --git a/contrib/libs/yaml-cpp/src/regex_yaml.h b/contrib/libs/yaml-cpp/src/regex_yaml.h index 8f28b852a2..3e7c5042b1 100644 --- a/contrib/libs/yaml-cpp/src/regex_yaml.h +++ b/contrib/libs/yaml-cpp/src/regex_yaml.h @@ -10,8 +10,8 @@ #include <string> #include <vector> -#include "yaml-cpp/dll.h" - +#include "yaml-cpp/dll.h" + namespace YAML { class Stream; @@ -28,7 +28,7 @@ enum REGEX_OP { // simplified regular expressions // . Only straightforward matches (no repeated characters) // . Only matches from start of string -class YAML_CPP_API RegEx { +class YAML_CPP_API RegEx { public: RegEx(); RegEx(char ch); @@ -36,10 +36,10 @@ class YAML_CPP_API RegEx { RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ); ~RegEx() {} - friend YAML_CPP_API RegEx operator!(const RegEx& ex); - friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2); - friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2); - friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2); + friend YAML_CPP_API RegEx operator!(const RegEx& ex); + friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2); + friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2); + friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2); bool Matches(char ch) const; bool Matches(const std::string& str) const; diff --git a/contrib/libs/yaml-cpp/src/scanner.cpp b/contrib/libs/yaml-cpp/src/scanner.cpp index b5cfcc12b2..7176d6d6d0 100644 --- a/contrib/libs/yaml-cpp/src/scanner.cpp +++ b/contrib/libs/yaml-cpp/src/scanner.cpp @@ -51,9 +51,9 @@ void Scanner::EnsureTokensInQueue() { Token& token = m_tokens.front(); // if this guy's valid, then we're done - if (token.status == Token::VALID) { + if (token.status == Token::VALID) { return; - } + } // here's where we clean up the impossible tokens if (token.status == Token::INVALID) { @@ -65,9 +65,9 @@ void Scanner::EnsureTokensInQueue() { } // no token? maybe we've actually finished - if (m_endedStream) { + if (m_endedStream) { return; - } + } // no? then scan... ScanNextToken(); @@ -75,13 +75,13 @@ void Scanner::EnsureTokensInQueue() { } void Scanner::ScanNextToken() { - if (m_endedStream) { + if (m_endedStream) { return; - } + } - if (!m_startedStream) { + if (!m_startedStream) { return StartStream(); - } + } // get rid of whitespace, etc. (in between tokens it should be irrelevent) ScanToNextToken(); @@ -94,75 +94,75 @@ void Scanner::ScanNextToken() { // ***** // end of stream - if (!INPUT) { + if (!INPUT) { return EndStream(); - } + } - if (INPUT.column() == 0 && INPUT.peek() == Keys::Directive) { + if (INPUT.column() == 0 && INPUT.peek() == Keys::Directive) { return ScanDirective(); - } + } // document token - if (INPUT.column() == 0 && Exp::DocStart().Matches(INPUT)) { + if (INPUT.column() == 0 && Exp::DocStart().Matches(INPUT)) { return ScanDocStart(); - } + } - if (INPUT.column() == 0 && Exp::DocEnd().Matches(INPUT)) { + if (INPUT.column() == 0 && Exp::DocEnd().Matches(INPUT)) { return ScanDocEnd(); - } + } // flow start/end/entry - if (INPUT.peek() == Keys::FlowSeqStart || - INPUT.peek() == Keys::FlowMapStart) { + if (INPUT.peek() == Keys::FlowSeqStart || + INPUT.peek() == Keys::FlowMapStart) { return ScanFlowStart(); - } + } - if (INPUT.peek() == Keys::FlowSeqEnd || INPUT.peek() == Keys::FlowMapEnd) { + if (INPUT.peek() == Keys::FlowSeqEnd || INPUT.peek() == Keys::FlowMapEnd) { return ScanFlowEnd(); - } + } - if (INPUT.peek() == Keys::FlowEntry) { + if (INPUT.peek() == Keys::FlowEntry) { return ScanFlowEntry(); - } + } // block/map stuff - if (Exp::BlockEntry().Matches(INPUT)) { + if (Exp::BlockEntry().Matches(INPUT)) { return ScanBlockEntry(); - } + } - if ((InBlockContext() ? Exp::Key() : Exp::KeyInFlow()).Matches(INPUT)) { + if ((InBlockContext() ? Exp::Key() : Exp::KeyInFlow()).Matches(INPUT)) { return ScanKey(); - } + } - if (GetValueRegex().Matches(INPUT)) { + if (GetValueRegex().Matches(INPUT)) { return ScanValue(); - } + } // alias/anchor - if (INPUT.peek() == Keys::Alias || INPUT.peek() == Keys::Anchor) { + if (INPUT.peek() == Keys::Alias || INPUT.peek() == Keys::Anchor) { return ScanAnchorOrAlias(); - } + } // tag - if (INPUT.peek() == Keys::Tag) { + if (INPUT.peek() == Keys::Tag) { return ScanTag(); - } + } // special scalars if (InBlockContext() && (INPUT.peek() == Keys::LiteralScalar || - INPUT.peek() == Keys::FoldedScalar)) { + INPUT.peek() == Keys::FoldedScalar)) { return ScanBlockScalar(); - } + } - if (INPUT.peek() == '\'' || INPUT.peek() == '\"') { + if (INPUT.peek() == '\'' || INPUT.peek() == '\"') { return ScanQuotedScalar(); - } + } // plain scalars if ((InBlockContext() ? Exp::PlainScalar() : Exp::PlainScalarInFlow()) - .Matches(INPUT)) { + .Matches(INPUT)) { return ScanPlainScalar(); - } + } // don't know what it is! throw ParserException(INPUT.mark(), ErrorMsg::UNKNOWN_TOKEN); @@ -172,24 +172,24 @@ void Scanner::ScanToNextToken() { while (1) { // first eat whitespace while (INPUT && IsWhitespaceToBeEaten(INPUT.peek())) { - if (InBlockContext() && Exp::Tab().Matches(INPUT)) { + if (InBlockContext() && Exp::Tab().Matches(INPUT)) { m_simpleKeyAllowed = false; - } + } INPUT.eat(1); } // then eat a comment if (Exp::Comment().Matches(INPUT)) { // eat until line break - while (INPUT && !Exp::Break().Matches(INPUT)) { + while (INPUT && !Exp::Break().Matches(INPUT)) { INPUT.eat(1); - } + } } // if it's NOT a line break, then we're done! - if (!Exp::Break().Matches(INPUT)) { + if (!Exp::Break().Matches(INPUT)) { break; - } + } // otherwise, let's eat the line break and keep going int n = Exp::Break().Match(INPUT); @@ -199,9 +199,9 @@ void Scanner::ScanToNextToken() { InvalidateSimpleKey(); // new line - we may be able to accept a simple key now - if (InBlockContext()) { + if (InBlockContext()) { m_simpleKeyAllowed = true; - } + } } } @@ -218,21 +218,21 @@ void Scanner::ScanToNextToken() { // that they can't contribute to indentation, so once you've seen a tab in a // line, you can't start a simple key bool Scanner::IsWhitespaceToBeEaten(char ch) { - if (ch == ' ') { + if (ch == ' ') { return true; - } + } - if (ch == '\t') { + if (ch == '\t') { return true; - } + } return false; } const RegEx& Scanner::GetValueRegex() const { - if (InBlockContext()) { + if (InBlockContext()) { return Exp::Value(); - } + } return m_canBeJSONFlow ? Exp::ValueInJSONFlow() : Exp::ValueInFlow(); } @@ -240,17 +240,17 @@ const RegEx& Scanner::GetValueRegex() const { void Scanner::StartStream() { m_startedStream = true; m_simpleKeyAllowed = true; - std::unique_ptr<IndentMarker> pIndent( - new IndentMarker(-1, IndentMarker::NONE)); - m_indentRefs.push_back(std::move(pIndent)); + std::unique_ptr<IndentMarker> pIndent( + new IndentMarker(-1, IndentMarker::NONE)); + m_indentRefs.push_back(std::move(pIndent)); m_indents.push(&m_indentRefs.back()); } void Scanner::EndStream() { // force newline - if (INPUT.column() > 0) { + if (INPUT.column() > 0) { INPUT.ResetColumn(); - } + } PopAllIndents(); PopAllSimpleKeys(); @@ -281,72 +281,72 @@ Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) const { Scanner::IndentMarker* Scanner::PushIndentTo(int column, IndentMarker::INDENT_TYPE type) { // are we in flow? - if (InFlowContext()) { + if (InFlowContext()) { return 0; - } + } - std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type)); + std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type)); IndentMarker& indent = *pIndent; const IndentMarker& lastIndent = *m_indents.top(); // is this actually an indentation? - if (indent.column < lastIndent.column) { + if (indent.column < lastIndent.column) { return 0; - } + } if (indent.column == lastIndent.column && !(indent.type == IndentMarker::SEQ && - lastIndent.type == IndentMarker::MAP)) { + lastIndent.type == IndentMarker::MAP)) { return 0; - } + } // push a start token indent.pStartToken = PushToken(GetStartTokenFor(type)); // and then the indent m_indents.push(&indent); - m_indentRefs.push_back(std::move(pIndent)); + m_indentRefs.push_back(std::move(pIndent)); return &m_indentRefs.back(); } void Scanner::PopIndentToHere() { // are we in flow? - if (InFlowContext()) { + if (InFlowContext()) { return; - } + } // now pop away while (!m_indents.empty()) { const IndentMarker& indent = *m_indents.top(); - if (indent.column < INPUT.column()) { + if (indent.column < INPUT.column()) { break; - } + } if (indent.column == INPUT.column() && !(indent.type == IndentMarker::SEQ && - !Exp::BlockEntry().Matches(INPUT))) { + !Exp::BlockEntry().Matches(INPUT))) { break; - } + } PopIndent(); } - while (!m_indents.empty() && - m_indents.top()->status == IndentMarker::INVALID) { + while (!m_indents.empty() && + m_indents.top()->status == IndentMarker::INVALID) { PopIndent(); - } + } } void Scanner::PopAllIndents() { // are we in flow? - if (InFlowContext()) { + if (InFlowContext()) { return; - } + } // now pop away while (!m_indents.empty()) { const IndentMarker& indent = *m_indents.top(); - if (indent.type == IndentMarker::NONE) { + if (indent.type == IndentMarker::NONE) { break; - } + } PopIndent(); } @@ -361,17 +361,17 @@ void Scanner::PopIndent() { return; } - if (indent.type == IndentMarker::SEQ) { + if (indent.type == IndentMarker::SEQ) { m_tokens.push(Token(Token::BLOCK_SEQ_END, INPUT.mark())); - } else if (indent.type == IndentMarker::MAP) { + } else if (indent.type == IndentMarker::MAP) { m_tokens.push(Token(Token::BLOCK_MAP_END, INPUT.mark())); - } + } } int Scanner::GetTopIndent() const { - if (m_indents.empty()) { + if (m_indents.empty()) { return 0; - } + } return m_indents.top()->column; } @@ -383,4 +383,4 @@ void Scanner::ThrowParserException(const std::string& msg) const { } throw ParserException(mark, msg); } -} // namespace YAML +} // namespace YAML diff --git a/contrib/libs/yaml-cpp/src/scanner.h b/contrib/libs/yaml-cpp/src/scanner.h index 7bb2ccc71a..6c1ebcecfe 100644 --- a/contrib/libs/yaml-cpp/src/scanner.h +++ b/contrib/libs/yaml-cpp/src/scanner.h @@ -24,24 +24,24 @@ namespace YAML { class Node; class RegEx; -/** - * A scanner transforms a stream of characters into a stream of tokens. - */ +/** + * A scanner transforms a stream of characters into a stream of tokens. + */ class Scanner { public: - explicit Scanner(std::istream &in); + explicit Scanner(std::istream &in); ~Scanner(); - /** Returns true if there are no more tokens to be read. */ + /** Returns true if there are no more tokens to be read. */ bool empty(); - - /** Removes the next token in the queue. */ + + /** Removes the next token in the queue. */ void pop(); - - /** Returns, but does not remove, the next token in the queue. */ + + /** Returns, but does not remove, the next token in the queue. */ Token &peek(); - - /** Returns the current mark in the input stream. */ + + /** Returns the current mark in the input stream. */ Mark mark() const; private: @@ -61,29 +61,29 @@ class Scanner { private: // scanning - - /** - * Scans until there's a valid token at the front of the queue, or the queue - * is empty. The state can be checked by {@link #empty}, and the next token - * retrieved by {@link #peek}. - */ + + /** + * Scans until there's a valid token at the front of the queue, or the queue + * is empty. The state can be checked by {@link #empty}, and the next token + * retrieved by {@link #peek}. + */ void EnsureTokensInQueue(); - - /** - * The main scanning function; this method branches out to scan whatever the - * next token should be. - */ + + /** + * The main scanning function; this method branches out to scan whatever the + * next token should be. + */ void ScanNextToken(); - - /** Eats the input stream until it reaches the next token-like thing. */ + + /** Eats the input stream until it reaches the next token-like thing. */ void ScanToNextToken(); - - /** Sets the initial conditions for starting a stream. */ + + /** Sets the initial conditions for starting a stream. */ void StartStream(); - - /** Closes out the stream, finish up, etc. */ + + /** Closes out the stream, finish up, etc. */ void EndStream(); - + Token *PushToken(Token::TYPE type); bool InFlowContext() const { return !m_flows.empty(); } @@ -91,29 +91,29 @@ class Scanner { std::size_t GetFlowLevel() const { return m_flows.size(); } Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const; - - /** - * Pushes an indentation onto the stack, and enqueues the proper token - * (sequence start or mapping start). - * - * @return the indent marker it generates (if any). - */ + + /** + * Pushes an indentation onto the stack, and enqueues the proper token + * (sequence start or mapping start). + * + * @return the indent marker it generates (if any). + */ IndentMarker *PushIndentTo(int column, IndentMarker::INDENT_TYPE type); - - /** - * Pops indentations off the stack until it reaches the current indentation - * level, and enqueues the proper token each time. Then pops all invalid - * indentations off. - */ + + /** + * Pops indentations off the stack until it reaches the current indentation + * level, and enqueues the proper token each time. Then pops all invalid + * indentations off. + */ void PopIndentToHere(); - - /** - * Pops all indentations (except for the base empty one) off the stack, and - * enqueues the proper token each time. - */ + + /** + * Pops all indentations (except for the base empty one) off the stack, and + * enqueues the proper token each time. + */ void PopAllIndents(); - - /** Pops a single indent, pushing the proper token. */ + + /** Pops a single indent, pushing the proper token. */ void PopIndent(); int GetTopIndent() const; @@ -125,17 +125,17 @@ class Scanner { bool VerifySimpleKey(); void PopAllSimpleKeys(); - /** - * Throws a ParserException with the current token location (if available), - * and does not parse any more tokens. - */ + /** + * Throws a ParserException with the current token location (if available), + * and does not parse any more tokens. + */ void ThrowParserException(const std::string &msg) const; bool IsWhitespaceToBeEaten(char ch); - - /** - * Returns the appropriate regex to check if the next token is a value token. - */ + + /** + * Returns the appropriate regex to check if the next token is a value token. + */ const RegEx &GetValueRegex() const; struct SimpleKey { diff --git a/contrib/libs/yaml-cpp/src/scanscalar.cpp b/contrib/libs/yaml-cpp/src/scanscalar.cpp index 10e359d446..28fcf10eed 100644 --- a/contrib/libs/yaml-cpp/src/scanscalar.cpp +++ b/contrib/libs/yaml-cpp/src/scanscalar.cpp @@ -28,28 +28,28 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) { std::string scalar; params.leadingSpaces = false; - if (!params.end) { - params.end = &Exp::Empty(); - } - + if (!params.end) { + params.end = &Exp::Empty(); + } + while (INPUT) { // ******************************** // Phase #1: scan until line ending std::size_t lastNonWhitespaceChar = scalar.size(); bool escapedNewline = false; - while (!params.end->Matches(INPUT) && !Exp::Break().Matches(INPUT)) { - if (!INPUT) { + while (!params.end->Matches(INPUT) && !Exp::Break().Matches(INPUT)) { + if (!INPUT) { break; - } + } // document indicator? if (INPUT.column() == 0 && Exp::DocIndicator().Matches(INPUT)) { - if (params.onDocIndicator == BREAK) { + if (params.onDocIndicator == BREAK) { break; - } else if (params.onDocIndicator == THROW) { + } else if (params.onDocIndicator == THROW) { throw ParserException(INPUT.mark(), ErrorMsg::DOC_IN_SCALAR); - } + } } foundNonEmptyLine = true; @@ -76,31 +76,31 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) { // otherwise, just add the damn character char ch = INPUT.get(); scalar += ch; - if (ch != ' ' && ch != '\t') { + if (ch != ' ' && ch != '\t') { lastNonWhitespaceChar = scalar.size(); - } + } } // eof? if we're looking to eat something, then we throw if (!INPUT) { - if (params.eatEnd) { + if (params.eatEnd) { throw ParserException(INPUT.mark(), ErrorMsg::EOF_IN_SCALAR); - } + } break; } // doc indicator? if (params.onDocIndicator == BREAK && INPUT.column() == 0 && - Exp::DocIndicator().Matches(INPUT)) { + Exp::DocIndicator().Matches(INPUT)) { break; - } + } // are we done via character match? - int n = params.end->Match(INPUT); + int n = params.end->Match(INPUT); if (n >= 0) { - if (params.eatEnd) { + if (params.eatEnd) { INPUT.eat(n); - } + } break; } @@ -117,34 +117,34 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) { // Phase #3: scan initial spaces // first the required indentation - while (INPUT.peek() == ' ' && - (INPUT.column() < params.indent || - (params.detectIndent && !foundNonEmptyLine)) && - !params.end->Matches(INPUT)) { + while (INPUT.peek() == ' ' && + (INPUT.column() < params.indent || + (params.detectIndent && !foundNonEmptyLine)) && + !params.end->Matches(INPUT)) { INPUT.eat(1); - } + } // update indent if we're auto-detecting - if (params.detectIndent && !foundNonEmptyLine) { + if (params.detectIndent && !foundNonEmptyLine) { params.indent = std::max(params.indent, INPUT.column()); - } + } // and then the rest of the whitespace while (Exp::Blank().Matches(INPUT)) { // we check for tabs that masquerade as indentation if (INPUT.peek() == '\t' && INPUT.column() < params.indent && - params.onTabInIndentation == THROW) { + params.onTabInIndentation == THROW) { throw ParserException(INPUT.mark(), ErrorMsg::TAB_IN_INDENTATION); - } + } - if (!params.eatLeadingWhitespace) { + if (!params.eatLeadingWhitespace) { break; - } - - if (params.end->Matches(INPUT)) { - break; - } + } + if (params.end->Matches(INPUT)) { + break; + } + INPUT.eat(1); } @@ -163,29 +163,29 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) { break; case FOLD_BLOCK: if (!emptyLine && !nextEmptyLine && !moreIndented && - !nextMoreIndented && INPUT.column() >= params.indent) { + !nextMoreIndented && INPUT.column() >= params.indent) { scalar += " "; - } else if (nextEmptyLine) { + } else if (nextEmptyLine) { foldedNewlineCount++; - } else { + } else { scalar += "\n"; - } + } if (!nextEmptyLine && foldedNewlineCount > 0) { scalar += std::string(foldedNewlineCount - 1, '\n'); if (foldedNewlineStartedMoreIndented || - nextMoreIndented | !foundNonEmptyLine) { + nextMoreIndented | !foundNonEmptyLine) { scalar += "\n"; - } + } foldedNewlineCount = 0; } break; case FOLD_FLOW: - if (nextEmptyLine) { + if (nextEmptyLine) { scalar += "\n"; - } else if (!emptyLine && !nextEmptyLine && !escapedNewline) { + } else if (!emptyLine && !nextEmptyLine && !escapedNewline) { scalar += " "; - } + } break; } } @@ -205,41 +205,41 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) { if (params.trimTrailingSpaces) { std::size_t pos = scalar.find_last_not_of(' '); if (lastEscapedChar != std::string::npos) { - if (pos < lastEscapedChar || pos == std::string::npos) { + if (pos < lastEscapedChar || pos == std::string::npos) { pos = lastEscapedChar; - } + } } - if (pos < scalar.size()) { + if (pos < scalar.size()) { scalar.erase(pos + 1); - } + } } switch (params.chomp) { case CLIP: { std::size_t pos = scalar.find_last_not_of('\n'); if (lastEscapedChar != std::string::npos) { - if (pos < lastEscapedChar || pos == std::string::npos) { + if (pos < lastEscapedChar || pos == std::string::npos) { pos = lastEscapedChar; - } + } } - if (pos == std::string::npos) { + if (pos == std::string::npos) { scalar.erase(); - } else if (pos + 1 < scalar.size()) { + } else if (pos + 1 < scalar.size()) { scalar.erase(pos + 2); - } + } } break; case STRIP: { std::size_t pos = scalar.find_last_not_of('\n'); if (lastEscapedChar != std::string::npos) { - if (pos < lastEscapedChar || pos == std::string::npos) { + if (pos < lastEscapedChar || pos == std::string::npos) { pos = lastEscapedChar; - } + } } - if (pos == std::string::npos) { + if (pos == std::string::npos) { scalar.erase(); - } else if (pos < scalar.size()) { + } else if (pos < scalar.size()) { scalar.erase(pos + 1); - } + } } break; default: break; diff --git a/contrib/libs/yaml-cpp/src/scanscalar.h b/contrib/libs/yaml-cpp/src/scanscalar.h index c3a574ad9b..a8282f61f7 100644 --- a/contrib/libs/yaml-cpp/src/scanscalar.h +++ b/contrib/libs/yaml-cpp/src/scanscalar.h @@ -19,8 +19,8 @@ enum FOLD { DONT_FOLD, FOLD_BLOCK, FOLD_FLOW }; struct ScanScalarParams { ScanScalarParams() - : end(nullptr), - eatEnd(false), + : end(nullptr), + eatEnd(false), indent(0), detectIndent(false), eatLeadingWhitespace(0), @@ -33,8 +33,8 @@ struct ScanScalarParams { leadingSpaces(false) {} // input: - const RegEx* end; // what condition ends this scalar? - // unowned. + const RegEx* end; // what condition ends this scalar? + // unowned. bool eatEnd; // should we eat that condition when we see it? int indent; // what level of indentation should be eaten and ignored? bool detectIndent; // should we try to autodetect the indent? diff --git a/contrib/libs/yaml-cpp/src/scantoken.cpp b/contrib/libs/yaml-cpp/src/scantoken.cpp index fd8758d781..9a722b15b6 100644 --- a/contrib/libs/yaml-cpp/src/scantoken.cpp +++ b/contrib/libs/yaml-cpp/src/scantoken.cpp @@ -297,8 +297,8 @@ void Scanner::ScanPlainScalar() { // set up the scanning parameters ScanScalarParams params; - params.end = - (InFlowContext() ? &Exp::ScanScalarEndInFlow() : &Exp::ScanScalarEnd()); + params.end = + (InFlowContext() ? &Exp::ScanScalarEndInFlow() : &Exp::ScanScalarEnd()); params.eatEnd = false; params.indent = (InFlowContext() ? 0 : GetTopIndent() + 1); params.fold = FOLD_FLOW; @@ -338,8 +338,8 @@ void Scanner::ScanQuotedScalar() { // setup the scanning parameters ScanScalarParams params; - RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote)); - params.end = &end; + RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote)); + params.end = &end; params.eatEnd = true; params.escape = (single ? '\'' : '\\'); params.indent = 0; diff --git a/contrib/libs/yaml-cpp/src/setting.h b/contrib/libs/yaml-cpp/src/setting.h index b78d40e2e8..0f8e19fbc6 100644 --- a/contrib/libs/yaml-cpp/src/setting.h +++ b/contrib/libs/yaml-cpp/src/setting.h @@ -20,7 +20,7 @@ class Setting { Setting() : m_value() {} const T get() const { return m_value; } - std::unique_ptr<SettingChangeBase> set(const T& value); + std::unique_ptr<SettingChangeBase> set(const T& value); void restore(const Setting<T>& oldSetting) { m_value = oldSetting.get(); } private: @@ -49,8 +49,8 @@ class SettingChange : public SettingChangeBase { }; template <typename T> -inline std::unique_ptr<SettingChangeBase> Setting<T>::set(const T& value) { - std::unique_ptr<SettingChangeBase> pChange(new SettingChange<T>(this)); +inline std::unique_ptr<SettingChangeBase> Setting<T>::set(const T& value) { + std::unique_ptr<SettingChangeBase> pChange(new SettingChange<T>(this)); m_value = value; return pChange; } @@ -71,23 +71,23 @@ class SettingChanges : private noncopyable { (*it)->pop(); } - void push(std::unique_ptr<SettingChangeBase> pSettingChange) { - m_settingChanges.push_back(std::move(pSettingChange)); + void push(std::unique_ptr<SettingChangeBase> pSettingChange) { + m_settingChanges.push_back(std::move(pSettingChange)); } - // like std::unique_ptr - assignment is transfer of ownership - SettingChanges& operator=(SettingChanges&& rhs) { + // like std::unique_ptr - assignment is transfer of ownership + SettingChanges& operator=(SettingChanges&& rhs) { if (this == &rhs) return *this; clear(); - std::swap(m_settingChanges, rhs.m_settingChanges); - + std::swap(m_settingChanges, rhs.m_settingChanges); + return *this; } private: - typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes; + typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes; setting_changes m_settingChanges; }; } diff --git a/contrib/libs/yaml-cpp/src/singledocparser.cpp b/contrib/libs/yaml-cpp/src/singledocparser.cpp index a27c1c3b04..b2d9bbfad4 100644 --- a/contrib/libs/yaml-cpp/src/singledocparser.cpp +++ b/contrib/libs/yaml-cpp/src/singledocparser.cpp @@ -11,7 +11,7 @@ #include "yaml-cpp/eventhandler.h" #include "yaml-cpp/exceptions.h" // IWYU pragma: keep #include "yaml-cpp/mark.h" -#include "yaml-cpp/null.h" +#include "yaml-cpp/null.h" namespace YAML { SingleDocParser::SingleDocParser(Scanner& scanner, const Directives& directives) @@ -76,7 +76,7 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) { const Token& token = m_scanner.peek(); - if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) { + if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) { eventHandler.OnNull(mark, anchor); m_scanner.pop(); return; diff --git a/contrib/libs/yaml-cpp/src/singledocparser.h b/contrib/libs/yaml-cpp/src/singledocparser.h index 2b92067cdd..4c005b1ad0 100644 --- a/contrib/libs/yaml-cpp/src/singledocparser.h +++ b/contrib/libs/yaml-cpp/src/singledocparser.h @@ -53,7 +53,7 @@ class SingleDocParser : private noncopyable { private: Scanner& m_scanner; const Directives& m_directives; - std::unique_ptr<CollectionStack> m_pCollectionStack; + std::unique_ptr<CollectionStack> m_pCollectionStack; typedef std::map<std::string, anchor_t> Anchors; Anchors m_anchors; |