summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-06-16 01:46:39 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-06-16 01:46:39 +0200
commita1bd4a6cbd820cac7b3534e03c27bcd960775e76 (patch)
treefda3527ec954e5cdfb7ec09cb5e400caa7800f20 /tools
parentbf5d619a52da04c857a6f7fb3d68afc12182bc22 (diff)
downloadNim-a1bd4a6cbd820cac7b3534e03c27bcd960775e76.tar.gz
nimpretty: first version that seems useful for others to test it
Diffstat (limited to 'tools')
-rw-r--r--tools/nimpretty.nim9
-rw-r--r--tools/nimpretty.nim.cfg2
2 files changed, 8 insertions, 3 deletions
diff --git a/tools/nimpretty.nim b/tools/nimpretty.nim
index 386eddfde..89e6ef905 100644
--- a/tools/nimpretty.nim
+++ b/tools/nimpretty.nim
@@ -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
diff --git a/tools/nimpretty.nim.cfg b/tools/nimpretty.nim.cfg
new file mode 100644
index 000000000..5fafa6d2a
--- /dev/null
+++ b/tools/nimpretty.nim.cfg
@@ -0,0 +1,2 @@
+--define: nimpretty
+--define: nimpretty2