nimpretty: smart tabs support, fixes #9399 [bugfix]

This commit is contained in:
Andreas Rumpf 2019-06-10 10:50:02 +02:00
commit caf93f4355
6 changed files with 159 additions and 59 deletions

View file

@ -50,15 +50,11 @@ proc prettyPrint(infile, outfile: string, opt: PrettyOptions) =
var conf = newConfigRef()
let fileIdx = fileInfoIdx(conf, AbsoluteFile infile)
conf.outFile = RelativeFile outfile
when defined(nimpretty2):
var p: TParsers
p.parser.em.indWidth = opt.indWidth
if setupParsers(p, fileIdx, newIdentCache(), conf):
discard parseAll(p)
closeParsers(p)
else:
let tree = parseFile(fileIdx, newIdentCache(), conf)
renderModule(tree, infile, outfile, {}, fileIdx, conf)
var p: TParsers
p.parser.em.indWidth = opt.indWidth
if setupParsers(p, fileIdx, newIdentCache(), conf):
discard parseAll(p)
closeParsers(p)
proc main =
var infile, outfile: string