Documentation ¶
Index ¶
- Constants
- func Run(scr *Script) error
- type BlockType
- type ComparisonType
- type ExpressionType
- type Script
- type ScriptBlock
- func (b *ScriptBlock) Blocks() []*ScriptBlock
- func (b *ScriptBlock) Condition() *ScriptCase
- func (b *ScriptBlock) ExecuteCounter() int
- func (b *ScriptBlock) Expressions() []*ScriptExpression
- func (b *ScriptBlock) SetExecuteCounter(i int)
- func (b *ScriptBlock) SetVariable(n, v string) *ScriptBlock
- func (b *ScriptBlock) Stop(stop bool)
- func (b *ScriptBlock) Stopped() bool
- func (b *ScriptBlock) String() string
- type ScriptCase
- type ScriptExpression
Constants ¶
const ( CommentPrefix = "#" BodyExprSep = ";" VarPrefix = "@" // Keywords. TrueKeyword = "true" EchoKeyword = "echo" WaitKeyword = "wait" RawdisKeyword = "rawdis" OutKeyword = "out" EndKeyword = "end" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ComparisonType ¶
type ComparisonType int
Type for script case types.
const ( Greater ComparisonType = iota Equal Less Dif For True )
type ExpressionType ¶
type ExpressionType int
const ( Expr ExpressionType = iota EchoMacro WaitMacro EndMacro )
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
Struct for Ash script.
func NewScript ¶
NewScript creates new Ash script from specified text, returns error in case of syntax error.
func (*Script) Blocks ¶
func (s *Script) Blocks() []*ScriptBlock
Blocks returns script blocks with expressions.
type ScriptBlock ¶
type ScriptBlock struct {
// contains filtered or unexported fields
}
Struct for script expression block.
func (*ScriptBlock) Blocks ¶
func (b *ScriptBlock) Blocks() []*ScriptBlock
Blocks returns all inner blocks.
func (*ScriptBlock) Condition ¶
func (b *ScriptBlock) Condition() *ScriptCase
Conditon returns block condition case.
func (*ScriptBlock) ExecuteCounter ¶
func (b *ScriptBlock) ExecuteCounter() int
ExecuteCounter returns block execute counter.
func (*ScriptBlock) Expressions ¶
func (b *ScriptBlock) Expressions() []*ScriptExpression
Expressions returns all expression within block.
func (*ScriptBlock) SetExecuteCounter ¶
func (b *ScriptBlock) SetExecuteCounter(i int)
SetExecuteCounter sets specified number as value of block execute counter.
func (*ScriptBlock) SetVariable ¶
func (b *ScriptBlock) SetVariable(n, v string) *ScriptBlock
SetVariable sets variable with specified name and value for block expressions.
func (*ScriptBlock) Stopped ¶
func (b *ScriptBlock) Stopped() bool
Stopped checks if block was stopped.
type ScriptCase ¶
type ScriptCase struct {
// contains filtered or unexported fields
}
Struct for script case.
func (*ScriptCase) CorrectRes ¶
func (c *ScriptCase) CorrectRes(r string) (bool, error)
CorrectRes checks if specified result value is correct.
func (*ScriptCase) Expression ¶
func (c *ScriptCase) Expression() burn.Expression
Expression returns case expression.
type ScriptExpression ¶
type ScriptExpression struct {
// contains filtered or unexported fields
}
Struct for script expressions.
func NewEchoMacro ¶
func NewEchoMacro(text string, expr burn.Expression) *ScriptExpression
NewEchoMacro returns new script expression for echo macro.
func NewEndMacro ¶
func NewEndMacro() *ScriptExpression
NewEndMacro returns new script expression for end macro.
func NewExpression ¶
func NewExpression(expr burn.Expression) *ScriptExpression
NewExpression returns new script expression for specified burn expression.
func NewWaitMacro ¶
func NewWaitMacro(millis int64) *ScriptExpression
NewWaitMacro returns new script expression for wait macro.
func (*ScriptExpression) BurnExpr ¶
func (se *ScriptExpression) BurnExpr() burn.Expression
BurnExpr returns burn expression or empty struct if there is no burn expression in this script expression.
func (*ScriptExpression) Type ¶
func (se *ScriptExpression) Type() ExpressionType
Type returns expression type.
func (*ScriptExpression) WaitTime ¶
func (se *ScriptExpression) WaitTime() int64
WaitMillis returns number of milliseconds to wait before expression execution.