Fix #63 - cmdline and date in toast -n output
This commit is contained in:
parent
beebb20769
commit
62b44fc1e2
2 changed files with 14 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import sequtils, sets, strformat, strutils, tables
|
import os, sequtils, sets, strformat, strutils, tables, times
|
||||||
|
|
||||||
import regex
|
import regex
|
||||||
|
|
||||||
|
|
@ -128,9 +128,15 @@ proc searchAst(root: TSNode, astTable: AstTable, nimState: NimState) =
|
||||||
if node == root:
|
if node == root:
|
||||||
break
|
break
|
||||||
|
|
||||||
proc printNim*(fullpath: string, root: TSNode, astTable: AstTable) =
|
proc printNimHeader*() =
|
||||||
echo "{.experimental: \"codeReordering\".}"
|
echo """# Generated at $1
|
||||||
|
# Command line:
|
||||||
|
# $2 $3
|
||||||
|
|
||||||
|
{.experimental: "codeReordering".}
|
||||||
|
""" % [$now(), getAppFilename(), commandLineParams().join(" ")]
|
||||||
|
|
||||||
|
proc printNim*(fullpath: string, root: TSNode, astTable: AstTable) =
|
||||||
var
|
var
|
||||||
nimState = new(NimState)
|
nimState = new(NimState)
|
||||||
fp = fullpath.replace("\\", "/")
|
fp = fullpath.replace("\\", "/")
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,7 @@ proc printLisp(root: TSNode) =
|
||||||
break
|
break
|
||||||
|
|
||||||
proc process(path: string, astTable: AstTable) =
|
proc process(path: string, astTable: AstTable) =
|
||||||
if not existsFile(path):
|
doAssert existsFile(path), "Invalid path " & path
|
||||||
echo "Invalid path " & path
|
|
||||||
return
|
|
||||||
|
|
||||||
var
|
var
|
||||||
parser = tsParserNew()
|
parser = tsParserNew()
|
||||||
|
|
@ -141,7 +139,10 @@ proc main(
|
||||||
if pgrammar:
|
if pgrammar:
|
||||||
astTable.printGrammar()
|
astTable.printGrammar()
|
||||||
elif source.len != 0:
|
elif source.len != 0:
|
||||||
process(source[0], astTable)
|
if gStateRT.pnim:
|
||||||
|
printNimHeader()
|
||||||
|
for src in source:
|
||||||
|
process(src, astTable)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
import cligen
|
import cligen
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue