nimpretty: first version that seems useful for others to test it

This commit is contained in:
Andreas Rumpf 2018-06-16 01:46:39 +02:00
commit a1bd4a6cbd
6 changed files with 239 additions and 6 deletions

View file

@ -42,9 +42,12 @@ proc writeVersion() =
proc prettyPrint(infile: string) =
let conf = newConfigRef()
let fileIdx = fileInfoIdx(conf, infile)
let tree = parseFile(fileIdx, newIdentCache(), conf)
let outfile = changeFileExt(infile, ".pretty.nim")
renderModule(tree, infile, outfile, {}, fileIdx)
when defined(nimpretty2):
discard parseFile(fileIdx, newIdentCache(), conf)
else:
let tree = parseFile(fileIdx, newIdentCache(), conf)
let outfile = changeFileExt(infile, ".pretty.nim")
renderModule(tree, infile, outfile, {}, fileIdx, conf)
proc main =
var infile: string

2
tools/nimpretty.nim.cfg Normal file
View file

@ -0,0 +1,2 @@
--define: nimpretty
--define: nimpretty2