File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -44,21 +44,22 @@ bool Arch::apply_lpf(std::string filename, std::istream &in)
4444 auto isempty = [](const std::string &str) {
4545 return std::all_of (str.begin (), str.end (), [](char c) { return isblank (c) || c == ' \r ' || c == ' \n ' ; });
4646 };
47- auto strip_quotes = [](const std::string &str) {
48- if (str.at (0 ) == ' "' ) {
49- NPNR_ASSERT (str.back () == ' "' );
50- return str.substr (1 , str.size () - 2 );
51- } else {
52- return str;
53- }
54- };
55-
5647 try {
5748 if (!in)
5849 log_error (" failed to open LPF file\n " );
5950 std::string line;
6051 std::string linebuf;
6152 int lineno = 0 ;
53+ auto strip_quotes = [&](const std::string &str) {
54+ if (str.at (0 ) == ' "' ) {
55+ if (str.back () != ' "' ) {
56+ log_error (" expected '\" ' at end of string '%s' (on line %d)\n " , str.c_str (), lineno);
57+ }
58+ return str.substr (1 , str.size () - 2 );
59+ } else {
60+ return str;
61+ }
62+ };
6263 while (std::getline (in, line)) {
6364 ++lineno;
6465 size_t cstart = line.find (' #' );
You can’t perform that action at this time.
0 commit comments