From a1bb693253c6d2e7b76bf3871438e875145d41a9 Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Tue, 3 Sep 2024 11:44:45 -0700 Subject: [PATCH] btorsplit: Fix bad keyword detection. --- src/btorsplit.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/btorsplit.cpp b/src/btorsplit.cpp index a514003..d682b20 100644 --- a/src/btorsplit.cpp +++ b/src/btorsplit.cpp @@ -76,10 +76,26 @@ split_file(std::string infilename, bool overwrite) std::string line; while (std::getline(infile, line)) { - pos = line.find("bad"); - if (pos != line.npos) + if (!line.empty () && std::isdigit (line[0])) { - bad.insert(lines.size()); + size_t i = 0; + size_t size = line.size(); + // Skip id + while (i < size && std::isdigit (line[i])) + { + ++i; + } + // Skip spaces + while (i < size && std::isspace (line[i])) + { + ++i; + } + + if (i + 3 < size && line[i] == 'b' && line[i + 1] == 'a' + && line[i + 2] == 'd' && std::isspace(line[i + 3])) + { + bad.insert(lines.size()); + } } lines.push_back(line); }