Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alignable ¶
type Alignable interface { Align() String() string }
Alignable is an interface that should implements Align() and String() method
type Chunk ¶
type Chunk struct { Type ChunkType // contains filtered or unexported fields }
Chunk struct represents a piece of expression token
type ChunkBuffer ¶
type ChunkBuffer struct {
// contains filtered or unexported fields
}
ChunkBuffer struct reperesents limited-line chunked string from configration.
func (*ChunkBuffer) ChunkedString ¶
func (c *ChunkBuffer) ChunkedString(level, offset int) string
Calculate line-chunked strings
func (*ChunkBuffer) Write ¶
func (c *ChunkBuffer) Write(s string, t ChunkType)
Write buffer to buffer with ChunkType
type ChunkState ¶
type ChunkState struct {
// contains filtered or unexported fields
}
ChunkState represents generating chunk strings
type Declaration ¶
type Declaration struct { Type DeclarationType Name string Buffer string }
type DeclarationType ¶
type DeclarationType int
DeclarationType represents formatted line name - can present on root scope
const ( Import DeclarationType = iota + 1 Include Acl Backend Director Table Penaltybox Ratecounter Subroutine )
type Declarations ¶
type Declarations []*Declaration
func (Declarations) Sort ¶
func (d Declarations) Sort()
type DelclarationPropertyLine ¶
type DelclarationPropertyLine struct { Key string Operator string Value string Leading string Trailing string Offset int EndCharacter string // contains filtered or unexported fields }
DelclarationPropertyLine represents a single line of declaration properties. This struct is used for acl, backend, director, and table properties
type DelclarationPropertyLines ¶
type DelclarationPropertyLines []*DelclarationPropertyLine
Type alias for slice of DelclarationPropertyLine
func (DelclarationPropertyLines) Align ¶
func (l DelclarationPropertyLines) Align()
Implement Alignable interface
func (DelclarationPropertyLines) AlignKey ¶
func (l DelclarationPropertyLines) AlignKey()
Declaration property name will be aligned from configuration so need to implement AlignKey() method to do it
func (DelclarationPropertyLines) Sort ¶
func (l DelclarationPropertyLines) Sort()
DelclarationPropertyLines could be sorted by name alphabetically
func (DelclarationPropertyLines) String ¶
func (l DelclarationPropertyLines) String() string
Implement Alignable interface
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter is struct for formatting input VCL.
type GroupedLines ¶
type GroupedLines struct { // Accept Alignable interface in order to append Lines or DelclarationPropertyLines Lines []Alignable }
GroupedLines represents grouped lines "grouped" means that lines are separated by empty line, for example:
set req.http.Foo = "bar"; // group 1 set req.http.Foo = "baz"; // group 1
set req.http.Bar = "bar"; // group 2 set req.http.Bar = "baz"; // group 2
These group should be aligned for each group.
func (*GroupedLines) Align ¶
func (g *GroupedLines) Align()
GroupedLines also satisfies Alignable interface
func (*GroupedLines) String ¶
func (g *GroupedLines) String() string
GroupedLines also satisfies Alignable interface