goparser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum

type Enum struct {
	Name   string
	Type   string
	Values []EnumValue
}

Enum represents an enumerated type in go file

type EnumValue

type EnumValue struct {
	Name  string
	Value any
}
type Header struct {
	Comments []string
	Package  string
}

type Parser

type Parser struct {
	// The importer to resolve packages from import paths.
	Importer types.Importer
}

Parser can parse Go files.

func NewParser

func NewParser() *Parser

func (*Parser) Parse

func (p *Parser) Parse(srcPath string, files []string) (*Result, error)

Parse parses a given Go file at srcPath, along with all files that share the same package, into a domain model for enum code genration.

type Result

type Result struct {
	// The package name of a Go file.
	Header *Header

	// All the enums in a Go file.
	Enums []Enum
}

Result representats a parsed Go file.

Jump to

Keyboard shortcuts

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