Help us shape the future of Go! Take the 2026 Go Developer Survey

parser

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLanguage

func GetLanguage(l lang.Language) (*tree_sitter.Language, error)

GetLanguage returns the tree-sitter Language for a lang.Language.

func NodeText

func NodeText(node *tree_sitter.Node, source []byte) string

NodeText returns the text content of a node.

func Parse

func Parse(l lang.Language, source []byte) (*tree_sitter.Tree, error)

Parse parses source code into a tree-sitter AST Tree. The caller must call tree.Close() when done. Parsers are pooled per language via sync.Pool to avoid per-file allocation.

func Walk

func Walk(node *tree_sitter.Node, fn WalkFunc)

Walk traverses the AST in depth-first order.

Types

type WalkFunc

type WalkFunc func(node *tree_sitter.Node) bool

WalkFunc is called for each node during AST traversal. Return false to skip children.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL