nimpretty: code cleanups
This commit is contained in:
parent
0193c8ad2e
commit
fc34193483
2 changed files with 4 additions and 13 deletions
|
|
@ -146,10 +146,6 @@ type
|
||||||
previousToken: TLineInfo
|
previousToken: TLineInfo
|
||||||
config*: ConfigRef
|
config*: ConfigRef
|
||||||
|
|
||||||
when defined(nimpretty):
|
|
||||||
var
|
|
||||||
gIndentationWidth*: int
|
|
||||||
|
|
||||||
proc getLineInfo*(L: TLexer, tok: TToken): TLineInfo {.inline.} =
|
proc getLineInfo*(L: TLexer, tok: TToken): TLineInfo {.inline.} =
|
||||||
result = newLineInfo(L.fileIdx, tok.line, tok.col)
|
result = newLineInfo(L.fileIdx, tok.line, tok.col)
|
||||||
when defined(nimpretty):
|
when defined(nimpretty):
|
||||||
|
|
@ -1174,8 +1170,6 @@ proc skip(L: var TLexer, tok: var TToken) =
|
||||||
tok.commentOffsetB = L.offsetBase + pos - 1
|
tok.commentOffsetB = L.offsetBase + pos - 1
|
||||||
tok.tokType = tkComment
|
tok.tokType = tkComment
|
||||||
tok.indent = commentIndent
|
tok.indent = commentIndent
|
||||||
if gIndentationWidth <= 0:
|
|
||||||
gIndentationWidth = tok.indent
|
|
||||||
|
|
||||||
proc rawGetTok*(L: var TLexer, tok: var TToken) =
|
proc rawGetTok*(L: var TLexer, tok: var TToken) =
|
||||||
template atTokenEnd() {.dirty.} =
|
template atTokenEnd() {.dirty.} =
|
||||||
|
|
|
||||||
|
|
@ -64,14 +64,11 @@ proc renderDefinitionName*(s: PSym, noQuotes = false): string =
|
||||||
else:
|
else:
|
||||||
result = '`' & x & '`'
|
result = '`' & x & '`'
|
||||||
|
|
||||||
when not defined(nimpretty):
|
const
|
||||||
const
|
IndentWidth = 2
|
||||||
IndentWidth = 2
|
longIndentWid = IndentWidth * 2
|
||||||
longIndentWid = IndentWidth * 2
|
|
||||||
else:
|
|
||||||
template IndentWidth: untyped = lexer.gIndentationWidth
|
|
||||||
template longIndentWid: untyped = IndentWidth() * 2
|
|
||||||
|
|
||||||
|
when defined(nimpretty):
|
||||||
proc minmaxLine(n: PNode): (int, int) =
|
proc minmaxLine(n: PNode): (int, int) =
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkTripleStrLit:
|
of nkTripleStrLit:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue