aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/yaml-cpp/src/regex_yaml.cpp
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/yaml-cpp/src/regex_yaml.cpp
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/yaml-cpp/src/regex_yaml.cpp')
-rw-r--r--contrib/libs/yaml-cpp/src/regex_yaml.cpp45
1 files changed, 45 insertions, 0 deletions
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;
+}
+}