grinder

package
v0.0.0-...-801db2e Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2015 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package grinder defines the API for individual grinding bits.

Index

Constants

View Source
const (
	Insert = 1 + iota
	Delete
)

Variables

This section is empty.

Functions

func Diff

func Diff(old, new string) []byte

func GrindFuncDecls

func GrindFuncDecls(ctxt *Context, pkg *Package, fn func(ctxt *Context, pkg *Package, edit *EditBuffer, decl *ast.FuncDecl))

Types

type Context

type Context struct {
	Logf     func(format string, args ...interface{})
	Errors   bool
	Grinders []Func
}

func (*Context) Errorf

func (ctxt *Context) Errorf(format string, args ...interface{})

func (*Context) GrindFiles

func (ctxt *Context) GrindFiles(files ...string) *Package

func (*Context) GrindPackage

func (ctxt *Context) GrindPackage(path string) *Package

type EditBuffer

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

func NewEditBuffer

func NewEditBuffer(pkg *Package, filename string, f *ast.File) *EditBuffer

func (*EditBuffer) Apply

func (b *EditBuffer) Apply() string

func (*EditBuffer) CopyLine

func (b *EditBuffer) CopyLine(startp, endp, insertp token.Pos)

func (*EditBuffer) Delete

func (b *EditBuffer) Delete(startp, endp token.Pos)

func (*EditBuffer) DeleteLine

func (b *EditBuffer) DeleteLine(startp, endp token.Pos)

func (*EditBuffer) Insert

func (b *EditBuffer) Insert(p token.Pos, text string)

func (*EditBuffer) NumEdits

func (b *EditBuffer) NumEdits() int

func (*EditBuffer) TextAt

func (b *EditBuffer) TextAt(start, end token.Pos) string

type Func

type Func func(*Context, *Package)

type Package

type Package struct {
	ImportPath string
	Files      []*ast.File
	Filenames  []string
	FileSet    *token.FileSet
	Types      *types.Package
	Info       types.Info
	// contains filtered or unexported fields
}

func (*Package) Modified

func (p *Package) Modified(name string) bool

func (*Package) OrigSrc

func (p *Package) OrigSrc(name string) string

func (*Package) Rewrite

func (p *Package) Rewrite(name, content string)

func (*Package) Src

func (p *Package) Src(name string) string

Jump to

Keyboard shortcuts

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