Fixed line numbers when using here-doc macros
authorClifford Wolf <clifford@clifford.at>
Thu, 14 Aug 2014 20:26:30 +0000 (22:26 +0200)
committerClifford Wolf <clifford@clifford.at>
Thu, 14 Aug 2014 20:26:30 +0000 (22:26 +0200)
frontends/verilog/preproc.cc

index 7935fbc34c8d5beec58b2d5e5ef38dcaee8c82df..ae139741ace7f7ff39e1d9ed0b5415fc02e71a7f 100644 (file)
@@ -343,10 +343,15 @@ std::string frontend_verilog_preproc(FILE *f, std::string filename, const std::m
                                } else {
                                        if (state != 2)
                                                state = 3;
-                                       if (tok == "\n" && !here_doc_mode) {
-                                               return_char('\n');
-                                               break;
-                                       }
+                                       if (tok == "\n") {
+                                               if (here_doc_mode) {
+                                                       value += " ";
+                                                       newline_count++;
+                                               } else {
+                                                       return_char('\n');
+                                                       break;
+                                               }
+                                       } else
                                        if (tok == "\\") {
                                                char ch = next_char();
                                                if (ch == '\n') {