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

parser

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLanguage

func GetLanguage(name string) *tree_sitter.Language

GetLanguage returns the tree-sitter Language for the given language name. Returns nil if the language is not supported.

Types

type ParseResult

type ParseResult struct {
	Tree     *tree_sitter.Tree
	Source   []byte
	Language string
	Path     string
}

ParseResult holds the tree-sitter parse tree, source bytes, and file metadata.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser wraps a tree-sitter parser for reuse across multiple files.

func NewParser

func NewParser() *Parser

NewParser creates a new tree-sitter parser instance.

func (*Parser) Close

func (p *Parser) Close()

Close releases resources held by the underlying tree-sitter parser.

func (*Parser) ParseFile

func (p *Parser) ParseFile(absPath, storePath, lang string) (*ParseResult, error)

ParseFile reads a file, configures the parser for the given language, and returns the parsed tree along with the source bytes.

Jump to

Keyboard shortcuts

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