llcppsigfetch:basic marco process
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#stdout
|
||||
TestDefine Case 1:
|
||||
{
|
||||
"temp.h": {
|
||||
"path": "temp.h",
|
||||
"decls": [],
|
||||
"includes": [],
|
||||
"macros": [{
|
||||
"Name": {
|
||||
"Token": 2,
|
||||
"Lit": "foo"
|
||||
},
|
||||
"Body": [{
|
||||
"Token": 3,
|
||||
"Lit": "1"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#stderr
|
||||
|
||||
#exit 0
|
||||
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/chore/_xtool/llcppsigfetch/parse"
|
||||
)
|
||||
|
||||
func main() {
|
||||
TestDefine()
|
||||
}
|
||||
|
||||
func TestDefine() {
|
||||
testCases := []string{
|
||||
`#define foo 1`,
|
||||
}
|
||||
|
||||
for i, content := range testCases {
|
||||
converter, err := parse.NewConverter(content, true)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = converter.Convert()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
json := converter.MarshalASTFiles()
|
||||
c.Printf(c.Str("TestDefine Case %d:\n%s\n\n"), c.Int(i+1), json.Print())
|
||||
|
||||
converter.Dispose()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user