parsers

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package parsers provides a registry for language-specific parser plugins. Parsers extract metadata and chunk code for various programming languages.

Index

Constants

This section is empty.

Variables

View Source
var ErrPluginNotFound = errors.New("language plugin not found")

ErrPluginNotFound is returned when a plugin is not found

Functions

This section is empty.

Types

type ParserRegistry

type ParserRegistry interface {
	// RegisterParser adds a new parser plugin to the registry.
	RegisterParser(plugin schema.ParserPlugin) error
	// GetParser returns the parser for the given language name.
	GetParser(language string) (schema.ParserPlugin, error)
	// GetParserForFile returns the appropriate parser for the given file.
	GetParserForFile(path string, info fs.FileInfo) (schema.ParserPlugin, error)
	// GetParserForExtension returns the parser for the given file extension.
	GetParserForExtension(ext string) (schema.ParserPlugin, error)
	// GetAllParsers returns all registered parsers.
	GetAllParsers() []schema.ParserPlugin
}

ParserRegistry tracks registered language plugins and provides methods to look up parsers by language, file path, or extension.

func NewRegistry

func NewRegistry(logger *slog.Logger) ParserRegistry

NewRegistry creates a new language plugin registry

func RegisterLanguagePlugins

func RegisterLanguagePlugins(logger *slog.Logger) (ParserRegistry, error)

RegisterLanguagePlugins initializes and populates a language registry with all built-in parser plugins (Go, TypeScript, Markdown, JSON, YAML, etc.).

Directories

Path Synopsis
core.go - Main plugin file with goldmark integration
core.go - Main plugin file with goldmark integration
extractor - Fixed version
extractor - Fixed version

Jump to

Keyboard shortcuts

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