aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/sqlvm/cmd/ast-printer/main.go
blob: 7b4251fa1248e687e3a96723c201cd685914b64d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main

import (
    "flag"
    "fmt"

    "github.com/dexon-foundation/dexon/core/vm/sqlvm/ast"
    "github.com/dexon-foundation/dexon/core/vm/sqlvm/parser"
)

func main() {
    var detail bool
    flag.BoolVar(&detail, "detail", false, "print struct detail")

    flag.Parse()

    n, err := parser.Parse([]byte(flag.Arg(0)))
    fmt.Printf("detail: %t\n", detail)
    if err == nil {
        ast.PrintAST(n, "", detail)
    } else {
        fmt.Printf("err:\n%+v\n", err)
    }
}