mirror of
https://github.com/Z3Prover/z3
synced 2026-05-25 19:36:20 +00:00
Finish TPTP review cleanups
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/ca1df142-d992-4e45-a8b3-859fa70a5222 Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
61c37b8640
commit
2bfb8d80db
2 changed files with 10 additions and 4 deletions
|
|
@ -1660,7 +1660,7 @@ class tptp_parser {
|
||||||
std::string role = to_lower(parse_name());
|
std::string role = to_lower(parse_name());
|
||||||
expect(token_kind::comma, "','");
|
expect(token_kind::comma, "','");
|
||||||
|
|
||||||
if (!m_name_filters.empty() && !m_name_filters.back().contains(formula_name)) {
|
if (!m_name_filters.empty() && m_name_filters.back().find(formula_name) == m_name_filters.back().end()) {
|
||||||
skip_annotations_until_rparen();
|
skip_annotations_until_rparen();
|
||||||
expect(token_kind::rparen, "')'");
|
expect(token_kind::rparen, "')'");
|
||||||
expect(token_kind::dot, "'.'");
|
expect(token_kind::dot, "'.'");
|
||||||
|
|
|
||||||
|
|
@ -49,16 +49,22 @@ static void write_file(char const* path, char const* contents) {
|
||||||
class scoped_temp_file {
|
class scoped_temp_file {
|
||||||
std::string m_path;
|
std::string m_path;
|
||||||
public:
|
public:
|
||||||
|
scoped_temp_file(scoped_temp_file const&) = delete;
|
||||||
|
scoped_temp_file& operator=(scoped_temp_file const&) = delete;
|
||||||
|
scoped_temp_file(scoped_temp_file&&) = delete;
|
||||||
|
scoped_temp_file& operator=(scoped_temp_file&&) = delete;
|
||||||
|
|
||||||
scoped_temp_file(char const* contents) {
|
scoped_temp_file(char const* contents) {
|
||||||
static std::atomic<unsigned> counter(0);
|
static std::atomic<unsigned> counter(0);
|
||||||
auto stamp = std::chrono::steady_clock::now().time_since_epoch().count();
|
auto stamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||||
|
std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||||
m_path = (std::filesystem::temp_directory_path() /
|
m_path = (std::filesystem::temp_directory_path() /
|
||||||
("z3-tptp-" + std::to_string(stamp) + "-" + std::to_string(counter.fetch_add(1)) + ".p")).string();
|
("z3-tptp-" + std::to_string(stamp) + "-" + std::to_string(counter.fetch_add(1)) + ".p")).string();
|
||||||
write_file(m_path.c_str(), contents);
|
write_file(m_path.c_str(), contents);
|
||||||
}
|
}
|
||||||
~scoped_temp_file() {
|
~scoped_temp_file() {
|
||||||
if (!m_path.empty())
|
if (!m_path.empty() && std::remove(m_path.c_str()) != 0)
|
||||||
std::remove(m_path.c_str());
|
std::cerr << "failed to remove temporary file: " << m_path << "\n";
|
||||||
}
|
}
|
||||||
std::string const& path() const { return m_path; }
|
std::string const& path() const { return m_path; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue