代码拉取完成,页面将自动刷新
package main
import (
"io/ioutil"
"os"
"gitee.com/thincats/codegen-tool"
"gitee.com/thincats/conftool"
"gitee.com/thincats/tree-sitter-nodegen/pkg/config"
"gitee.com/thincats/tree-sitter-nodegen/pkg/parse"
"gitee.com/thincats/tree-sitter-nodegen/pkg/types"
)
func panicIfErr(err error) {
if err != nil {
panic(err)
}
}
func main() {
conf := config.NodeGenConfig{}
ctool := conftool.New(
conftool.WithPathFlagMode(os.Args[1:]),
)
ctool.MustParse(&conf,
ctool.WithDefaultValueSupport(),
ctool.WithCommandLineSupportPathFlag(),
ctool.WithConfigFileSupportPathFlag("conf"),
ctool.WithValidateSupport(),
)
nodeTypesData, err := ioutil.ReadFile(conf.Input)
panicIfErr(err)
nodes, err := parse.Parse(nodeTypesData)
panicIfErr(err)
err = types.NewNodesValidChecker().Validate(nodes)
panicIfErr(err)
sema, err := types.NewNodeSemaAnalysis().Analysis(nodes)
panicIfErr(err)
sfLoader := types.NewStoreFuncsLoader(nodes, sema)
builder := codegen.NewToolBuilder()
tool, err := builder.
WithConfig(conf.Codegen).
WithFuncsLoader(sfLoader).
WithStoreLoader(sfLoader).
Build()
panicIfErr(err)
err = tool.Run()
panicIfErr(err)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。