Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
Extractor.cpp
Go to the documentation of this file.
1#include "Extractor.h"
2
3std::vector<Extractor::Parameter> Extractor::extract(const std::string& filename) {
4 std::vector<Parameter> params;
5 std::ifstream file(filename);
6 std::string line;
7 std::regex paramRegex(R"(csl::InitSanitizer<real_t>\s+(\w+)\s+\{\s+\"(\w+)\"\s+\};)");
8
9 while (std::getline(file, line)) {
10 std::smatch match;
11 if (std::regex_search(line, match, paramRegex)) {
12 Parameter param{match[1], match[2], false};
13 params.push_back(param);
14 }
15 }
16
17 std::ifstream file_2(filename);
18 std::string line_2;
19 std::regex paramRegex_2(R"(csl::InitSanitizer<complex_t>\s+(\w+)\s+\{\s+\"(\w+)\"\s+\};)");
20
21 while (std::getline(file_2, line_2)) {
22 std::smatch match;
23 if (std::regex_search(line_2, match, paramRegex_2)) {
24 Parameter param{match[1], match[2], true};
25 params.push_back(param);
26 }
27 }
28
29 return params;
30}
Declares utilities to extract parameter declarations from C++ code.
static std::vector< Parameter > extract(const std::string &filename)
Extracts all parameter declarations from a given C++ file.
Definition Extractor.cpp:3
Simple descriptor for a discovered parameter.
Definition Extractor.h:42