summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/lexer.nim13
-rw-r--r--tests/parser/tmultiline_comments.nim30
2 files changed, 40 insertions, 3 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index e51d8db8a..fc43f8d6a 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -913,9 +913,16 @@ proc skip(L: var TLexer, tok: var TToken) =
       pos = handleCRLF(L, pos)
       buf = L.buf
       var indent = 0
-      while buf[pos] == ' ':
-        inc(pos)
-        inc(indent)
+      while true:
+        if buf[pos] == ' ':
+          inc(pos)
+          inc(indent)
+        elif buf[pos] == '#' and buf[pos+1] == '[':
+          skipMultiLineComment(L, tok, pos+2, false)
+          pos = L.bufpos
+          buf = L.buf
+        else:
+          break
       tok.strongSpaceA = 0
       when defined(nimfix):
         template doBreak(): expr = buf[pos] > ' '
diff --git a/tests/parser/tmultiline_comments.nim b/tests/parser/tmultiline_comments.nim
index 72832479d..7a3bb5304 100644
--- a/tests/parser/tmultiline_comments.nim
+++ b/tests/parser/tmultiline_comments.nim
@@ -32,3 +32,33 @@ proc bar =
   ##[Long documentation comment
   here.
   ]##
+
+
+proc write(a: auto, x: varargs[string, `$`]) =
+  stdout.write ($a)
+  for o in x:
+    stdout.write(o)
+
+proc writeln(a: auto, x: varargs[string, `$`]) =
+  write a, x
+  stdout.write "\n"
+
+proc write() = write(stdout)
+proc writeln() =
+  stdout.write "\n"
+
+#[  #[ Multiline comment in already
+   commented out code. ]#
+proc p[T](x: T) = discard
+]#
+
+var hello = #[(x in bar)^^ "Hello" # greetings
+]#"Hello"
+proc maino =
+  write hello, " Test Me "
+  writeln()
+  write 3
+  block:
+    write()
+    write " times more"
+  #[ test ]#  writeln " Again"