Categorygithub.com/mkorolyov/astparser
modulepackage
0.0.8
Repository: https://github.com/mkorolyov/astparser.git
Documentation: pkg.go.dev

# README

astparser

License MIT GoDoc Go Report Card Build Status codecov

Simple golang structs ast parser

Get the package using:

$ go get -u -v github.com/mkorolyov/astparser

Usage

prepare loader config

cfg := astparser.Config{
	InputDir:"somedir",
	//ExcludeRegexp "easyjson",
	IncludeRegexp:"event_",
}

Then you can load structs via

files := astParser.Load(cfg)

files is a map[string]ParsedFile where key is a file name and value is a ParsedFile type with structs and constants.

# Packages

No description provided by the author

# Functions

Load parses files and return a map where key is a file name and value as a parsed file obj with golang structs definitions and constants.

# Structs

No description provided by the author
ConstantDef describes defined constants.
FieldDef described parsed go struct field.
No description provided by the author
StructDef describes parsed go struct.
Tag contains parsed field tags.
TypeArray indicates that type is golang array or slice.
TypeCustomer indicates that type is a defined struct or type alias.
TypeInterfaceValue indicates that type is a interface{}.
TypeMap indicates that type is golang map.
TypePointer indicates that type is a point with underlying any golang type.
TypeSimple indicates that type is a primitive golang type like int or string.
TODO parse type comments Walker implements go/ast.Visitor to walk through golang structs and constants to parse them.

# Interfaces

Type represent parsed type.