We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
normalization_data.c.txt
The text was updated successfully, but these errors were encountered:
func TestChildTraversal(t *testing.T) { b, _ := os.ReadFile("normalization_data.c") root := mustParseGo(string(b))
var visit func(n *sitter.Node, name string, depth int) visit = func(n *sitter.Node, name string, depth int) { fmt.Println("depth:", depth) printNode(n, depth, name) for i := 0; i < int(n.ChildCount()); i++ { visit(n.Child(i), n.FieldNameForChild(i), depth+1) } } visit(root, "root", 0)
}
func mustParseC(src string) *sitter.Node { root, err := sitter.ParseCtx(context.Background(), []byte(src), c.GetLanguage()) if err != nil { log.Fatal(err) } return root }
func printNode(n *sitter.Node, depth int, name string) { prefix := "" if name != "" { prefix = name + ": " } fmt.Printf("%s%s%s [%d-%d]\n", strings.Repeat(" ", depth), prefix, n.Type(), n.StartByte(), n.EndByte()) }
Sorry, something went wrong.
is this issue resolved?I also meet this question when parse a large c source code.
No branches or pull requests
normalization_data.c.txt
The text was updated successfully, but these errors were encountered: