parse

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMultiplePackages    = errors.New("multiple packages within a folder")
	ErrDuplicatedTypeParam = errors.New("duplicated type param received")
	ErrEmptyTypeName       = errors.New("empty type name param received")
)

Functions

This section is empty.

Types

type Deps added in v0.0.2

type Deps struct {
	Dir       string
	TypeNames []string
	Logger    zerolog.Logger
}

Deps struct is a set of required parser's dependencies.

type Parser

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

Parser holds a raw ast-tree data with pre-initialized map for constant names grouped by type name.

func NewParser

func NewParser(deps Deps) (*Parser, error)

NewParser creates and initializes a Parser for Go package. It loads a package with all types and syntax info, gets package name, etc.

func (Parser) GetConstantsByType added in v0.0.2

func (p Parser) GetConstantsByType() map[string][]string

func (Parser) GetPackageName added in v0.0.2

func (p Parser) GetPackageName() string

func (*Parser) Parse

func (p *Parser) Parse()

Parse inspects nodes of the ast-tree, gets constant blocks, finds necessary types and return errors if gets any in process.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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