aboutsummaryrefslogblamecommitdiffstats
path: root/core/vm/sqlvm/cmd/ast-printer/main.go
blob: 7b4251fa1248e687e3a96723c201cd685914b64d (plain) (tree)
1
2
3
4
5
6
7
8


            
              
             
 

                                                                


             




                                                                     
                                                   
                                          
                       
                                           

                                              

         
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)
    }
}