-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·48 lines (46 loc) · 1.33 KB
/
Copy pathmain.cpp
File metadata and controls
executable file
·48 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <fstream>
#include <locale>
#include <codecvt>
#include <unistd.h>
#include "Solver/solver_kind.h"
#include "Solver/solver.h"
#include "Parser/parser.h"
#include "Solver/DetectAmbiguity/DetectAmbiguity.h"
int main(int argc, char* argv[]){
if (argc != 2){
std::cout << "parameter error" << std::endl;
}
std::ifstream infile;
infile.open(argv[1], std::ios::binary);
std::string line;
bool Ret = true;
std::vector<std::wstring> Regex_list;
wchar_t c;
while (getline(infile, line))
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring unicodeStr = converter.from_bytes(line);
c = unicodeStr.back();
if (c == '\r'){
unicodeStr.pop_back();
}
Regex_list.emplace_back(unicodeStr);
}
// Regex_list[Regex_list.size() - 1].push_back(c);
std::vector<solverbin::REnodeClass> ReList;
for (auto str : Regex_list){
auto ren = solverbin::Parer(str, 0);
ReList.emplace_back(ren.Re);
}
// auto kk = RR.FMDFA.Fullmatch(R"(a+(a?){0,5}aaaaaaaaaaaa)", "aaaaaaaaaaaaa");
auto kk = solverbin::DetectABTNFA(ReList[0]);
auto k1 = kk.IsABT(kk.SSBegin);
if (k1){
std::cout << "prefix: " << kk.InterStr << std::endl;
std::cout << "infix: " << kk.WitnessStr << std::endl;
}
else
std::cout << "false" << std::endl;
// int1.Intersect();
}