Merge branch 'devel' into faster-nimsuggest

This commit is contained in:
Andreas Rumpf
2017-02-22 16:28:32 +01:00
13 changed files with 135 additions and 25 deletions

View File

@@ -952,7 +952,7 @@ proc newIndent(curr, indent: int, ml: bool): int =
else: return indent
proc nl(s: var string, ml: bool) =
if ml: s.add("\n")
s.add(if ml: "\n" else: " ")
proc escapeJson*(s: string; result: var string) =
## Converts a string `s` to its JSON representation.
@@ -986,15 +986,14 @@ proc toPretty(result: var string, node: JsonNode, indent = 2, ml = true,
lstArr = false, currIndent = 0) =
case node.kind
of JObject:
if currIndent != 0 and not lstArr: result.nl(ml)
result.indent(currIndent) # Indentation
if lstArr: result.indent(currIndent) # Indentation
if node.fields.len > 0:
result.add("{")
result.nl(ml) # New line
var i = 0
for key, val in pairs(node.fields):
if i > 0:
result.add(", ")
result.add(",")
result.nl(ml) # New Line
inc i
# Need to indent more than {
@@ -1030,7 +1029,7 @@ proc toPretty(result: var string, node: JsonNode, indent = 2, ml = true,
result.nl(ml)
for i in 0..len(node.elems)-1:
if i > 0:
result.add(", ")
result.add(",")
result.nl(ml) # New Line
toPretty(result, node.elems[i], indent, ml,
true, newIndent(currIndent, indent, ml))

View File

@@ -1185,7 +1185,7 @@ proc createHardlink*(src, dest: string) =
proc parseCmdLine*(c: string): seq[string] {.
noSideEffect, rtl, extern: "nos$1".} =
## Splits a command line into several components;
## Splits a `command line`:idx: into several components;
## This proc is only occasionally useful, better use the `parseopt` module.
##
## On Windows, it uses the following parsing rules