language

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("language is not supported")

Functions

This section is empty.

Types

type Identifier

type Identifier string

Identifier is a type that uniquely identifies a language

const (
	HTML    Identifier = "html"
	PHP     Identifier = "php"
	PHPOnly Identifier = "php_only"
	Blade   Identifier = "blade"
	DotEnv  Identifier = "dotenv"
)
const InvalidIdentifier Identifier = "invalid"

InvalidIdentifier special identifier that is used to flag that the language is invalid.

func FiletypeToLanguage

func FiletypeToLanguage(t file.Type) Identifier

FiletypeToLanguage Get the language Identifier for a particular filetype

func (Identifier) Language

func (id Identifier) Language() *Language

Language get the language object for this identifier Syntactic sugar for Get(id)

func (Identifier) String

func (id Identifier) String() string

String syntactic sugar for string(id)

func (Identifier) Valid

func (id Identifier) Valid() bool

type Language

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

Language is a wrapper object that makes is easier to handle tree-sitter language objects.

func Get

func Get(lang Identifier) *Language

func NewLanguage

func NewLanguage(id Identifier, impl unsafe.Pointer) *Language

func (Language) ID

func (l Language) ID() Identifier

ID get the identifier for this language

func (Language) Name

func (l Language) Name() string

Name get the name of this language

func (Language) Query

func (l Language) Query(source string) (*ts.Query, *ts.QueryError)

Query create a new Query object for this language.

func (Language) TSObject

func (l Language) TSObject() *ts.Language

TSObject get the tree-sitter object.

Jump to

Keyboard shortcuts

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