mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 20:47:53 +00:00
@@ -31,7 +31,7 @@ type
|
||||
inquote: bool
|
||||
semicolons: SemicolonKind
|
||||
col, lastLineNumber, lineSpan, indentLevel, indWidth: int
|
||||
nested: int
|
||||
inParamList*: int
|
||||
doIndentMore*: int
|
||||
content: string
|
||||
indentStack: seq[int]
|
||||
@@ -142,7 +142,7 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) =
|
||||
em.fixedUntil = em.content.high
|
||||
|
||||
elif tok.indent >= 0:
|
||||
if em.lastTok in (splitters + oprSet):
|
||||
if em.lastTok in (splitters + oprSet) or em.inParamList > 0:
|
||||
em.indentLevel = tok.indent
|
||||
else:
|
||||
if tok.indent > em.indentStack[^1]:
|
||||
|
||||
@@ -1037,6 +1037,7 @@ proc parseParamList(p: var TParser, retColon = true): PNode =
|
||||
addSon(result, p.emptyNode) # return type
|
||||
when defined(nimpretty2):
|
||||
inc p.em.doIndentMore
|
||||
inc p.em.inParamList
|
||||
let hasParLe = p.tok.tokType == tkParLe and p.tok.indent < 0
|
||||
if hasParLe:
|
||||
getTok(p)
|
||||
@@ -1073,6 +1074,7 @@ proc parseParamList(p: var TParser, retColon = true): PNode =
|
||||
result = p.emptyNode
|
||||
when defined(nimpretty2):
|
||||
dec p.em.doIndentMore
|
||||
dec p.em.inParamList
|
||||
|
||||
proc optPragmas(p: var TParser): PNode =
|
||||
if p.tok.tokType == tkCurlyDotLe and (p.tok.indent < 0 or realInd(p)):
|
||||
|
||||
@@ -8,8 +8,15 @@ const
|
||||
var
|
||||
failures = 0
|
||||
|
||||
when defined(develop):
|
||||
const nimp = "bin/nimpretty".addFileExt(ExeExt)
|
||||
if execShellCmd("nim c -o:$# nimpretty/nimpretty.nim" % [nimp]) != 0:
|
||||
quit("FAILURE: compilation of nimpretty failed")
|
||||
else:
|
||||
const nimp = "nimpretty"
|
||||
|
||||
proc test(infile, outfile: string) =
|
||||
if execShellCmd("nimpretty -o:$2 --backup:off $1" % [infile, outfile]) != 0:
|
||||
if execShellCmd("$# -o:$# --backup:off $#" % [nimp, outfile, infile]) != 0:
|
||||
quit("FAILURE")
|
||||
let nimFile = splitFile(infile).name
|
||||
let expected = dir / "expected" / nimFile & ".nim"
|
||||
|
||||
@@ -316,3 +316,8 @@ proc f() =
|
||||
str &= c
|
||||
|
||||
const test = r"C:\Users\-\Desktop\test.txt"
|
||||
|
||||
proc getKeyAndData(cursor: int, op: int):
|
||||
tuple[key, data: string, success: bool] {.noInit.} =
|
||||
var keyVal: string
|
||||
var dataVal: string
|
||||
|
||||
@@ -325,3 +325,8 @@ proc f() =
|
||||
str &= c
|
||||
|
||||
const test = r"C:\Users\-\Desktop\test.txt"
|
||||
|
||||
proc getKeyAndData(cursor: int; op: int):
|
||||
tuple[key, data: string; success: bool] {.noInit.} =
|
||||
var keyVal: string
|
||||
var dataVal: string
|
||||
|
||||
Reference in New Issue
Block a user