Coverage Report

Created: 2025-07-18 06:29

/src/yaml-cpp/src/regex_yaml.cpp
Line
Count
Source
1
#include "regex_yaml.h"
2
3
namespace YAML {
4
// constructors
5
6
7.88k
RegEx::RegEx(REGEX_OP op) : m_op(op), m_a(0), m_z(0), m_params{} {}
7
9
RegEx::RegEx() : RegEx(REGEX_EMPTY) {}
8
9
7.24k
RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch), m_z(0), m_params{} {}
10
11
5
RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z), m_params{} {}
12
13
RegEx::RegEx(const std::string& str, REGEX_OP op)
14
16
    : m_op(op), m_a(0), m_z(0), m_params(str.begin(), str.end()) {}
15
16
// combination constructors
17
3.91k
RegEx operator!(const RegEx& ex) {
18
3.91k
  RegEx ret(REGEX_NOT);
19
3.91k
  ret.m_params.push_back(ex);
20
3.91k
  return ret;
21
3.91k
}
22
23
36
RegEx operator|(const RegEx& ex1, const RegEx& ex2) {
24
36
  RegEx ret(REGEX_OR);
25
36
  ret.m_params.push_back(ex1);
26
36
  ret.m_params.push_back(ex2);
27
36
  return ret;
28
36
}
29
30
3.90k
RegEx operator&(const RegEx& ex1, const RegEx& ex2) {
31
3.90k
  RegEx ret(REGEX_AND);
32
3.90k
  ret.m_params.push_back(ex1);
33
3.90k
  ret.m_params.push_back(ex2);
34
3.90k
  return ret;
35
3.90k
}
36
37
20
RegEx operator+(const RegEx& ex1, const RegEx& ex2) {
38
20
  RegEx ret(REGEX_SEQ);
39
20
  ret.m_params.push_back(ex1);
40
20
  ret.m_params.push_back(ex2);
41
20
  return ret;
42
20
}
43
}  // namespace YAML