From dcaba49c3f5be8670aa5add8f92f42efa363b0c1 Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 28 Sep 2014 13:38:26 +0200 Subject: [PATCH] deprecated '#[' comments for future multi-line comment feature --- compiler/lexer.nim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 40524564e..cbc87972d 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -662,7 +662,10 @@ proc getOperator(L: var TLexer, tok: var TToken) = proc scanComment(L: var TLexer, tok: var TToken) = var pos = L.bufpos var buf = L.buf - when not defined(nimfix): assert buf[pos+1] == '#' + when not defined(nimfix): + assert buf[pos+1] == '#' + if buf[pos+2] == '[': + lexMessagePos(L, warnDeprecated, pos, "use '## [' instead; '##['") tok.tokType = tkComment # iNumber contains the number of '\n' in the token tok.iNumber = 0 @@ -741,6 +744,8 @@ proc skip(L: var TLexer, tok: var TToken) = else: # do not skip documentation comment: if buf[pos+1] == '#': break + if buf[pos+1] == '[': + lexMessagePos(L, warnDeprecated, pos, "use '# [' instead; '#['") while buf[pos] notin {CR, LF, nimlexbase.EndOfFile}: inc(pos) else: break # EndOfFile also leaves the loop