fmt

package
v0.0.0-...-016edcc Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CommentSkipFile = "heph:fmt skip-file"
View Source
const ListMaxCombinedLength = 50
View Source
const ListMaxElemLength = 50
View Source
const ListMaxLineLength = 100

Variables

View Source
var ErrSkip = errors.New("skip file")

Functions

func Fmt

func Fmt(path string, src io.Reader, cfg Config) (string, error)

Types

type Builder

type Builder struct {
	strings.Builder
	// contains filtered or unexported fields
}

func (*Builder) LineLength

func (w *Builder) LineLength() int

func (*Builder) WriteString

func (w *Builder) WriteString(s string)

func (*Builder) WriteStringRaw

func (w *Builder) WriteStringRaw(s string)

type Config

type Config struct {
	IndentSize int
}

type IfCond

type IfCond struct {
	Cond syntax.Expr
	True []syntax.Stmt
	// contains filtered or unexported fields
}

func (*IfCond) AllocComments

func (e *IfCond) AllocComments()

func (*IfCond) Comments

func (e *IfCond) Comments() *syntax.Comments

func (*IfCond) Span

func (e *IfCond) Span() (start, end syntax.Position)

type IfStmt

type IfStmt struct {
	Ifs   []*IfCond
	False []syntax.Stmt
	// contains filtered or unexported fields
}

func (*IfStmt) AllocComments

func (s *IfStmt) AllocComments()

func (*IfStmt) Comments

func (s *IfStmt) Comments() *syntax.Comments

func (*IfStmt) Span

func (s *IfStmt) Span() (start, end syntax.Position)

type ListComsExpr

type ListComsExpr struct {
	syntax.Expr
	LastComs []syntax.Comment
}

type Node

type Node interface {
	Span() (start, end syntax.Position)
	Comments() *syntax.Comments
	AllocComments()
}

Node Allow for custom type, copy of syntax.Node

type Writer

type Writer interface {
	fmt.Stringer
	WriteString(s string)
	WriteStringRaw(s string)
	Len() int
	LineLength() int
}

Jump to

Keyboard shortcuts

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