runtime

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 10 Imported by: 3

Documentation

Overview

Package runtime provide a runtime for the pipeline

Index

Constants

View Source
const (
	InNoSet = iota
	InWithoutMap
	InRMap
)
View Source
const (
	RegR0 = iota
	RegR1
	RegR2
	RegR3
	RegR4
	RegR5
)
View Source
const (
	PlRunInfoField = "pl_msg"
)

Variables

View Source
var DenormalizedGlobalPatterns map[string]*grok.GrokPattern = grok.CopyDenormalizedDefalutPatterns()

Functions

func CastToStringE

func CastToStringE(val any, dtype ast.DType) (string, error)

func CheckScript

func CheckScript(proc *Script, funcsCheck map[string]FuncCheck) *errchain.PlError

func Conv2String

func Conv2String(v any, dtype ast.DType) (string, error)

func NewRunError

func NewRunError(ctx *Context, err string, pos token.LnColPos) *errchain.PlError

func PutContext

func PutContext(ctx *Context)

func RefRunScript

func RefRunScript(ctx *Context, proc *Script) *errchain.PlError

func RunArithmeticExpr

func RunArithmeticExpr(ctx *Context, expr *ast.ArithmeticExpr) (any, ast.DType, *errchain.PlError)

func RunArithmeticExprCheck

func RunArithmeticExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ArithmeticExpr) *errchain.PlError

func RunAssignmentExpr

func RunAssignmentExpr(ctx *Context, expr *ast.AssignmentExpr) (any, ast.DType, *errchain.PlError)

func RunAssignmentExprCheck

func RunAssignmentExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.AssignmentExpr) *errchain.PlError

func RunAttrExprCheck

func RunAttrExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.AttrExpr) *errchain.PlError

func RunBreakStmt

func RunBreakStmt(ctx *Context, stmt *ast.BreakStmt) (any, ast.DType, *errchain.PlError)

func RunBreakStmtCheck

func RunBreakStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.BreakStmt) *errchain.PlError

func RunCallExpr

func RunCallExpr(ctx *Context, expr *ast.CallExpr) (any, ast.DType, *errchain.PlError)

func RunCallExprCheck

func RunCallExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.CallExpr) *errchain.PlError

func RunConditionExpr

func RunConditionExpr(ctx *Context, expr *ast.ConditionalExpr) (any, ast.DType, *errchain.PlError)

func RunConditionExprCheck

func RunConditionExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ConditionalExpr) *errchain.PlError

func RunContinueStmt

func RunContinueStmt(ctx *Context, stmt *ast.ContinueStmt) (any, ast.DType, *errchain.PlError)

func RunContinueStmtCheck

func RunContinueStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ContinueStmt) *errchain.PlError

func RunForInStmt

func RunForInStmt(ctx *Context, stmt *ast.ForInStmt) (any, ast.DType, *errchain.PlError)

func RunForInStmtCheck

func RunForInStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ForInStmt) *errchain.PlError

func RunForStmt

func RunForStmt(ctx *Context, stmt *ast.ForStmt) (any, ast.DType, *errchain.PlError)

func RunForStmtCheck

func RunForStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.ForStmt) *errchain.PlError

func RunIfElseStmt

func RunIfElseStmt(ctx *Context, stmt *ast.IfelseStmt) (any, ast.DType, *errchain.PlError)

func RunIfElseStmtCheck

func RunIfElseStmtCheck(ctx *Context, ctxCheck *ContextCheck, stmt *ast.IfelseStmt) *errchain.PlError

func RunInExpr added in v0.2.5

func RunInExpr(ctx *Context, expr *ast.InExpr) (any, ast.DType, *errchain.PlError)

func RunIndexExprGet

func RunIndexExprGet(ctx *Context, expr *ast.IndexExpr) (any, ast.DType, *errchain.PlError)

func RunIndexExprGetCheck

func RunIndexExprGetCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.IndexExpr) *errchain.PlError

func RunListInitExpr

func RunListInitExpr(ctx *Context, expr *ast.ListInitExpr) (any, ast.DType, *errchain.PlError)

func RunListInitExprCheck

func RunListInitExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ListInitExpr) *errchain.PlError

func RunMapInitExpr

func RunMapInitExpr(ctx *Context, expr *ast.MapInitExpr) (any, ast.DType, *errchain.PlError)

func RunMapInitExprCheck

func RunMapInitExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.MapInitExpr) *errchain.PlError

func RunParenExpr

func RunParenExpr(ctx *Context, expr *ast.ParenExpr) (any, ast.DType, *errchain.PlError)

func RunParenExprCheck

func RunParenExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.ParenExpr) *errchain.PlError

func RunScriptWithRMapIn

func RunScriptWithRMapIn(proc *Script, data InputWithRMap, signal Signal) *errchain.PlError

func RunScriptWithoutMapIn

func RunScriptWithoutMapIn(proc *Script, data InputWithoutMap, signal Signal) *errchain.PlError

func RunStmt

func RunStmt(ctx *Context, node *ast.Node) (any, ast.DType, *errchain.PlError)

