broodmother

package module
v0.0.0-...-7394fd0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

README

broodmother

Broodmother

A general solution for code generation.

For centuries, Black Arachnia the Broodmother lurked in the dark lava tubes beneath the smoldering caldera of Mount Pyrotheos, raising millions of spiderlings in safety before sending them to find prey in the wide world above. In a later age, the Vizier of Greed, Ptholopthales, erected his lodestone ziggurat on the slopes of the dead volcano, knowing that any looters who sought his magnetic wealth must survive the spider-haunted passages. After millennia of maternal peace, Black Arachnia found herself beset by a steady trickle of furfeet and cutpurses, bold knights and noble youths--all of them delicious, certainly, and yet tending to create a less than nurturing environment for her innocent offspring. Tiring of the intrusions, she paid a visit to Ptholopthales; and when he proved unwilling to discuss a compromise, she wrapped the Vizier in silk and set him aside to be the centerpiece of a special birthday feast. Unfortunately, the absence of the Magnetic Ziggurat's master merely emboldened a new generation of intruders. When one of her newborns was trodden underfoot by a clumsy adventurer, she reached the end of her silken rope. Broodmother headed for the surface, declaring her intent to rid the world of each and every possible invader, down to the last Hero if necessary, until she could ensure her nursery might once more be a safe and wholesome environment for her precious spiderspawn.

Getting Started

You can go get project as usual (NOTE: you might want to start your VPN stuff.):

$ go get gitlab.com/Hu13er/broodmother

Use test and build commands to test and compile the project:

$ cd $GOPATH/src/Hu13er/broodmother
$ go test ./...
$ go build -o broodmother ./cmd

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Some Singletons
	FilterAll     = FilterFunc(func(Context, ast.Node) bool { return false })
	FilterNothing = FilterFunc(func(Context, ast.Node) bool { return true })
)
View Source
var (
	TagsPrefix = "+bm:"
)

Functions

func CamelCase

func CamelCase(snake string, first bool) string

func Comment

func Comment(node ast.Node) *ast.CommentGroup

func Document

func Document(node ast.Node) *ast.CommentGroup

func GetPackage

func GetPackage(p string) (pkgName, importPath string, err error)

func JoinCamel

func JoinCamel(name ...string) string

func NthString

func NthString(n int) string

func ParseCommentGroupTags

func ParseCommentGroupTags(cg *ast.CommentGroup) map[string]string

func ParseCommentTags

func ParseCommentTags(node ast.Node) map[string]string

func ParseDocumentTags

func ParseDocumentTags(node ast.Node) map[string]string

func SnakeCase

func SnakeCase(camel string) string

Types

type Context

type Context interface {
	Global() Context
	Parent() Context

	Imports() map[string]string
	Package() string
	Path() string

	Get(key interface{}) (interface{}, bool)
	Set(key, value interface{})
}

type Executor

type Executor struct {
	Generators []Generator
}

func (*Executor) ParseFile

func (e *Executor) ParseFile(path string) error

type File

type File struct {
	Path    string
	Content string
}

type FilterAny

type FilterAny []Filterer

func (FilterAny) Allowed

func (fa FilterAny) Allowed(ctx Context, node ast.Node) bool

type FilterFunc

type FilterFunc func(ctx Context, node ast.Node) bool

func (FilterFunc) Allowed

func (f FilterFunc) Allowed(ctx Context, node ast.Node) bool

type FilterList

type FilterList []Filterer

func (FilterList) Allowed

func (fl FilterList) Allowed(ctx Context, node ast.Node) bool

type FilterTags

type FilterTags []string

func (FilterTags) Allowed

func (tf FilterTags) Allowed(ctx Context, node ast.Node) bool

type Filterer

type Filterer interface {
	Allowed(ctx Context, node ast.Node) bool
}

type Finalezer

type Finalezer interface {
	Finalize(Context) ([]File, error)
}

type Generator

type Generator interface {
	Name() string
	Filter() Filterer
	Visit(Context, ast.Node) (bool, error)
}

type Tag

type Tag string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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