parser

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Abstract

type Abstract struct {
	ID      string   `json:"id"`
	Pos     string   `json:"pos"`
	Name    string   `json:"name"`
	File    int      `json:"file"`
	Pkg     int      `json:"pkg"`
	Comment string   `json:"comment"`
	Fields  []string `json:"fields"`
	// contains filtered or unexported fields
}

func NewAbstract

func NewAbstract(ident *ast.Ident, strtTyp *ast.StructType) *Abstract

func (*Abstract) Complete

func (a *Abstract) Complete()

type Call

type Call struct {
	ID        string `json:"id"`
	Caller    int    `json:"caller"`
	Callee    int    `json:"callee"`
	File      int    `json:"file"`
	Typ       string `json:"typ"`
	Signature string `json:"signature"`
	// contains filtered or unexported fields
}

func NewCall

func NewCall(pos token.Pos, scope string, selector string, typ *parsedtypes.Type) *Call

func (*Call) Complete

func (c *Call) Complete()

type Callable

type Callable struct {
	ID          string   `json:"id"`
	Pos         string   `json:"pos"`
	Name        string   `json:"name"`
	Abstract    string   `json:"abstract"`
	File        int      `json:"file"`
	Pkg         int      `json:"pkg"`
	Typ         string   `json:"typ"`
	Comment     string   `json:"comment"`
	Syscalls    []string `json:"syscalls"`
	Parameters  []string `json:"parameters"`
	Results     []string `json:"results"`
	Description string   `json:"description"`
	Method      bool     `json:"method"`
	Private     bool     `json:"private"`
	Orphan      bool     `json:"orphan"`
	// contains filtered or unexported fields
}

func NewCallable

func NewCallable(decl *ast.FuncDecl) *Callable

func (*Callable) Complete

func (c *Callable) Complete()

type File

type File struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
	Pkg  int    `json:"pkg"`
	// contains filtered or unexported fields
}

func NewSourceFile

func NewSourceFile(sm *SourceMap, idx int, pkg *Pkg) File

func (*File) BuildDeps

func (f *File) BuildDeps(deps map[string]*Pkg)

func (*File) EnumerateDecls

func (f *File) EnumerateDecls()

func (*File) SearchCalls

func (f *File) SearchCalls()

type Pkg

type Pkg struct {
	ID   string `json:"id"`
	Path string `json:"path"`
	// contains filtered or unexported fields
}

func NewSourcePkg

func NewSourcePkg(sm *SourceMap, idx int) Pkg

func (*Pkg) AbstractDefinition

func (p *Pkg) AbstractDefinition(name string) *Abstract

func (*Pkg) Abstracts

func (p *Pkg) Abstracts() []*Abstract

func (*Pkg) CallableDefinition

func (p *Pkg) CallableDefinition(name string) *Callable

func (*Pkg) Callables

func (p *Pkg) Callables() []*Callable

func (*Pkg) Calls

func (p *Pkg) Calls() []*Call

type Project

type Project struct {
	Pkgs      []Pkg       `json:"pkgs"`
	Files     []File      `json:"files"`
	Abstracts []*Abstract `json:"abstracts"`
	Callables []*Callable `json:"callables"`
	Calls     []*Call     `json:"calls"`
	// contains filtered or unexported fields
}

func NewProject

func NewProject(project, directory string) *Project

func (*Project) Initialize

func (p *Project) Initialize()

scan the whole project to get the directories and files

func (*Project) Parse

func (p *Project) Parse()

parse all the files to find out the nodes we are interested at

type SourceDir

type SourceDir struct {
	Path         string
	CountGoFiles int
}

type SourceFile

type SourceFile struct {
	Path     string
	Name     string
	Dir      int
	AST      *ast.File
	GoSource bool
	Test     bool
}

func (*SourceFile) Parse2AST

func (sf *SourceFile) Parse2AST(fset *token.FileSet)

type SourceMap

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

read-only source map of the project

func NewSourceMap

func NewSourceMap(project string, directory string) *SourceMap

func (*SourceMap) Dirs

func (sm *SourceMap) Dirs() []*SourceDir

func (*SourceMap) FileSet

func (sm *SourceMap) FileSet() *token.FileSet

func (*SourceMap) Files

func (sm *SourceMap) Files() []*SourceFile

func (*SourceMap) Module

func (sm *SourceMap) Module() string

func (*SourceMap) Path

func (sm *SourceMap) Path() string

func (*SourceMap) Scan

func (sm *SourceMap) Scan()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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