treesitter

package
v0.0.0-...-e9fa4b7 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectLanguage

func DetectLanguage(filename string) (*gotreesitter.Language, error)

func LoadRules

func LoadRules() error

func PrintAST

func PrintAST(n *ASTNode, depth int)

Types

type ASTNode

type ASTNode struct {
	Type      string
	Label     string
	Children  []*ASTNode
	Parent    *ASTNode
	StartByte uint32
	EndByte   uint32
	StartRow  uint32 // 0-indexed
	StartCol  uint32
	EndRow    uint32
	EndCol    uint32
}

func BuildAST

func BuildAST(n *gotreesitter.Node, src []byte, lang *gotreesitter.Language, parent *ASTNode) *ASTNode

func Parse

func Parse(src []byte, filename string) (*ASTNode, error)

func (*ASTNode) Size

func (n *ASTNode) Size() int

Size returns the total number of nodes in the subtree rooted at n.

type Rules

type Rules struct {
	Flattened    []string          `yaml:"flattened"`
	Ignored      []string          `yaml:"ignored"`
	Aliased      map[string]string `yaml:"aliased"`
	LabelIgnored []string          `yaml:"label_ignored"`
}

func GetRules

func GetRules(lang string) *Rules

type RulesConfig

type RulesConfig struct {
	Languages map[string]Rules `yaml:",inline"`
}

Jump to

Keyboard shortcuts

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