Skip to content
Snippets Groups Projects
Commit fe396e89 authored by Franck Dary's avatar Franck Dary
Browse files

Added backtrack Oracle for parser

parent ed77c3a7
No related branches found
No related tags found
No related merge requests found
......@@ -191,6 +191,37 @@ void Oracle::createDatabase()
return 0;
})));
str2oracle.emplace("error_parser", std::unique_ptr<Oracle>(new Oracle(
[](Oracle * oracle)
{
File file(oracle->filename, "r");
FILE * fd = file.getDescriptor();
char b1[1024];
while (fscanf(fd, "%[^\n]\n", b1) == 1)
oracle->data[b1] = b1;
},
[](Config & c, Oracle * oracle)
{
if (c.getCurrentStateHistory().size() >= 2 && (c.getCurrentStateHistory().top() == "BACK" || c.getCurrentStateHistory().getElem(1) == "BACK"))
return std::string("EPSILON");
if (c.getCurrentStateHistory().size() < 2)
return std::string("EPSILON");
if (c.hashHistory.contains(c.computeHash()))
return std::string("EPSILON");
if (oracle->data.count("systematic"))
return std::string("BACK 1");
return std::string("EPSILON");
},
[](Config &, Oracle *, const std::string &)
{
return 0;
})));
str2oracle.emplace("tagger", std::unique_ptr<Oracle>(new Oracle(
[](Oracle *)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment