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

View file

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

View file

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