treesitter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectLanguage

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

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
	Language  string // Set on root node only
}

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) GetLanguage

func (n *ASTNode) GetLanguage() string

GetLanguage walks up to the root to retrieve the AST's language.

func (*ASTNode) IsScaffolding

func (n *ASTNode) IsScaffolding() bool

IsScaffolding checks rules.yml to see if this node type is a variable-arity container.

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"`
	Scaffolding  []string          `yaml:"scaffolding"`
}

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