summary refs log tree commit diff stats
path: root/compiler/lexer.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-04-13 01:09:15 +0200
committerAraq <rumpf_a@web.de>2013-04-13 01:09:15 +0200
commit18fbaab216e3dc59011b871849ebcf4bfab94afd (patch)
treeb564b6b4ce28e551484b36a2659762af10e25ea7 /compiler/lexer.nim
parent3cb3813eed378d753807a07f434234ce2d4c5159 (diff)
downloadNim-18fbaab216e3dc59011b871849ebcf4bfab94afd.tar.gz
fixes #310
Diffstat (limited to 'compiler/lexer.nim')
-rw-r--r--compiler/lexer.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index 02f63aee8..9cf5ccb2b 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -675,6 +675,8 @@ proc scanComment(L: var TLexer, tok: var TToken) =
   # a comment ends if the next line does not start with the # on the same
   # column after only whitespace
   tok.tokType = tkComment
+  # iNumber contains the number of '\n' in the token
+  tok.iNumber = 0
   var col = getColNumber(L, pos)
   while true:
     var lastBackslash = -1
@@ -699,6 +701,7 @@ proc scanComment(L: var TLexer, tok: var TToken) =
     if buf[pos] == '#' and (col == indent or lastBackslash > 0):
       tok.literal.add "\n"
       col = indent
+      inc tok.iNumber
     else:
       if buf[pos] > ' ': 
         L.indentAhead = indent