Merge pull request #1567 from antmicro/fix-line-continuation-wrapping

Fix line continuation wrapping
diff --git a/verilog/formatting/formatter_test.cc b/verilog/formatting/formatter_test.cc
index f3c3773..e617479 100644
--- a/verilog/formatting/formatter_test.cc
+++ b/verilog/formatting/formatter_test.cc
@@ -5616,6 +5616,13 @@
      "    .rst  (rst),\n"
      "    .value(value)\n"
      ");\n"},
+    {"bind foo bar baz(\\\n"
+     "`undef d\\\n"
+     "`undef d);",
+     "bind foo bar baz (\\\n"
+     "    `undef d\\\n"
+     "    `undef d\n"
+     ");\n"},
     {
         "bind expaaaaaaaaaaand_meeee looooooooong_name# ("
         ".W(W_CONST), .H(H_CONST), .D(D_CONST)  )"
diff --git a/verilog/formatting/tree_unwrapper.cc b/verilog/formatting/tree_unwrapper.cc
index c8f6176..ef0b748 100644
--- a/verilog/formatting/tree_unwrapper.cc
+++ b/verilog/formatting/tree_unwrapper.cc
@@ -469,7 +469,8 @@
   while (!NextUnfilteredToken()->isEOF()) {
     EatSpaces();
     VLOG(4) << "lookahead token: " << VerboseToken(*NextUnfilteredToken());
-    if (IsComment(verilog_tokentype(NextUnfilteredToken()->token_enum()))) {
+    if (auto next_tok = verilog_tokentype(NextUnfilteredToken()->token_enum());
+        IsComment(next_tok) || next_tok == verilog_tokentype::TK_LINE_CONT) {
       // TODO(fangism): or IsAttribute().  Basically, any token that is not
       // in the syntax tree and not a space.
       AdvanceLastVisitedLeaf();