Documentation ¶
Overview ¶
Package grinder defines the API for individual grinding bits.
Index ¶
- Constants
- func BlockList(x ast.Node) []ast.Stmt
- func Diff(old, new string) []byte
- func GrindFuncDecls(ctxt *Context, pkg *Package, ...)
- func IsGotoTarget(blocks *block.Graph, x ast.Stmt) bool
- func IsTerminatingStmt(blocks *block.Graph, x ast.Stmt) bool
- func Unlabel(x ast.Stmt) ast.Stmt
- type Context
- type EditBuffer
- func (b *EditBuffer) Apply() string
- func (b *EditBuffer) BeforeComments(start token.Pos) token.Pos
- func (b *EditBuffer) CopyLine(startp, endp, insertp token.Pos)
- func (b *EditBuffer) Delete(startp, endp token.Pos)
- func (b *EditBuffer) DeleteLine(startp, endp token.Pos)
- func (b *EditBuffer) End(x ast.Node) token.Pos
- func (b *EditBuffer) Insert(p token.Pos, text string)
- func (b *EditBuffer) NumEdits() int
- func (b *EditBuffer) Replace(start, end token.Pos, text string)
- func (b *EditBuffer) TextAt(start, end token.Pos) string
- type Func
- type Package
Constants ¶
View Source
const ( Insert = 1 + iota Delete )
Variables ¶
This section is empty.
Functions ¶
func BlockList ¶
BlockList returns the list of statements contained by the block x, when x is an *ast.BlockStmt, *ast.CommClause, or *ast.CaseClause. Otherwise BlockList returns nil.
func GrindFuncDecls ¶
Types ¶
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) BeforeComments ¶
func (b *EditBuffer) BeforeComments(start token.Pos) token.Pos
BeforeComments rewinds start past any blank lines or line comments and return the result. It does not rewind past leading blank lines: the returned position, if changed, is always the start of a non-blank line.
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) End ¶
func (b *EditBuffer) End(x ast.Node) token.Pos
End returns x.End() except that it works around buggy results from the implementation of *ast.LabeledStmt and *ast.EmptyStmt. The node x must be located within b's source file. See golang.org/issue/9979.
func (*EditBuffer) NumEdits ¶
func (b *EditBuffer) NumEdits() int
Click to show internal directories.
Click to hide internal directories.