// strawberry-trace-check: dev tool (build-only, not installed). Compiles trace files with the same // parser replay uses and prints ": N traces" or the parse error. Exit 0 only if all compile. #include "strawberry/learn/trace.hpp" #include #include #include #include #include int main(int argc, char** argv) { if (argc < 2) { std::cerr << "usage: strawberry-trace-check FILE...\n"; return 2; } int rc = 0; for (int i = 1; i < argc; ++i) { std::ifstream in(argv[i], std::ios::binary); if (!in) { std::cerr << argv[i] << ": cannot read\n"; rc = 1; continue; } const std::string text((std::istreambuf_iterator(in)), std::istreambuf_iterator()); std::vector traces; std::string error; if (!strawberry::learn::compile_traces(text, traces, error)) { std::cerr << argv[i] << ": " << error << "\n"; rc = 1; continue; } std::cout << argv[i] << ": " << traces.size() << " traces\n"; for (const auto& t : traces) std::cout << " " << t.name << " (" << t.steps.size() << " steps)\n"; } return rc; }