RunStmt for all expr.

func RunStmtCheck

func RunStmtCheck(ctx *Context, ctxCheck *ContextCheck, node *ast.Node) *errchain.PlError

func RunStmts

func RunStmts(ctx *Context, nodes ast.Stmts) *errchain.PlError

func RunStmtsCheck

func RunStmtsCheck(ctx *Context, ctxCheck *ContextCheck, nodes ast.Stmts) *errchain.PlError

func RunUnaryExpr added in v0.2.6

func RunUnaryExpr(ctx *Context, expr *ast.UnaryExpr) (any, ast.DType, *errchain.PlError)

func RunUnaryExprCheck added in v0.2.8

func RunUnaryExprCheck(ctx *Context, ctxCheck *ContextCheck, expr *ast.UnaryExpr) *errchain.PlError

Types

type Context

type Context struct {
	Regs PlReg
	// contains filtered or unexported fields
}

func GetContext

func GetContext() *Context

func InitCtxForCheck

func InitCtxForCheck(ctx *Context, funcs map[string]FuncCall, funcsCheck map[string]FuncCheck,
	name, content string,
) *Context

func InitCtxWithRMap

func InitCtxWithRMap(ctx *Context, inWithRMap InputWithRMap, funcs map[string]FuncCall,
	callRef []*ast.CallExpr, signal Signal, name, content string,
) *Context

func InitCtxWithoutMap

func InitCtxWithoutMap(ctx *Context, inWithoutMap InputWithoutMap, funcs map[string]FuncCall,
	callRef []*ast.CallExpr, signal Signal, name, content string,
) *Context

func (*Context) GetFuncCall

func (ctx *Context) GetFuncCall(key string) (FuncCall, bool)

func (*Context) GetFuncCheck

func (ctx *Context) GetFuncCheck(key string) (FuncCheck, bool)

func (*Context) GetKey

func (ctx *Context) GetKey(key string) (*Varb, error)

func (*Context) GetKeyConv2Str

func (ctx *Context) GetKeyConv2Str(key string) (string, error)

func (*Context) GetPattern

func (ctx *Context) GetPattern(pattern string) (*grok.GrokPattern, bool)

func (*Context) InData

func (ctx *Context) InData() any

func (*Context) Name added in v0.2.1

func (ctx *Context) Name() string

func (*Context) ProcExit

func (ctx *Context) ProcExit() bool

func (*Context) SetCallRef

func (ctx *Context) SetCallRef(expr *ast.CallExpr)

func (*Context) SetExit

func (ctx *Context) SetExit()

func (*Context) SetPattern

func (ctx *Context) SetPattern(patternAlias string, gPattern *grok.GrokPattern)

func (*Context) SetVarb

func (ctx *Context) SetVarb(key string, value any, dtype ast.DType) error

func (*Context) Signal added in v0.2.7

func (ctx *Context) Signal() Signal

func (*Context) StackClear

func (ctx *Context) StackClear()

func (*Context) StackEnterNew

func (ctx *Context) StackEnterNew()

func (*Context) StackExitCur

func (ctx *Context) StackExitCur()

func (*Context) StmtRetrun

func (ctx *Context) StmtRetrun() bool

type ContextCheck

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

type FuncCall

type FuncCall func(*Context, *ast.CallExpr) *errchain.PlError

type FuncCheck

type FuncCheck func(*Context, *ast.CallExpr) *errchain.PlError

type InType

type InType uint8

type InputWithRMap

type InputWithRMap interface {
	Get(key string) (any, ast.DType, error)
}

type InputWithoutMap

type InputWithoutMap interface{}

type PlProcStack

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

func (*PlProcStack) Clear

func (stack *PlProcStack) Clear()

func (*PlProcStack) Get

func (stack *PlProcStack) Get(key string) (*Varb, error)

func (*PlProcStack) GetPattern

func (stack *PlProcStack) GetPattern(pattern string) (*grok.GrokPattern, bool)

func (*PlProcStack) Set

func (stack *PlProcStack) Set(key string, value any, dType ast.DType)

func (*PlProcStack) SetPattern

func (stack *PlProcStack) SetPattern(patternAlias string, grokPattern *grok.GrokPattern)

type PlReg

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

func (*PlReg) Count

func (reg *PlReg) Count() int

func (*PlReg) Get

func (reg *PlReg) Get(i PlRegRange) (any, ast.DType, error)

func (*PlReg) Reset

func (reg *PlReg) Reset()

func (*PlReg) ReturnAppend

func (reg *PlReg) ReturnAppend(val any, dtype ast.DType) bool

type PlRegRange

type PlRegRange uint

type Script

type Script struct {
	CallRef []*ast.CallExpr

	FuncCall map[string]FuncCall

	Name      string
	Namespace string
	Category  string
	FilePath  string

	Content string

	Ast ast.Stmts
}

type Signal

type Signal interface {
	ExitSignal() bool
}

type Varb

type Varb struct {
	Value any
	DType ast.DType
}

Jump to

Keyboard shortcuts

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