nimpretty: add #!nimpretty on/off directives

This commit is contained in:
Andreas Rumpf 2018-10-16 16:54:52 +02:00
commit f3c0703b7d
5 changed files with 43 additions and 9 deletions

View file

@ -1114,7 +1114,9 @@ proc skip(L: var TLexer, tok: var TToken) =
buf = L.buf
else:
tokenBegin(tok, pos)
while buf[pos] notin {CR, LF, nimlexbase.EndOfFile}: inc(pos)
while buf[pos] notin {CR, LF, nimlexbase.EndOfFile}:
when defined(nimpretty): tok.literal.add buf[pos]
inc(pos)
tokenEndIgnore(tok, pos+1)
when defined(nimpretty):
tok.commentOffsetB = L.offsetBase + pos + 1