parser

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Type file.Type

	Tree *LanguageTree

	// Content
	Src utils.Buffer
}

func Parse

func Parse(content []byte, typ file.Type) (*File, error)

func (*File) FindCaptures

func (f *File) FindCaptures(lang language.Identifier, query *ts.Query, captures ...string) (treesitter.CaptureSlice, error)

func (*File) FindTags added in v0.0.4

func (f *File) FindTags(lang language.Identifier, tags ...string) (treesitter.CaptureSlice, error)

func (*File) NodeMatchesCapture

func (f *File) NodeMatchesCapture(lang language.Identifier, query *ts.Query, capture string, node *ts.Node) bool

func (*File) SetContent

func (f *File) SetContent(src []byte) error

Set the file contents.

func (*File) Update

func (f *File) Update(start, end ts.Point, src []byte) error

Update part of file contents

type LanguageTree

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

func (LanguageTree) FindCaptures

func (langTree LanguageTree) FindCaptures(langID language.Identifier, query *ts.Query, source []byte, captures ...string) (treesitter.CaptureSlice, error)

func (LanguageTree) FindTags added in v0.0.4

func (langTree LanguageTree) FindTags(langID language.Identifier, source []byte, tags ...string) (treesitter.CaptureSlice, error)

func (LanguageTree) GetLanguageTrees

func (langTree LanguageTree) GetLanguageTrees(langID language.Identifier) []*LanguageTree

Get all trees for a particular language

func (*LanguageTree) GetLanguageTreesWithNode

func (langTree *LanguageTree) GetLanguageTreesWithNode(id language.Identifier, node *ts.Node) []*LanguageTree

Find all trees of a given language that includes the node

func (*LanguageTree) InRange

func (langTree *LanguageTree) InRange(r ts.Range) bool

func (*LanguageTree) Root

func (langTree *LanguageTree) Root() *ts.Node

func (*LanguageTree) Visualize added in v0.0.4

func (langTree *LanguageTree) Visualize() string

Jump to

Keyboard shortcuts

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