compiler

package
v0.0.0-...-82db1e9 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2017 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateProgramBootstrap

func GenerateProgramBootstrap(
	importsContext []*ast.ImportSpec,
	confNode *ast.GenDecl,
	varName string,
) (string, error)

GenerateProgramBootstrap generates the bootstrap program that handles the compilation of the templates from the source file imports and the configuration variable declaration ast.

func GenerateProgramBootstrapFromAstFile

func GenerateProgramBootstrapFromAstFile(
	parsedFile *ast.File,
	varName string,
) (string, error)

GenerateProgramBootstrapFromAstFile generates the bootstrap program that handles the compilation of the templates from a parsed go source.

func GenerateProgramBootstrapFromFile

func GenerateProgramBootstrapFromFile(
	file string,
	varName string,
) (string, error)

GenerateProgramBootstrapFromFile generates the bootstrap program that handles the compilation of the templates from a file path.

func GenerateProgramBootstrapFromString

func GenerateProgramBootstrapFromString(
	content string,
	varName string,
) (string, error)

GenerateProgramBootstrapFromString generates the bootstrap program that handles the compilation of the templates from a go code string.

func LookupPackageName

func LookupPackageName(someDir string) (string, error)

LookupPackageName search a directory for its declaring package.

func LookupPackageNameFromStr

func LookupPackageNameFromStr(gocode string) string

LookupPackageNameFromStr extract the declaring package from given go source string.

Types

type CompiledTemplatesProgram

type CompiledTemplatesProgram struct {
	// contains filtered or unexported fields
}

CompiledTemplatesProgram ...

func NewCompiledTemplatesProgram

func NewCompiledTemplatesProgram(varName string) *CompiledTemplatesProgram

NewCompiledTemplatesProgram prepare a new instance. it automatically adds io and template/parse packages, and declares static idents.

func (*CompiledTemplatesProgram) Compile

Compile the configuration, it returns a string of the output program.

func (*CompiledTemplatesProgram) CompileAndWrite

func (c *CompiledTemplatesProgram) CompileAndWrite(config *compiled.Configuration) error

CompileAndWrite the configuration and write the resulting program to config.OutPath.

type TemplateFileToCompile

type TemplateFileToCompile struct {
	// contains filtered or unexported fields
}

TemplateFileToCompile links a template file with all the templates defined in it.

type TemplateToCompile

type TemplateToCompile struct {
	*compiled.TemplateConfiguration
	// contains filtered or unexported fields
}

TemplateToCompile links a configuration and all the template files it matches.

Jump to

Keyboard shortcuts

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