From d702d0e9bbf30ecaf066430e758a10709ea11004 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Tue, 29 Jan 2019 15:51:06 +0800 Subject: core: vm: sqlvm: ast: don't hardcode output and indent in PrintAST It is now possible to write AST dump to a writer other than stdout and use indent string other than 2 spaces. --- core/vm/sqlvm/cmd/ast-printer/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/vm/sqlvm/cmd') diff --git a/core/vm/sqlvm/cmd/ast-printer/main.go b/core/vm/sqlvm/cmd/ast-printer/main.go index 7b4251fa1..6965a1d4e 100644 --- a/core/vm/sqlvm/cmd/ast-printer/main.go +++ b/core/vm/sqlvm/cmd/ast-printer/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "os" "github.com/dexon-foundation/dexon/core/vm/sqlvm/ast" "github.com/dexon-foundation/dexon/core/vm/sqlvm/parser" @@ -17,7 +18,7 @@ func main() { n, err := parser.Parse([]byte(flag.Arg(0))) fmt.Printf("detail: %t\n", detail) if err == nil { - ast.PrintAST(n, "", detail) + ast.PrintAST(os.Stdout, n, " ", detail) } else { fmt.Printf("err:\n%+v\n", err) } -- cgit v1.2.3