From 1110808a9d39d4b808aef724c861a2e1a38d2a69 Mon Sep 17 00:00:00 2001 From: Devtools Arcadia <arcadia-devtools@yandex-team.ru> Date: Mon, 7 Feb 2022 18:08:42 +0300 Subject: intermediate changes ref:cde9a383711a11544ce7e107a78147fb96cc4029 --- contrib/libs/yaml-cpp/src/regex_yaml.cpp | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 contrib/libs/yaml-cpp/src/regex_yaml.cpp (limited to 'contrib/libs/yaml-cpp/src/regex_yaml.cpp') diff --git a/contrib/libs/yaml-cpp/src/regex_yaml.cpp b/contrib/libs/yaml-cpp/src/regex_yaml.cpp new file mode 100644 index 0000000000..20b772051d --- /dev/null +++ b/contrib/libs/yaml-cpp/src/regex_yaml.cpp @@ -0,0 +1,45 @@ +#include "regex_yaml.h" + +namespace YAML { +// constructors +RegEx::RegEx() : m_op(REGEX_EMPTY) {} + +RegEx::RegEx(REGEX_OP op) : m_op(op) {} + +RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch) {} + +RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z) {} + +RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op) { + for (std::size_t i = 0; i < str.size(); i++) + m_params.push_back(RegEx(str[i])); +} + +// combination constructors +RegEx operator!(const RegEx& ex) { + RegEx ret(REGEX_NOT); + ret.m_params.push_back(ex); + return ret; +} + +RegEx operator||(const RegEx& ex1, const RegEx& ex2) { + RegEx ret(REGEX_OR); + ret.m_params.push_back(ex1); + ret.m_params.push_back(ex2); + return ret; +} + +RegEx operator&&(const RegEx& ex1, const RegEx& ex2) { + RegEx ret(REGEX_AND); + ret.m_params.push_back(ex1); + ret.m_params.push_back(ex2); + return ret; +} + +RegEx operator+(const RegEx& ex1, const RegEx& ex2) { + RegEx ret(REGEX_SEQ); + ret.m_params.push_back(ex1); + ret.m_params.push_back(ex2); + return ret; +} +} -- cgit v1.2.3