decorator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: MIT Imports: 10 Imported by: 268

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decorate

func Decorate(f *ast.File, fset *token.FileSet) *dst.File

func Fprint

func Fprint(w io.Writer, f *dst.File) error

func Parse

func Parse(src interface{}) (*dst.File, error)

func Print

func Print(f *dst.File) error

func Restore

func Restore(file *dst.File) (*ast.File, *token.FileSet)

func RestoreNamed

func RestoreNamed(name string, file *dst.File, fset *token.FileSet) *ast.File

Types

type CommentFragment

type CommentFragment struct {
	Text string
	Pos  token.Pos
}

func (CommentFragment) Position

func (v CommentFragment) Position() token.Pos

type DecorationFragment

type DecorationFragment struct {
	Node ast.Node
	Name string
	Pos  token.Pos
}

func (DecorationFragment) Position

func (v DecorationFragment) Position() token.Pos

type Fragger

type Fragger struct {
	Fragments []Fragment
	// contains filtered or unexported fields
}

func (*Fragger) AddComment

func (f *Fragger) AddComment(text string, pos token.Pos)

func (*Fragger) AddDecoration

func (f *Fragger) AddDecoration(n ast.Node, name string)

func (*Fragger) AddNewline

func (f *Fragger) AddNewline(pos token.Pos)

func (*Fragger) AddStart

func (f *Fragger) AddStart(n ast.Node, pos token.Pos)

func (*Fragger) AddString

func (f *Fragger) AddString(n ast.Node, s string, pos token.Pos)

func (*Fragger) AddToken

func (f *Fragger) AddToken(n ast.Node, t token.Token, pos token.Pos)

func (*Fragger) Fragment

func (f *Fragger) Fragment(file *ast.File, fset *token.FileSet)
func (f *Fragger) Link() map[ast.Node]map[string][]string

func (*Fragger) ProcessNode

func (f *Fragger) ProcessNode(n ast.Node)

type Fragment

type Fragment interface {
	Position() token.Pos
}

type NewlineFragment

type NewlineFragment struct {
	Pos token.Pos
}

func (NewlineFragment) Position

func (v NewlineFragment) Position() token.Pos

type StringFragment

type StringFragment struct {
	Node   ast.Node
	String string
	Pos    token.Pos
}

func (StringFragment) Position

func (v StringFragment) Position() token.Pos

type TokenFragment

type TokenFragment struct {
	Node  ast.Node
	Token token.Token
	Pos   token.Pos
}

func (TokenFragment) Position

func (v TokenFragment) Position() token.Pos

Jump to

Keyboard shortcuts

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