meta

package
v0.0.0-...-28775f4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package meta is used to bootstrap the code generator. That is it contains code which generates Go code that gets compiled together with the user design package. The result of that compilation is a tool which generates the final code or documentation consumed by the end-user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// Genfunc contains the name of the generator entry point function.
	// The function signature must be:
	//
	// func <Genfunc>([]dslengine.Root) ([]string, error)
	Genfunc string

	// Imports list the imports that are specific for that generator that
	// should be added to the main Go file.
	Imports []*codegen.ImportSpec

	// Flags is the list of flags to be used when invoking the final
	// generator on the command line.
	Flags map[string]string
}

Generator generates the code of, compiles and runs generators. This extra step is necessary to compile in the end user design package so that generator code can iterate through it.

func NewGenerator

func NewGenerator(genfunc string, imports []*codegen.ImportSpec, flags map[string]string) *Generator

NewGenerator returns a meta generator that can run an actual Generator given its factory method and command line flags.

func (*Generator) Generate

func (m *Generator) Generate() ([]string, error)

Generate compiles and runs the generator and returns the generated filenames.

Jump to

Keyboard shortcuts

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