// extracts a vector<expr> that represents a core input extracted with Utils::read_core_file method // return 0 if successful (core in resulting clause), or a positive integer if unsuccessful (with empty resultingClause). void CoreParser::extractInitialCore(expr& ast, ArgParser parser, vector<expr>& resultingCore) { vector<string> initialCore; read_core_file(parser.getInputFile(), initialCore); vector<expr> core; unsigned i; for (i = 0; i < initialCore.size(); ++i) { int index = -1; try { index = std::stoi(initialCore[i].substr(initialCore[i].find('c', 0)+1, initialCore[i].size() - 1)); // line should be of the form "C<num>" where C is a char and <num> is an integer between 0 and the number of clauses in the ast } catch (std::invalid_argument& e) { resultingCore.clear(); throw PropsitionalCoreParserException((string(__func__) + ": ERROR in parsing clause named " + initialCore[i] + "at line " + std::to_string(i) + " in core file, clause not named in the form 'C<num>' (for a given number num)").c_str(),3); } if (0 > index || ast.num_args() <= index) { resultingCore.clear(); throw PropsitionalCoreParserException((string(__func__) + ": ERROR index "+ std::to_string(index) + ", at line " + std::to_string(i) + " in core file is out of bounds of formula.").c_str(),4); } resultingCore.push_back(ast.arg(index)); } }