From 7884a2520f0a520114008bf727594f38bf58d308 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 5 Nov 2022 12:51:39 -0700 Subject: Ignore leading/trailing whitespace and #comments in evt files --- io/model.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/io/model.cpp b/io/model.cpp index 81cf318..80986a6 100644 --- a/io/model.cpp +++ b/io/model.cpp @@ -57,6 +57,12 @@ void iomodel::load_evt(std::istream &fh) { // FIXME: add assertions // FIXME: add DMA for (std::string line; std::getline(fh, line); ) { + auto hashpos = line.find('#'); + line = line.substr(0, hashpos); + if (auto nwspos = line.find_first_not_of(" \t"); nwspos != std::string::npos) + line = line.substr(nwspos); + if (auto nwspos = line.find_last_not_of(" \t"); nwspos != std::string::npos) + line = line.substr(0, nwspos + 1); if (line.size() == 0) continue; if (line[0] == '+') { -- cgit v1.2.3