Merge PR#166 from master

This commit is contained in:
Ganesh Viswanathan 2020-01-16 12:49:37 -06:00
commit 5241aee0fc
3 changed files with 7 additions and 11 deletions

View file

@ -1,6 +1,6 @@
import macros, os, strutils, tables, times
import compiler/[ast, astalgo, idents, options, renderer]
import compiler/[ast, idents, options, renderer]
import "."/treesitter/api
@ -806,8 +806,8 @@ proc searchTree(nimState: NimState, root: TSNode) =
if node == root:
break
proc printNimHeader*() =
echo """# Generated at $1
proc printNimHeader*(gState: State) =
gecho """# Generated at $1
# Command line:
# $2 $3
@ -845,4 +845,4 @@ proc printNim*(gState: State, fullpath: string, root: TSNode) =
tree.add nimState.typeSection
tree.add nimState.procSection
echo tree.renderTree()
gecho tree.renderTree()

View file

@ -445,11 +445,7 @@ proc printTree*(nimState: NimState, pnode: PNode, offset = "") =
else:
stdout.write ")"
if offset.len == 0:
echo ""
template decho*(str: untyped): untyped =
if nimState.gState.debug:
echo str.getCommented()
necho ""
proc printDebug*(nimState: NimState, node: TSNode) =
if nimState.gState.debug:
@ -458,7 +454,7 @@ proc printDebug*(nimState: NimState, node: TSNode) =
proc printDebug*(nimState: NimState, pnode: PNode) =
if nimState.gState.debug:
echo ("Output => " & $pnode).getCommented()
necho ("Output => " & $pnode).getCommented()
nimState.printTree(pnode)
# Compiler shortcuts

View file

@ -42,7 +42,7 @@ proc process(gState: State, path: string) =
tree.tsTreeDelete()
if gState.past:
echo gState.printLisp(root)
gecho gState.printLisp(root)
elif gState.pnim:
gState.printNim(path, root)
elif gState.preprocess: