aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/yaml-cpp/src/parser.cpp
diff options
context:
space:
mode:
authorsobols <sobols@yandex-team.ru>2022-02-10 16:47:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:08 +0300
commit03335cb18337a0ef51966452a66a69b01abea218 (patch)
treeb83306b6e37edeea782e9eed673d89286c4fef35 /contrib/libs/yaml-cpp/src/parser.cpp
parent09961b69c61f471ddd594e0fd877df62a8021562 (diff)
downloadydb-03335cb18337a0ef51966452a66a69b01abea218.tar.gz
Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/yaml-cpp/src/parser.cpp')
-rw-r--r--contrib/libs/yaml-cpp/src/parser.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/contrib/libs/yaml-cpp/src/parser.cpp b/contrib/libs/yaml-cpp/src/parser.cpp
index d5d9e20a4e..cd69f39fce 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();