fixes #1144
This commit is contained in:
parent
0339b9d386
commit
c41e099118
1 changed files with 13 additions and 12 deletions
|
|
@ -147,6 +147,7 @@ proc makeNimString(s: string): string =
|
||||||
add(result, '\"')
|
add(result, '\"')
|
||||||
|
|
||||||
proc putComment(g: var TSrcGen, s: string) =
|
proc putComment(g: var TSrcGen, s: string) =
|
||||||
|
if s.isNil: return
|
||||||
var i = 0
|
var i = 0
|
||||||
var comIndent = 1
|
var comIndent = 1
|
||||||
var isCode = (len(s) >= 2) and (s[1] != ' ')
|
var isCode = (len(s) >= 2) and (s[1] != ' ')
|
||||||
|
|
@ -195,7 +196,7 @@ proc putComment(g: var TSrcGen, s: string) =
|
||||||
optNL(g)
|
optNL(g)
|
||||||
|
|
||||||
proc maxLineLength(s: string): int =
|
proc maxLineLength(s: string): int =
|
||||||
result = 0
|
if s.isNil: return 0
|
||||||
var i = 0
|
var i = 0
|
||||||
var lineLen = 0
|
var lineLen = 0
|
||||||
while true:
|
while true:
|
||||||
|
|
@ -459,7 +460,7 @@ proc lsub(n: PNode): int =
|
||||||
of nkBreakStmt: result = lsub(n.sons[0]) + len("break_")
|
of nkBreakStmt: result = lsub(n.sons[0]) + len("break_")
|
||||||
of nkContinueStmt: result = lsub(n.sons[0]) + len("continue_")
|
of nkContinueStmt: result = lsub(n.sons[0]) + len("continue_")
|
||||||
of nkPragma: result = lcomma(n) + 4
|
of nkPragma: result = lcomma(n) + 4
|
||||||
of nkCommentStmt: result = len(n.comment)
|
of nkCommentStmt: result = if n.comment.isNil: 0 else: len(n.comment)
|
||||||
of nkOfBranch: result = lcomma(n, 0, - 2) + lsub(lastSon(n)) + len("of_:_")
|
of nkOfBranch: result = lcomma(n, 0, - 2) + lsub(lastSon(n)) + len("of_:_")
|
||||||
of nkImportAs: result = lsub(n.sons[0]) + len("_as_") + lsub(n.sons[1])
|
of nkImportAs: result = lsub(n.sons[0]) + len("_as_") + lsub(n.sons[1])
|
||||||
of nkElifBranch: result = lsons(n) + len("elif_:_")
|
of nkElifBranch: result = lsons(n) + len("elif_:_")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue