parser

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFileDocNode

func CreateFileDocNode(filePath string, relPath string) (*types.ASTNode, error)

CreateFileDocNode reads a file and creates a searchable document node with the file's content as a bounded text snippet.

func ExtractGoRoutes

func ExtractGoRoutes(file *ast.File, fset *token.FileSet, content []byte, relPath string) ([]types.ASTNode, []types.ASTEdge)

ExtractGoRoutes extracts route-like registrations from Go AST.

func ExtractJSRoutes

func ExtractJSRoutes(content []byte, relPath string) ([]types.ASTNode, []types.ASTEdge)

ExtractJSRoutes extracts route-like definitions from JS/TS source code.

func ExtractRoutes

func ExtractRoutes(content []byte, relPath string) ([]types.ASTNode, []types.ASTEdge)

ExtractRoutes extracts Laravel route definitions from PHP source code.

func IsFileDocCandidate

func IsFileDocCandidate(relPath string) bool

IsFileDocCandidate returns true if the file path matches one of the file document indexing patterns. This function does NOT check if the file is already handled by tree-sitter — the caller should check that.

func IsSupported

func IsSupported(filePath string) bool

IsSupported returns true if the file extension is supported for parsing

func SupportedExtensions

func SupportedExtensions() []string

SupportedExtensions returns the list of supported file extensions

Types

type ParseResult

type ParseResult struct {
	Nodes []types.ASTNode
	Edges []types.ASTEdge
}

ParseResult contains the extracted nodes and edges from a file

type Parser

type Parser struct{}

Parser extracts structural nodes and edges from source files

func New

func New() *Parser

New creates a new Parser

func (*Parser) ParseFile

func (p *Parser) ParseFile(filePath string, repoRoot string) (*ParseResult, error)

ParseFile parses a source file and extracts AST nodes and edges

Jump to

Keyboard shortcuts

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