Documentation
¶
Index ¶
- func Decorate(fset *token.FileSet, n ast.Node) dst.Node
- func DecorateFile(fset *token.FileSet, f *ast.File) *dst.File
- func Fprint(w io.Writer, f *dst.File) error
- func Parse(src interface{}) (*dst.File, error)
- func ParseDir(fset *token.FileSet, path string, filter func(os.FileInfo) bool, ...) (map[string]*dst.Package, error)
- func ParseExpr(x string) (dst.Expr, error)
- func ParseExprFrom(fset *token.FileSet, filename string, src interface{}, mode parser.Mode) (dst.Expr, error)
- func ParseFile(fset *token.FileSet, filename string, src interface{}, mode parser.Mode) (*dst.File, error)
- func Print(f *dst.File) error
- func Restore(file *dst.File) (*token.FileSet, *ast.File)
- type CommentFragment
- type DecorationFragment
- type Decorator
- type Fragger
- func (f *Fragger) AddComment(text string, pos token.Pos)
- func (f *Fragger) AddDecoration(n ast.Node, name string, pos token.Pos)
- func (f *Fragger) AddNewline(pos token.Pos, empty bool)
- func (f *Fragger) AddString(n ast.Node, s string, pos token.Pos)
- func (f *Fragger) AddToken(n ast.Node, t token.Token, pos token.Pos)
- func (f *Fragger) Fragment(fset *token.FileSet, node ast.Node)
- func (f *Fragger) Link() (space map[ast.Node]dst.SpaceType, decorations map[ast.Node]map[string][]string)
- func (f *Fragger) ProcessNode(n ast.Node)
- type Fragment
- type Info
- type NewlineFragment
- type Restorer
- type StringFragment
- type TokenFragment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseExprFrom ¶ added in v0.1.0
Types ¶
type CommentFragment ¶
type CommentFragment struct {
Text string
Pos token.Pos
Attached *DecorationFragment // where did we attach this comment in pass 1?
}
func (*CommentFragment) Position ¶
func (v *CommentFragment) Position() token.Pos
type DecorationFragment ¶
func (*DecorationFragment) Position ¶
func (v *DecorationFragment) Position() token.Pos
type Decorator ¶ added in v0.1.0
type Fragger ¶
type Fragger struct {
Fragments []Fragment
// contains filtered or unexported fields
}
func (*Fragger) AddDecoration ¶
func (*Fragger) ProcessNode ¶
type NewlineFragment ¶
type NewlineFragment struct {
Pos token.Pos
Empty bool // true if this newline is an empty line (e.g. follows a "//" comment or "\n")
Attached *DecorationFragment // where did we attach this comment in pass 1?
}
func (*NewlineFragment) Position ¶
func (v *NewlineFragment) Position() token.Pos
type Restorer ¶ added in v0.1.0
type Restorer struct {
Fset *token.FileSet
Nodes map[dst.Node]ast.Node
Objects map[*dst.Object]*ast.Object
Scopes map[*dst.Scope]*ast.Scope
}
func NewRestorer ¶ added in v0.1.0
func NewRestorer() *Restorer
type StringFragment ¶
func (*StringFragment) Position ¶
func (v *StringFragment) Position() token.Pos
Click to show internal directories.
Click to hide internal directories.