parser

package
v0.0.4-beta.9 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Path       string
	Type       string // import, require, from, include
	LineNumber int
	Resolved   string // Resolved path if determined
	IsLocal    bool   // True if local import
}

type Entity

type Entity struct {
	Name        string
	Type        string // function, class, type, interface, method, etc.
	Kind        string // specific: async_function, arrow_function, etc.
	Signature   string
	StartLine   int
	EndLine     int
	ColumnStart int
	ColumnEnd   int
	Docs        string                 // Documentation/comments
	Parent      string                 // Parent entity name for nested entities
	Visibility  string                 // public, private, protected, internal
	Scope       string                 // global, class, file, module, local
	Language    Language               // go, python, javascript, java
	Attributes  map[string]interface{} // Language-specific metadata
}

type Language

type Language string

Language represents supported programming languages

const (
	Go         Language = "go"
	Python     Language = "python"
	JavaScript Language = "javascript"
	TypeScript Language = "typescript"
	Java       Language = "java"
)

type LanguageParser

type LanguageParser interface {
	Language() Language
	Parse(filePath string, content string) (*ParseResult, error)
}

LanguageParser defines the interface for language-specific parsers

type ParseResult

type ParseResult struct {
	FilePath     string
	Language     Language
	Entities     []*Entity
	Dependencies []*Dependency
}

func Parse

func Parse(filePath string, content string) (result *ParseResult, err error)

Parse routes to the appropriate language parser. It recovers from panics in the underlying tree-sitter C/WASM runtime so that a single malformed file never crashes the process.

Directories

Path Synopsis
Package java implements a tree-sitter-based parser for Java source files.
Package java implements a tree-sitter-based parser for Java source files.
Package javascript implements a tree-sitter-based parser for JavaScript and TypeScript source files.
Package javascript implements a tree-sitter-based parser for JavaScript and TypeScript source files.
Package markup implements lightweight regex-based parsers for markup and style languages: HTML, CSS, SCSS, and Markdown.
Package markup implements lightweight regex-based parsers for markup and style languages: HTML, CSS, SCSS, and Markdown.
Package python implements a tree-sitter-based parser for Python source files.
Package python implements a tree-sitter-based parser for Python source files.
Package script implements lightweight regex-based parsers for scripting languages: Ruby, Bash/Shell, Lua, Perl, and R. No tree-sitter dependency — pure Go regex extraction.
Package script implements lightweight regex-based parsers for scripting languages: Ruby, Bash/Shell, Lua, Perl, and R. No tree-sitter dependency — pure Go regex extraction.
Package sql implements a lightweight regex-based parser for SQL files.
Package sql implements a lightweight regex-based parser for SQL files.
Package structured implements lightweight regex-based parsers for structured data formats: JSON, XML, YAML, TOML, and HCL (Terraform).
Package structured implements lightweight regex-based parsers for structured data formats: JSON, XML, YAML, TOML, and HCL (Terraform).

Jump to

Keyboard shortcuts

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