Documentation
¶
Index ¶
- type Config
- type Glob
- type GlobEx
- type Option
- type RecursiveConfigItem
- type RecursiveConfigKey
- type ResultCapturedCallback
- type SFFrame
- type SFI
- type SFVMOpCode
- type SyntaxFlowVirtualMachine
- func (s *SyntaxFlowVirtualMachine) Compile(text string) (ret error)
- func (s *SyntaxFlowVirtualMachine) Debug(i ...bool) *SyntaxFlowVirtualMachine
- func (s *SyntaxFlowVirtualMachine) Feed(i ValueOperator) *omap.OrderedMap[string, ValueOperator]
- func (s *SyntaxFlowVirtualMachine) ForEachFrame(h func(frame *SFFrame))
- func (s *SyntaxFlowVirtualMachine) Show()
- type SyntaxFlowVisitor
- func (v *SyntaxFlowVisitor) CreateFrame(vars *omap.OrderedMap[string, ValueOperator]) *SFFrame
- func (y *SyntaxFlowVisitor) EmitCheckStackTop()
- func (v *SyntaxFlowVisitor) EmitDuplicate()
- func (y *SyntaxFlowVisitor) EmitEnterStatement()
- func (v *SyntaxFlowVisitor) EmitEqual(i any)
- func (y *SyntaxFlowVisitor) EmitExitStatement()
- func (v *SyntaxFlowVisitor) EmitGetBottomUsers()
- func (v *SyntaxFlowVisitor) EmitGetBottomUsersWithConfig(config []*RecursiveConfigItem)
- func (v *SyntaxFlowVisitor) EmitGetCall()
- func (v *SyntaxFlowVisitor) EmitGetDefs()
- func (y *SyntaxFlowVisitor) EmitGetTopDef()
- func (v *SyntaxFlowVisitor) EmitGetTopDefs()
- func (v *SyntaxFlowVisitor) EmitGetTopDefsWithConfig(config []*RecursiveConfigItem)
- func (v *SyntaxFlowVisitor) EmitGetUsers()
- func (y *SyntaxFlowVisitor) EmitListIndex(i int)
- func (y *SyntaxFlowVisitor) EmitNewRef(i string)
- func (y *SyntaxFlowVisitor) EmitOperator(i string)
- func (v *SyntaxFlowVisitor) EmitPass()
- func (y *SyntaxFlowVisitor) EmitPop()
- func (v *SyntaxFlowVisitor) EmitPushAllCallArgs()
- func (v *SyntaxFlowVisitor) EmitPushCallArgs(i int)
- func (v *SyntaxFlowVisitor) EmitPushGlob(i string)
- func (v *SyntaxFlowVisitor) EmitPushInput()
- func (v *SyntaxFlowVisitor) EmitPushLiteral(i any)
- func (y *SyntaxFlowVisitor) EmitRegexpMatch(i string)
- func (v *SyntaxFlowVisitor) EmitSearchExact(isMember bool, i string)
- func (v *SyntaxFlowVisitor) EmitSearchGlob(isMember bool, i string)
- func (v *SyntaxFlowVisitor) EmitSearchRegexp(isMember bool, i string)
- func (y *SyntaxFlowVisitor) EmitUpdate(i string)
- func (y *SyntaxFlowVisitor) EnterFilterExpr() func()
- func (y *SyntaxFlowVisitor) FormatStringOrGlob(text string) (string, bool)
- func (v *SyntaxFlowVisitor) Show()
- func (y *SyntaxFlowVisitor) VisitActualParam(i sf.IActualParamContext) error
- func (y *SyntaxFlowVisitor) VisitChainFilter(raw sf.IChainFilterContext) interface{}
- func (y *SyntaxFlowVisitor) VisitConditionExpression(raw sf.IConditionExpressionContext) interface{}
- func (y *SyntaxFlowVisitor) VisitFilterExpr(raw sf.IFilterExprContext) error
- func (y *SyntaxFlowVisitor) VisitFilterStatement(raw sf.IFilterStatementContext) interface{}
- func (y *SyntaxFlowVisitor) VisitFilters(raw sf.IFiltersContext) interface{}
- func (y *SyntaxFlowVisitor) VisitFlow(raw sf.IFlowContext) interface{}
- func (y *SyntaxFlowVisitor) VisitNameFilter(isMember bool, i sf.INameFilterContext) error
- func (y *SyntaxFlowVisitor) VisitNumberLiteral(raw sf.INumberLiteralContext) int
- func (v *SyntaxFlowVisitor) VisitRecursiveConfig(i *sf.RecursiveConfigContext) []*RecursiveConfigItem
- func (y *SyntaxFlowVisitor) VisitRefVariable(raw sf.IRefVariableContext) string
- func (y *SyntaxFlowVisitor) VisitStringLiteral(raw sf.IStringLiteralContext) (string, bool)
- type ValueList
- func (v *ValueList) ExactMatch(isMember bool, s string) (bool, ValueOperator, error)
- func (v *ValueList) ForEach(h func(i any))
- func (v *ValueList) GetAllCallActualParams() (ValueOperator, error)
- func (v *ValueList) GetCallActualParams(i int) (ValueOperator, error)
- func (v *ValueList) GetCalled() (ValueOperator, error)
- func (v *ValueList) GetSyntaxFlowBottomUse(config ...*RecursiveConfigItem) (ValueOperator, error)
- func (v *ValueList) GetSyntaxFlowDef() (ValueOperator, error)
- func (v *ValueList) GetSyntaxFlowTopDef(config ...*RecursiveConfigItem) (ValueOperator, error)
- func (v *ValueList) GetSyntaxFlowUse() (ValueOperator, error)
- func (v *ValueList) GlobMatch(isMember bool, s Glob) (bool, ValueOperator, error)
- func (v *ValueList) IsList() bool
- func (v *ValueList) IsMap() bool
- func (v *ValueList) ListIndex(i int) (ValueOperator, error)
- func (v *ValueList) Recursive(f func(operator ValueOperator) error) error
- func (v *ValueList) RegexpMatch(isMember bool, regexp *regexp.Regexp) (bool, ValueOperator, error)
- func (v *ValueList) String() string
- type ValueOperator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v1.3.3
type Option func(*Config)
func WithEnableDebug ¶ added in v1.3.3
func WithInitialContextVars ¶ added in v1.3.3
func WithInitialContextVars(o *omap.OrderedMap[string, ValueOperator]) Option
func WithResultCaptured ¶ added in v1.3.3
func WithResultCaptured(c ResultCapturedCallback) Option
type RecursiveConfigItem ¶ added in v1.3.3
type RecursiveConfigKey ¶ added in v1.3.3
type RecursiveConfigKey string
const ( RecursiveConfig_Depth RecursiveConfigKey = "depth" RecursiveConfig_DepthMin RecursiveConfigKey = "depth_min" RecursiveConfig_DepthMax RecursiveConfigKey = "depth_max" RecursiveConfig_Exclude RecursiveConfigKey = "exclude" )
func FormatRecursiveConfigKey ¶ added in v1.3.3
func FormatRecursiveConfigKey(i string) RecursiveConfigKey
type ResultCapturedCallback ¶ added in v1.3.3
type ResultCapturedCallback func(name string, results ValueOperator) error
type SFFrame ¶
type SFFrame struct { Text string Codes []*SFI StatementStack *utils.Stack[int] // contains filtered or unexported fields }
func NewSFFrame ¶
func NewSFFrame(vars *omap.OrderedMap[string, ValueOperator], text string, codes []*SFI) *SFFrame
func (*SFFrame) GetSymbolTable ¶
func (s *SFFrame) GetSymbolTable() *omap.OrderedMap[string, ValueOperator]
type SFI ¶
type SFI struct { OpCode SFVMOpCode UnaryInt int UnaryStr string UnaryBool bool Desc string Values []string SyntaxFlowConfig []*RecursiveConfigItem }
type SFVMOpCode ¶
type SFVMOpCode int
const ( OpPass SFVMOpCode = iota // enter/exit statement OpEnterStatement OpExitStatement OpPushInput OpDuplicate // OpPushNumber and OpPushString and OpPushBool can push literal into stack OpPushNumber OpPushString OpPushBool OpPop // OpPushSearchExact can push data from origin OpPushSearchExact OpPushSearchGlob OpPushSearchRegexp OpGetCallArgs OpGetAllCallArgs // use def chain OpGetUsers OpGetBottomUsers OpGetDefs OpGetTopDefs // ListOperation OpListIndex // => variable OpNewRef OpUpdateRef /* Binary Operator Fetch TWO in STACK, calc result, push result into stack */ OpEq OpNotEq OpGt OpGtEq OpLt OpLtEq OpLogicAnd OpLogicOr OpLogicBang /* Unary Operator: Fetch ONE in STACK, calc result, push result into stack */ OpReMatch OpGlobMatch OpNot OpCheckStackTop )
type SyntaxFlowVirtualMachine ¶
type SyntaxFlowVirtualMachine struct {
// contains filtered or unexported fields
}
func NewSyntaxFlowVirtualMachine ¶
func NewSyntaxFlowVirtualMachine(opts ...Option) *SyntaxFlowVirtualMachine
func (*SyntaxFlowVirtualMachine) Compile ¶
func (s *SyntaxFlowVirtualMachine) Compile(text string) (ret error)
func (*SyntaxFlowVirtualMachine) Debug ¶
func (s *SyntaxFlowVirtualMachine) Debug(i ...bool) *SyntaxFlowVirtualMachine
func (*SyntaxFlowVirtualMachine) Feed ¶
func (s *SyntaxFlowVirtualMachine) Feed(i ValueOperator) *omap.OrderedMap[string, ValueOperator]
func (*SyntaxFlowVirtualMachine) ForEachFrame ¶ added in v1.3.3
func (s *SyntaxFlowVirtualMachine) ForEachFrame(h func(frame *SFFrame))
func (*SyntaxFlowVirtualMachine) Show ¶ added in v1.3.3
func (s *SyntaxFlowVirtualMachine) Show()
type SyntaxFlowVisitor ¶
type SyntaxFlowVisitor struct {
// contains filtered or unexported fields
}
func NewSyntaxFlowVisitor ¶
func NewSyntaxFlowVisitor() *SyntaxFlowVisitor
func (*SyntaxFlowVisitor) CreateFrame ¶
func (v *SyntaxFlowVisitor) CreateFrame(vars *omap.OrderedMap[string, ValueOperator]) *SFFrame
func (*SyntaxFlowVisitor) EmitCheckStackTop ¶
func (y *SyntaxFlowVisitor) EmitCheckStackTop()
func (*SyntaxFlowVisitor) EmitDuplicate ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitDuplicate()
func (*SyntaxFlowVisitor) EmitEnterStatement ¶ added in v1.3.3
func (y *SyntaxFlowVisitor) EmitEnterStatement()
func (*SyntaxFlowVisitor) EmitEqual ¶
func (v *SyntaxFlowVisitor) EmitEqual(i any)
func (*SyntaxFlowVisitor) EmitExitStatement ¶ added in v1.3.3
func (y *SyntaxFlowVisitor) EmitExitStatement()
func (*SyntaxFlowVisitor) EmitGetBottomUsers ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitGetBottomUsers()
func (*SyntaxFlowVisitor) EmitGetBottomUsersWithConfig ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitGetBottomUsersWithConfig(config []*RecursiveConfigItem)
func (*SyntaxFlowVisitor) EmitGetCall ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitGetCall()
func (*SyntaxFlowVisitor) EmitGetDefs ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitGetDefs()
func (*SyntaxFlowVisitor) EmitGetTopDef ¶ added in v1.3.3
func (y *SyntaxFlowVisitor) EmitGetTopDef()
func (*SyntaxFlowVisitor) EmitGetTopDefs ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitGetTopDefs()
func (*SyntaxFlowVisitor) EmitGetTopDefsWithConfig ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitGetTopDefsWithConfig(config []*RecursiveConfigItem)
func (*SyntaxFlowVisitor) EmitGetUsers ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitGetUsers()
func (*SyntaxFlowVisitor) EmitListIndex ¶ added in v1.3.3
func (y *SyntaxFlowVisitor) EmitListIndex(i int)
func (*SyntaxFlowVisitor) EmitNewRef ¶
func (y *SyntaxFlowVisitor) EmitNewRef(i string)
func (*SyntaxFlowVisitor) EmitOperator ¶
func (y *SyntaxFlowVisitor) EmitOperator(i string)
func (*SyntaxFlowVisitor) EmitPass ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitPass()
func (*SyntaxFlowVisitor) EmitPop ¶
func (y *SyntaxFlowVisitor) EmitPop()
func (*SyntaxFlowVisitor) EmitPushAllCallArgs ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitPushAllCallArgs()
func (*SyntaxFlowVisitor) EmitPushCallArgs ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitPushCallArgs(i int)
func (*SyntaxFlowVisitor) EmitPushGlob ¶
func (v *SyntaxFlowVisitor) EmitPushGlob(i string)
func (*SyntaxFlowVisitor) EmitPushInput ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitPushInput()
func (*SyntaxFlowVisitor) EmitPushLiteral ¶
func (v *SyntaxFlowVisitor) EmitPushLiteral(i any)
func (*SyntaxFlowVisitor) EmitRegexpMatch ¶
func (y *SyntaxFlowVisitor) EmitRegexpMatch(i string)
func (*SyntaxFlowVisitor) EmitSearchExact ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitSearchExact(isMember bool, i string)
func (*SyntaxFlowVisitor) EmitSearchGlob ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitSearchGlob(isMember bool, i string)
func (*SyntaxFlowVisitor) EmitSearchRegexp ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) EmitSearchRegexp(isMember bool, i string)
func (*SyntaxFlowVisitor) EmitUpdate ¶
func (y *SyntaxFlowVisitor) EmitUpdate(i string)
func (*SyntaxFlowVisitor) EnterFilterExpr ¶ added in v1.3.3
func (y *SyntaxFlowVisitor) EnterFilterExpr() func()
func (*SyntaxFlowVisitor) FormatStringOrGlob ¶
func (y *SyntaxFlowVisitor) FormatStringOrGlob(text string) (string, bool)
func (*SyntaxFlowVisitor) Show ¶
func (v *SyntaxFlowVisitor) Show()
func (*SyntaxFlowVisitor) VisitActualParam ¶ added in v1.3.3
func (y *SyntaxFlowVisitor) VisitActualParam(i sf.IActualParamContext) error
func (*SyntaxFlowVisitor) VisitChainFilter ¶
func (y *SyntaxFlowVisitor) VisitChainFilter(raw sf.IChainFilterContext) interface{}
func (*SyntaxFlowVisitor) VisitConditionExpression ¶
func (y *SyntaxFlowVisitor) VisitConditionExpression(raw sf.IConditionExpressionContext) interface{}
func (*SyntaxFlowVisitor) VisitFilterExpr ¶
func (y *SyntaxFlowVisitor) VisitFilterExpr(raw sf.IFilterExprContext) error
func (*SyntaxFlowVisitor) VisitFilterStatement ¶
func (y *SyntaxFlowVisitor) VisitFilterStatement(raw sf.IFilterStatementContext) interface{}
func (*SyntaxFlowVisitor) VisitFilters ¶
func (y *SyntaxFlowVisitor) VisitFilters(raw sf.IFiltersContext) interface{}
func (*SyntaxFlowVisitor) VisitFlow ¶
func (y *SyntaxFlowVisitor) VisitFlow(raw sf.IFlowContext) interface{}
func (*SyntaxFlowVisitor) VisitNameFilter ¶ added in v1.3.3
func (y *SyntaxFlowVisitor) VisitNameFilter(isMember bool, i sf.INameFilterContext) error
func (*SyntaxFlowVisitor) VisitNumberLiteral ¶
func (y *SyntaxFlowVisitor) VisitNumberLiteral(raw sf.INumberLiteralContext) int
func (*SyntaxFlowVisitor) VisitRecursiveConfig ¶ added in v1.3.3
func (v *SyntaxFlowVisitor) VisitRecursiveConfig(i *sf.RecursiveConfigContext) []*RecursiveConfigItem
func (*SyntaxFlowVisitor) VisitRefVariable ¶
func (y *SyntaxFlowVisitor) VisitRefVariable(raw sf.IRefVariableContext) string
func (*SyntaxFlowVisitor) VisitStringLiteral ¶
func (y *SyntaxFlowVisitor) VisitStringLiteral(raw sf.IStringLiteralContext) (string, bool)
type ValueList ¶ added in v1.3.3
type ValueList struct {
// contains filtered or unexported fields
}
func (*ValueList) ExactMatch ¶ added in v1.3.3
func (*ValueList) GetAllCallActualParams ¶ added in v1.3.3
func (v *ValueList) GetAllCallActualParams() (ValueOperator, error)
func (*ValueList) GetCallActualParams ¶ added in v1.3.3
func (v *ValueList) GetCallActualParams(i int) (ValueOperator, error)
func (*ValueList) GetCalled ¶ added in v1.3.3
func (v *ValueList) GetCalled() (ValueOperator, error)
func (*ValueList) GetSyntaxFlowBottomUse ¶ added in v1.3.3
func (v *ValueList) GetSyntaxFlowBottomUse(config ...*RecursiveConfigItem) (ValueOperator, error)
func (*ValueList) GetSyntaxFlowDef ¶ added in v1.3.3
func (v *ValueList) GetSyntaxFlowDef() (ValueOperator, error)
func (*ValueList) GetSyntaxFlowTopDef ¶ added in v1.3.3
func (v *ValueList) GetSyntaxFlowTopDef(config ...*RecursiveConfigItem) (ValueOperator, error)
func (*ValueList) GetSyntaxFlowUse ¶ added in v1.3.3
func (v *ValueList) GetSyntaxFlowUse() (ValueOperator, error)
func (*ValueList) ListIndex ¶ added in v1.3.3
func (v *ValueList) ListIndex(i int) (ValueOperator, error)
func (*ValueList) Recursive ¶ added in v1.3.3
func (v *ValueList) Recursive(f func(operator ValueOperator) error) error
func (*ValueList) RegexpMatch ¶ added in v1.3.3
type ValueOperator ¶ added in v1.3.3
type ValueOperator interface { String() string IsMap() bool IsList() bool // Recursive will execute with handler for every list or map Recursive(func(ValueOperator) error) error // ExactMatch return ops, for OpPushSearchExact ExactMatch(bool, string) (bool, ValueOperator, error) // GlobMatch return opts, for OpPushSearchGlob GlobMatch(bool, Glob) (bool, ValueOperator, error) // RegexpMatch for OpPushSearchRegexp RegexpMatch(bool, *regexp.Regexp) (bool, ValueOperator, error) // GetCallActualParams for OpGetCallArgs GetCalled() (ValueOperator, error) GetCallActualParams(int) (ValueOperator, error) GetAllCallActualParams() (ValueOperator, error) // GetTopDef and GetBottomUse is for OpBottomUse // use and def GetSyntaxFlowUse() (ValueOperator, error) GetSyntaxFlowDef() (ValueOperator, error) // top and bottom GetSyntaxFlowTopDef(...*RecursiveConfigItem) (ValueOperator, error) GetSyntaxFlowBottomUse(...*RecursiveConfigItem) (ValueOperator, error) // ListIndex for OpListIndex, like a[1] a must be list... ListIndex(i int) (ValueOperator, error) }
func AutoValue ¶ added in v1.3.3
func AutoValue(i any) ValueOperator
func MergeValues ¶ added in v1.3.3
func MergeValues(values ...ValueOperator) ValueOperator
func NewValues ¶ added in v1.3.3
func NewValues(values []ValueOperator) ValueOperator
Click to show internal directories.
Click to hide internal directories.