lang

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildIncludes

func BuildIncludes(l Language) bool

BuildIncludes reports whether this binary can parse l.

func Register

func Register(spec *LanguageSpec)

Register adds a LanguageSpec to the global registry.

Types

type Language

type Language string

Language represents a supported programming language.

const (
	Python     Language = "python"
	JavaScript Language = "javascript"
	TypeScript Language = "typescript"
	Go         Language = "go"
	Rust       Language = "rust"
	Java       Language = "java"
	CPP        Language = "cpp"
	TSX        Language = "tsx"
	// Programming languages (Tier 1)
	C          Language = "c"
	Bash       Language = "bash"
	PowerShell Language = "powershell"
	Nix        Language = "nix"
	CUDA       Language = "cuda"

	// Helper languages (Tier 2)
	HTML       Language = "html"
	CSS        Language = "css"
	SCSS       Language = "scss"
	YAML       Language = "yaml"
	TOML       Language = "toml"
	HCL        Language = "hcl"
	SQL        Language = "sql"
	Dockerfile Language = "dockerfile"
	JSON       Language = "json"
	XML        Language = "xml"
	Markdown   Language = "markdown"
	Makefile   Language = "makefile"
	CMake      Language = "cmake"
	Protobuf   Language = "protobuf"
	// Vendored from upstream codebase-memory-mcp's manifest (0.9.1)
	Lua     Language = "lua"
	Vue     Language = "vue"
	Svelte  Language = "svelte"
	GraphQL Language = "graphql"
	GoMod   Language = "gomod"
	Erlang  Language = "erlang"
	Clojure Language = "clojure"
)

func AllLanguages

func AllLanguages() []Language

AllLanguages returns all languages this binary supports.

func ExcludedFromBuild

func ExcludedFromBuild() []Language

ExcludedFromBuild lists languages left out of this binary.

func LanguageForExtension

func LanguageForExtension(ext string) (Language, bool)

LanguageForExtension returns the Language for a file extension.

func LanguageForFilename

func LanguageForFilename(name string) (Language, bool)

LanguageForFilename returns the Language for an exact filename match.

type LanguageSpec

type LanguageSpec struct {
	Language          Language
	FileExtensions    []string
	FunctionNodeTypes []string
	ClassNodeTypes    []string
	FieldNodeTypes    []string // tree-sitter node kinds for struct/class fields
	ModuleNodeTypes   []string
	CallNodeTypes     []string
	ImportNodeTypes   []string
	ImportFromTypes   []string
	PackageIndicators []string

	// BranchingNodeTypes lists AST node kinds counted for complexity metric.
	BranchingNodeTypes []string
	// VariableNodeTypes lists module-level variable declaration node kinds.
	VariableNodeTypes []string
	// AssignmentNodeTypes lists assignment expression/statement node kinds.
	AssignmentNodeTypes []string
	// ThrowNodeTypes lists throw/raise statement node kinds.
	ThrowNodeTypes []string
	// ThrowsClauseField is the field name for declared throws (e.g. Java "throws").
	ThrowsClauseField string
	// DecoratorNodeTypes lists decorator/annotation node kinds.
	DecoratorNodeTypes []string
	// EnvAccessFunctions lists function names used to read env vars (e.g. "os.Getenv").
	EnvAccessFunctions []string
	// EnvAccessMemberPatterns lists member access patterns for env vars (e.g. "process.env").
	EnvAccessMemberPatterns []string
}

LanguageSpec defines the tree-sitter node types for a language.

func ForExtension

func ForExtension(ext string) *LanguageSpec

ForExtension returns the LanguageSpec for a file extension (e.g. ".go").

func ForLanguage

func ForLanguage(lang Language) *LanguageSpec

ForLanguage returns the LanguageSpec for a language.

Jump to

Keyboard shortcuts

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