ast

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: BSD-3-Clause Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	NodeBase

	Exp    CmdExpect
	Cmd    string
	Args   []string
	Cmds   []*Cmd
	Bg     bool
	BgName string
}

type CmdExpect

type CmdExpect int
const (
	None CmdExpect = iota
	Pass
	Fail
	Skip
)

type Config

type Config struct {
	// Logger
	Logger   *zap.SugaredLogger
	LogLevel string

	// Filesystem
	FS billy.Filesystem
	// contains filtered or unexported fields
}

type File

type File struct {
	NodeBase

	// write out before the script starts
	Before bool
	// trim the end
	TrimEnd bool

	// normal file stuff
	Path  string
	Mode  os.FileMode
	Chown string

	// content markers
	BegContent int
	EndContent int
}

type Node

type Node interface {
	Clone() Node
	CloneNodeBase() NodeBase

	Script() *Script

	DocLine() int
	SetDocLine(int)
	BegLine() int
	SetBegLine(int)
	EndLine() int
	SetEndLine(int)

	String() string
	Name() string
	Comment() string
	AddComment(string)
}

type NodeBase

type NodeBase struct {
	// contains filtered or unexported fields
}

func (*NodeBase) AddComment

func (n *NodeBase) AddComment(c string)

func (*NodeBase) BegLine

func (n *NodeBase) BegLine() int

func (*NodeBase) Clone

func (n *NodeBase) Clone() Node

func (*NodeBase) CloneNodeBase

func (n *NodeBase) CloneNodeBase() NodeBase

func (*NodeBase) Comment

func (n *NodeBase) Comment() string

func (*NodeBase) DocLine

func (n *NodeBase) DocLine() int

func (*NodeBase) EndLine

func (n *NodeBase) EndLine() int

func (*NodeBase) Name

func (n *NodeBase) Name() string

func (*NodeBase) Script

func (n *NodeBase) Script() *Script

func (*NodeBase) SetBegLine

func (n *NodeBase) SetBegLine(i int)

func (*NodeBase) SetDocLine

func (n *NodeBase) SetDocLine(i int)

func (*NodeBase) SetEndLine

func (n *NodeBase) SetEndLine(i int)

func (*NodeBase) SetScript

func (n *NodeBase) SetScript(s *Script)

func (*NodeBase) String

func (n *NodeBase) String() string

type NodeResult

type NodeResult struct {
	NodeBase
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(config *Config) *Parser

func (*Parser) AppendNode

func (P *Parser) AppendNode(n Node)

func (*Parser) EOF

func (P *Parser) EOF() bool

func (*Parser) IncLine

func (P *Parser) IncLine()

func (*Parser) ParseScript

func (P *Parser) ParseScript(filepath string) (*Script, error)

type Phase

type Phase struct {
	NodeBase
	// contains filtered or unexported fields
}

func (*Phase) AppendNode

func (Ph *Phase) AppendNode(n Node)

type Script

type Script struct {
	Path    string
	Content string

	Help string
	Args []string

	Lines  []string
	Errors []error

	Phases []*Phase
	Files  map[string]*File
}

func (*Script) AddError

func (S *Script) AddError(e error)

func (*Script) AddFile

func (S *Script) AddFile(f *File)

func (*Script) AddPhase

func (S *Script) AddPhase(ph *Phase)

type ScriptError

type ScriptError struct {
	Message string
	Node    Node
	Err     error
}

func NewScriptError

func NewScriptError(msg string, node Node, err error) *ScriptError

func (*ScriptError) Error

func (e *ScriptError) Error() string

Jump to

Keyboard shortcuts

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