parse

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GuessLanguage

func GuessLanguage(path string) string

GuessLanguage 根据文件扩展名猜测语言

Types

type FileStructure

type FileStructure struct {
	Language  string    `json:"language"`
	FilePath  string    `json:"file_path"`
	Package   string    `json:"package,omitempty"`
	Functions []*Symbol `json:"functions"`
	Classes   []*Symbol `json:"classes"`
	Imports   []string  `json:"imports"`
	Errors    []string  `json:"errors,omitempty"`
}

FileStructure 表示文件结构

func ParseFileStructure

func ParseFileStructure(ctx context.Context, filePath string) (*FileStructure, error)

ParseFileStructure 公共接口:解析文件结构

func ParseFileStructure0

func ParseFileStructure0(ctx context.Context, filePath, lang string, usePython bool) (*FileStructure, error)

ParseFileStructure0 解析文件结构

type Symbol

type Symbol struct {
	Name      string `json:"name"`
	Type      string `json:"type"` // "function", "method", "struct", "interface", "type"
	Line      int    `json:"line"`
	Column    int    `json:"column"`
	EndLine   int    `json:"end_line"`
	EndColumn int    `json:"end_column"`
	Signature string `json:"signature,omitempty"` // 函数签名
	Receiver  string `json:"receiver,omitempty"`  // 方法接收者
}

Symbol 表示一个代码符号(函数/类)

Source Files

  • parse.go

Jump to

Keyboard shortcuts

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