llcppsigfetch:basic cjson dump for ast.File
This commit is contained in:
26
chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/decl.go
Normal file
26
chore/_xtool/llcppsigfetch/parse/cvt_test/decl_test/decl.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/chore/_xtool/llcppsigfetch/parse"
|
||||
)
|
||||
|
||||
func main() {
|
||||
TestFuncDecl()
|
||||
}
|
||||
|
||||
func TestFuncDecl() {
|
||||
content := `int foo(int a, int b);`
|
||||
converter, err := parse.NewConverter(content, true)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
defer converter.Dispose()
|
||||
converter.Convert()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
json := converter.GetFilesJSON()
|
||||
c.Printf(c.Str("%s\n"), json.Print())
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#stdout
|
||||
{
|
||||
"Files": {
|
||||
"temp.h": {
|
||||
"Path": "temp.h",
|
||||
"decls": [{
|
||||
"Name": "foo",
|
||||
"Type": {
|
||||
"Params": [{
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
}, {
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
}],
|
||||
"Ret": {
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#stderr
|
||||
|
||||
#exit 0
|
||||
Reference in New Issue
Block a user