meta

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MIT Imports: 11 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

	// CustomFlags is the list of arguments that appear after the -- separator.
	// These arguments are appended verbatim to the final generator command line.
	CustomFlags []string

	// OutDir is the final output directory.
	OutDir string

	// DesignPkgPath is the Go import path to the design package.
	DesignPkgPath string
	// contains filtered or unexported fields
}

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, customflags []string) (*Generator, error)

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