parser

package
v1.4.80 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package parser extracts graph nodes from a single Go source file using the standard go/ast and go/parser packages. No code from the target repository is executed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileResult

type FileResult struct {
	File        graph.FileNode
	Symbols     []graph.SymbolNode
	Imports     []graph.ImportEdge
	Calls       []graph.CallEdge
	Env         []graph.EnvRead
	Routes      []graph.HTTPRoute
	SQLs        []graph.SQLEdge
	Errors      []graph.ErrorEdge
	Concurrency []graph.ConcurrencyNode
	TestEdges   []graph.TestEdge
	Mutations   []graph.MutationEdge
	Literals    []graph.LiteralEdge
}

FileResult holds everything extracted from one source file.

func ParseFile

func ParseFile(fset *token.FileSet, path, relPath, pkgImportPath string) (*FileResult, error)

ParseFile parses a single .go file and extracts its nodes. path must be an absolute or repo-relative path. relPath is the repo-relative file path, stored in File nodes and graph edges. pkgImportPath is the module-rooted import path of the package (e.g. "github.com/org/repo/internal/auth"). It is used as the stable prefix for symbol IDs so that IDs survive file renames within a package.

Jump to

Keyboard shortcuts

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