Fixed comment parsing in Pass::call()
authorClifford Wolf <clifford@clifford.at>
Mon, 29 Dec 2014 03:15:48 +0000 (04:15 +0100)
committerClifford Wolf <clifford@clifford.at>
Mon, 29 Dec 2014 03:23:19 +0000 (04:23 +0100)
kernel/register.cc

index 7086e1424ecd7f60d9a321ba548322f3e7b6649e..56dc695aa6d436909520b75f7e8e5dceaa78800a 100644 (file)
@@ -150,7 +150,7 @@ void Pass::call(RTLIL::Design *design, std::string command)
        std::string cmd_buf = command;
        std::string tok = next_token(cmd_buf, " \t\r\n");
 
-       if (tok.empty() || tok[0] == '#')
+       if (tok.empty())
                return;
 
        if (tok[0] == '!') {
@@ -166,8 +166,13 @@ void Pass::call(RTLIL::Design *design, std::string command)
        }
 
        while (!tok.empty()) {
-               if (tok == "#")
-                       break;
+               if (tok == "#") {
+                       int stop;
+                       for (stop = 0; stop < GetSize(cmd_buf); stop++)
+                               if (cmd_buf[stop] == '\r' || cmd_buf[stop] == '\n')
+                                       break;
+                       cmd_buf = cmd_buf.substr(stop);
+               } else
                if (tok.back() == ';') {
                        int num_semikolon = 0;
                        while (!tok.empty() && tok.back() == ';')