parse

package
v0.0.0-...-e270e03 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package parse contains the generic code generation capabilities that power genny.

genny gen "{types}"

gen - generates type specific code (to stdout) from generic code (via stdin)

{types}  - (required) Specific types for each generic type in the source
{types} format:  {generic}={specific}[,another][ {generic2}={specific2}]
Examples:
  Generic=Specific
  Generic1=Specific1 Generic2=Specific2
  Generic1=Specific1,Specific2 Generic2=Specific3,Specific4

Index

Constants

This section is empty.

Variables

View Source
var Builtins = []string{
	"bool",
	"byte",
	"complex128",
	"complex64",
	"error",
	"float32",
	"float64",
	"int",
	"int16",
	"int32",
	"int64",
	"int8",
	"rune",
	"string",
	"uint",
	"uint16",
	"uint32",
	"uint64",
	"uint8",
	"uintptr",
}

Builtins contains a slice of all built-in Go types.

View Source
var Numbers = []string{
	"float32",
	"float64",
	"int",
	"int16",
	"int32",
	"int64",
	"int8",
	"uint",
	"uint16",
	"uint32",
	"uint64",
	"uint8",
}

Numbers contains a slice of all built-in number types.

Functions

func Generics

func Generics(filename, pkgName string, in io.ReadSeeker, typeSets []map[string]string, importPaths []string) ([]byte, error)

Generics parses the source file and generates the bytes replacing the generic types for the keys map with the specific types (its value).

func TypeSet

func TypeSet(arg string) ([]map[string]string, error)

TypeSet turns a type string into a []map[string]string that can be given to parse.Generics for it to do its magic.

Acceptable args are:

Person=man
Person=man Animal=dog
Person=man Animal=dog Animal2=cat
Person=man,woman Animal=dog,cat
Person=man,woman,child Animal=dog,cat Place=london,paris
Place=London:city.London

Types

This section is empty.

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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