parser

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	IgnoreDirs     []string
	IgnoreFiles    []string
	IncludeTests   bool
	IncludeVendor  bool
	MaxConcurrency int
}

Config represents parser configuration

type ConstantInfo

type ConstantInfo struct {
	Name       string
	Type       string
	Value      string
	IsExported bool
}

ConstantInfo represents a constant declaration

type FieldInfo

type FieldInfo struct {
	Name       string
	Type       string
	Tag        string
	IsExported bool
}

FieldInfo represents a struct field

type FileInfo

type FileInfo struct {
	Path         string
	Package      string
	Imports      []ImportInfo
	Functions    []FunctionInfo
	Structs      []StructInfo
	Interfaces   []InterfaceInfo
	Constants    []ConstantInfo
	Variables    []VariableInfo
	Dependencies []string
}

FileInfo represents parsed information from a Go file

type FunctionCall

type FunctionCall struct {
	Name    string
	Package string
	Line    int
}

FunctionCall represents a function call within a function

type FunctionInfo

type FunctionInfo struct {
	Name       string
	Receiver   string
	Signature  string
	Parameters []Parameter
	Returns    []string
	Body       string
	LineStart  int
	LineEnd    int
	IsExported bool
	Calls      []FunctionCall
}

FunctionInfo represents a function or method

type ImportInfo

type ImportInfo struct {
	Name  string
	Path  string
	Alias string
}

ImportInfo represents an import statement

type InterfaceInfo

type InterfaceInfo struct {
	Name       string
	Methods    []MethodInfo
	Embeds     []string
	LineStart  int
	LineEnd    int
	IsExported bool
}

InterfaceInfo represents an interface type

type MethodInfo

type MethodInfo struct {
	Name       string
	Parameters []Parameter
	Returns    []string
}

MethodInfo represents an interface method

type Parameter

type Parameter struct {
	Name string
	Type string
}

Parameter represents a function parameter

type ParseResult

type ParseResult struct {
	ProjectPath string      // Root path of the project
	Files       []*FileInfo // All parsed files
	ParseTime   int64       // Time taken to parse in milliseconds
}

ParseResult contains the results of parsing a project

type Parser

type Parser interface {
	ParseFile(ctx context.Context, filePath string) (*FileInfo, error)
	ParseDirectory(ctx context.Context, dirPath string) ([]*FileInfo, error)
	ParseProject(ctx context.Context, projectPath string, config *Config) (*ParseResult, error)
}

Parser defines the interface for parsing Go source code

func NewService

func NewService(config *Config) Parser

NewService creates a new parser service

type Service

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

Service implements the Parser interface

func (*Service) ParseDirectory

func (s *Service) ParseDirectory(ctx context.Context, dirPath string) ([]*FileInfo, error)

ParseDirectory parses all Go files in a directory

func (*Service) ParseFile

func (s *Service) ParseFile(ctx context.Context, filePath string) (*FileInfo, error)

ParseFile parses a single Go file

func (*Service) ParseProject

func (s *Service) ParseProject(ctx context.Context, projectPath string, config *Config) (*ParseResult, error)

ParseProject parses an entire Go project

type StructInfo

type StructInfo struct {
	Name       string
	Fields     []FieldInfo
	Methods    []FunctionInfo
	Embeds     []string
	LineStart  int
	LineEnd    int
	IsExported bool
}

StructInfo represents a struct type

type VariableInfo

type VariableInfo struct {
	Name       string
	Type       string
	IsExported bool
}

VariableInfo represents a variable declaration

Jump to

Keyboard shortcuts

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