sfvm

package
v1.3.6-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompareStringAnyMode  int = 0
	CompareStringHaveMode     = 1
)
View Source
const (
	RecursiveConfig_NULL     RecursiveConfigKey = ""
	RecursiveConfig_Depth                       = "depth"
	RecursiveConfig_DepthMin                    = "depth_min"
	RecursiveConfig_DepthMax                    = "depth_max"
	// RecursiveConfig_Exclude 在匹配到不符合配置项的Value后,数据流继续流动,以匹配其它Value。
	RecursiveConfig_Exclude = "exclude"
	// RecursiveConfig_Include 在匹配到符合配置项的Value后,数据流继续流动,以匹配其它Value。
	RecursiveConfig_Include = "include"
	// RecursiveConfig_Until 会沿着数据流匹配每个Value,知道匹配到符合配置项的Value的时候,数据流停止流动。
	RecursiveConfig_Until = "until"
	// RecursiveConfig_Hook 会对匹配到的每个Value执行配置项的sfRule,但是不会影响最终结果,其数据流会持续流动。
	RecursiveConfig_Hook = "hook"
	// un-used now
	RecursiveConfig_Filter = "filter"
)
View Source
const (
	NameMatch int = 1
	KeyMatch      = 1 << 1
	BothMatch     = NameMatch | KeyMatch
)

type MatchMode int

Variables

View Source
var CriticalError = utils.Error("CriticalError(Immediately Abort)")

Functions

func MatchModeString

func MatchModeString(mode int) string

func RegisterNativeCall

func RegisterNativeCall(name string, f NativeCallFunc)

Types

type AnalysisContext

type AnalysisContext struct {
	Step  int
	Label string
}

func NewDefaultAnalysisContext

func NewDefaultAnalysisContext() *AnalysisContext

type AnalysisContextOption

type AnalysisContextOption func(*AnalysisContext)

func WithAnalysisContext_Label

func WithAnalysisContext_Label(label string) AnalysisContextOption

func WithAnalysisContext_Step

func WithAnalysisContext_Step(step int) AnalysisContextOption

type Config added in v1.3.3

type Config struct {
	StrictMatch bool
	FailFast    bool
	// contains filtered or unexported fields
}

func NewConfig added in v1.3.3

func NewConfig(opts ...Option) *Config

type IterContext

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

type NativeCallActualParams

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

func NewNativeCallActualParams

func NewNativeCallActualParams(items ...*RecursiveConfigItem) *NativeCallActualParams

func (*NativeCallActualParams) Existed

func (n *NativeCallActualParams) Existed(index any) bool

func (*NativeCallActualParams) GetInt

func (n *NativeCallActualParams) GetInt(index any, extra ...any) int

func (*NativeCallActualParams) GetString

func (n *NativeCallActualParams) GetString(index any, extra ...any) string

type NativeCallFunc

type NativeCallFunc func(v ValueOperator, frame *SFFrame, params *NativeCallActualParams) (bool, ValueOperator, error)

func GetNativeCall

func GetNativeCall(name string) (NativeCallFunc, error)

type Option added in v1.3.3

type Option func(*Config)

func WithEnableDebug added in v1.3.3

func WithEnableDebug(b ...bool) Option

func WithFailFast

func WithFailFast(b ...bool) Option

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

func WithStrictMatch

func WithStrictMatch(b bool) Option

type RecursiveConfigItem added in v1.3.3

type RecursiveConfigItem struct {
	Key            string
	Value          string
	SyntaxFlowRule bool
}

type RecursiveConfigKey added in v1.3.3

type RecursiveConfigKey string

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 {
	Title         string
	Description   string
	AllowIncluded string
	Purpose       string
	Language      string
	Severity      string
	VerifyFs      map[string]string
	NegativeFs    map[string]string
	ExtraDesc     map[string]string

	Text  string
	Codes []*SFI
	// contains filtered or unexported fields
}

func NewSFFrame

func NewSFFrame(vars *omap.OrderedMap[string, ValueOperator], text string, codes []*SFI) *SFFrame

func (*SFFrame) ExtractNegativeFilesystemAndLanguage

func (s *SFFrame) ExtractNegativeFilesystemAndLanguage() (consts.Language, filesys_interface.FileSystem, error)

func (*SFFrame) ExtractVerifyFilesystemAndLanguage

func (s *SFFrame) ExtractVerifyFilesystemAndLanguage() (consts.Language, filesys_interface.FileSystem, error)

func (*SFFrame) Feed

func (frame *SFFrame) Feed(i ValueOperator) (*SFFrameResult, error)

func (*SFFrame) Flush

func (s *SFFrame) Flush()

func (*SFFrame) GetConfig

func (s *SFFrame) GetConfig() *Config

func (*SFFrame) GetExtraInfo

func (s *SFFrame) GetExtraInfo(key string, backup ...string) string

func (*SFFrame) GetExtraInfoInt

func (s *SFFrame) GetExtraInfoInt(key string, backup ...string) int

func (*SFFrame) GetSFResult

func (s *SFFrame) GetSFResult() (*SFFrameResult, error)

func (*SFFrame) GetSymbol

func (s *SFFrame) GetSymbol(sfi *SFI) (ValueOperator, bool)

func (*SFFrame) GetSymbolTable

func (s *SFFrame) GetSymbolTable() *omap.OrderedMap[string, ValueOperator]

func (*SFFrame) GetVM

func (s *SFFrame) GetVM() *SyntaxFlowVirtualMachine

func (*SFFrame) SetSFResult

func (s *SFFrame) SetSFResult(sfResult *SFFrameResult)

func (*SFFrame) Show

func (f *SFFrame) Show()

func (*SFFrame) ToLeft

func (s *SFFrame) ToLeft() bool

func (*SFFrame) ToRight

func (s *SFFrame) ToRight() bool

func (*SFFrame) WithContext

func (s *SFFrame) WithContext(result *SFFrameResult)

func (*SFFrame) WithPredecessorContext

func (s *SFFrame) WithPredecessorContext(label string) AnalysisContextOption

type SFFrameResult

type SFFrameResult struct {
	// base info
	Rule string
	// additional info
	Description *omap.OrderedMap[string, string]
	CheckParams []string
	Errors      []string
	// value
	SymbolTable      *omap.OrderedMap[string, ValueOperator]
	UnNameValue      []ValueOperator
	AlertSymbolTable map[string]ValueOperator
	AlertMsgTable    map[string]string
}

func NewSFResult

func NewSFResult(rule string) *SFFrameResult

func (*SFFrameResult) Copy

func (s *SFFrameResult) Copy() *SFFrameResult

func (*SFFrameResult) GetDescription

func (s *SFFrameResult) GetDescription() string

func (*SFFrameResult) MergeByResult

func (s *SFFrameResult) MergeByResult(result *SFFrameResult)

func (*SFFrameResult) Name

func (s *SFFrameResult) Name() string

func (*SFFrameResult) Show

func (s *SFFrameResult) Show(opts ...ShowHandle)

func (*SFFrameResult) String

func (s *SFFrameResult) String(opts ...ShowHandle) string

type SFI

type SFI struct {
	OpCode               SFVMOpCode
	UnaryInt             int
	UnaryStr             string
	Desc                 string
	Values               []string
	SyntaxFlowConfig     []*RecursiveConfigItem
	FileFilterMethodItem map[string]string
	// contains filtered or unexported fields
}

func (*SFI) IsIterOpcode

func (s *SFI) IsIterOpcode() bool

func (*SFI) String

func (s *SFI) String() string

func (*SFI) ValueByIndex

func (s *SFI) ValueByIndex(i int) string

type SFVMOpCode

type SFVMOpCode int
const (
	OpPass SFVMOpCode = iota

	// enter/exit statement
	OpEnterStatement
	OpExitStatement

	// duplicate the top of stack
	OpDuplicate

	// OpPushSearchExact can push data from origin
	OpPushSearchExact
	OpPushSearchGlob
	OpPushSearchRegexp

	// OpRecursive... can fetch origin value (not program) push data from origin
	OpRecursiveSearchExact
	OpRecursiveSearchGlob
	OpRecursiveSearchRegexp

	// handle function call
	OpGetCall
	OpGetCallArgs
	OpGetAllCallArgs

	// use def chain
	OpGetUsers
	OpGetBottomUsers
	OpGetDefs
	OpGetTopDefs

	// ListOperation
	OpListIndex

	// => variable
	OpNewRef
	OpUpdateRef

	// OpPushNumber and OpPushString and OpPushBool can push literal into stack
	OpPushNumber
	OpPushString
	OpPushBool
	OpPop

	// Condition
	// use the []bool  && []Value of stack top, push result into stack
	OpCondition
	OpCompareOpcode
	OpCompareString

	/*
		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

	OpAlert // echo variable

	// OpCheckParams check the params in vm context
	// if not match, record error
	// matched, use 'then expr' (if exists)
	OpCheckParams

	// OpAddDescription add description to current context
	OpAddDescription

	// OpCreateIter will create iterator for current context
	// the context contains origin values(list) and channel for elements
	OpCreateIter
	// OpIterNext will get next value from iterator
	// if the channel from iter context has a next element, push into stack and execute filter
	// if not, exit
	OpIterNext
	OpIterEnd

	OpCheckStackTop // check the top of stack, if empty, push input into stack

	// OpFilterExprEnter will assert the top of stack, make sure a input
	OpFilterExprEnter
	OpFilterExprExit

	OpMergeRef
	OpRemoveRef
	OpIntersectionRef

	OpNativeCall

	//fileFilter
	OpFileFilterReg
	OpFileFilterXpath
	OpFileFilterJsonPath
)

type ShowHandle

type ShowHandle func(config *showConfig)

func WithShowAll

func WithShowAll(show bool) ShowHandle

func WithShowCode

func WithShowCode(show bool) ShowHandle

func WithShowDot

func WithShowDot(show bool) ShowHandle

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) (frame *SFFrame, ret error)

func (*SyntaxFlowVirtualMachine) Debug

func (*SyntaxFlowVirtualMachine) Feed

func (*SyntaxFlowVirtualMachine) ForEachFrame added in v1.3.3

func (s *SyntaxFlowVirtualMachine) ForEachFrame(h func(frame *SFFrame))

func (*SyntaxFlowVirtualMachine) GetConfig

func (s *SyntaxFlowVirtualMachine) GetConfig() *Config

func (*SyntaxFlowVirtualMachine) SetConfig

func (s *SyntaxFlowVirtualMachine) SetConfig(config *Config)

func (*SyntaxFlowVirtualMachine) Show added in v1.3.3

func (s *SyntaxFlowVirtualMachine) Show()

func (*SyntaxFlowVirtualMachine) Snapshot

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) EmitAddDescription

func (y *SyntaxFlowVisitor) EmitAddDescription(key string, value string)

func (*SyntaxFlowVisitor) EmitAlert

func (y *SyntaxFlowVisitor) EmitAlert(ref string, value string)

func (*SyntaxFlowVisitor) EmitCheckParam

func (y *SyntaxFlowVisitor) EmitCheckParam(ref string, then string, elseString string)

func (*SyntaxFlowVisitor) EmitCheckStackTop

func (y *SyntaxFlowVisitor) EmitCheckStackTop()

func (*SyntaxFlowVisitor) EmitCompareOpcode

func (v *SyntaxFlowVisitor) EmitCompareOpcode(i []string)

func (*SyntaxFlowVisitor) EmitCompareString

func (v *SyntaxFlowVisitor) EmitCompareString(i []string, mode int)

func (*SyntaxFlowVisitor) EmitCondition

func (v *SyntaxFlowVisitor) EmitCondition()

func (*SyntaxFlowVisitor) EmitCreateIterator

func (v *SyntaxFlowVisitor) EmitCreateIterator() *IterContext

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) EmitFileFilterJsonPath

func (y *SyntaxFlowVisitor) EmitFileFilterJsonPath(i string, m map[string]string, s []string)

func (*SyntaxFlowVisitor) EmitFileFilterReg

func (y *SyntaxFlowVisitor) EmitFileFilterReg(i string, m map[string]string, s []string)

func (*SyntaxFlowVisitor) EmitFileFilterXpath

func (y *SyntaxFlowVisitor) EmitFileFilterXpath(i string, m map[string]string, s []string)

func (*SyntaxFlowVisitor) EmitFilterExprEnter

func (y *SyntaxFlowVisitor) EmitFilterExprEnter() *SFI

func (*SyntaxFlowVisitor) EmitFilterExprExit

func (y *SyntaxFlowVisitor) EmitFilterExprExit(c *SFI)

func (*SyntaxFlowVisitor) EmitGetBottomUsers added in v1.3.3

func (v *SyntaxFlowVisitor) EmitGetBottomUsers(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) EmitGetTopDefs added in v1.3.3

func (v *SyntaxFlowVisitor) EmitGetTopDefs(config ...*RecursiveConfigItem)

func (*SyntaxFlowVisitor) EmitGetUsers added in v1.3.3

func (v *SyntaxFlowVisitor) EmitGetUsers()

func (*SyntaxFlowVisitor) EmitIntersectionRef

func (y *SyntaxFlowVisitor) EmitIntersectionRef(i string)

func (*SyntaxFlowVisitor) EmitIterEnd

func (v *SyntaxFlowVisitor) EmitIterEnd(i *IterContext)

func (*SyntaxFlowVisitor) EmitListIndex added in v1.3.3

func (y *SyntaxFlowVisitor) EmitListIndex(i int)

func (*SyntaxFlowVisitor) EmitMergeRef

func (y *SyntaxFlowVisitor) EmitMergeRef(i string)

func (*SyntaxFlowVisitor) EmitNativeCall

func (y *SyntaxFlowVisitor) EmitNativeCall(i string, results ...*RecursiveConfigItem)

func (*SyntaxFlowVisitor) EmitNewRef

func (y *SyntaxFlowVisitor) EmitNewRef(i string)

func (*SyntaxFlowVisitor) EmitNextIterator

func (v *SyntaxFlowVisitor) EmitNextIterator(i *IterContext)

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) EmitPushLiteral

func (v *SyntaxFlowVisitor) EmitPushLiteral(i any)

func (*SyntaxFlowVisitor) EmitRecursiveSearchExact

func (v *SyntaxFlowVisitor) EmitRecursiveSearchExact(mod int, i string) *SFI

func (*SyntaxFlowVisitor) EmitRecursiveSearchGlob

func (v *SyntaxFlowVisitor) EmitRecursiveSearchGlob(mod int, i string) *SFI

func (*SyntaxFlowVisitor) EmitRecursiveSearchRegexp

func (v *SyntaxFlowVisitor) EmitRecursiveSearchRegexp(mod int, i string) *SFI

func (*SyntaxFlowVisitor) EmitRegexpMatch

func (y *SyntaxFlowVisitor) EmitRegexpMatch(i string)

func (*SyntaxFlowVisitor) EmitRemoveRef

func (y *SyntaxFlowVisitor) EmitRemoveRef(i string)

func (*SyntaxFlowVisitor) EmitSearchExact added in v1.3.3

func (v *SyntaxFlowVisitor) EmitSearchExact(mod int, i string) *SFI

func (*SyntaxFlowVisitor) EmitSearchGlob added in v1.3.3

func (v *SyntaxFlowVisitor) EmitSearchGlob(mod int, i string) *SFI

func (*SyntaxFlowVisitor) EmitSearchRegexp added in v1.3.3

func (v *SyntaxFlowVisitor) EmitSearchRegexp(mod int, i string) *SFI

func (*SyntaxFlowVisitor) EmitUpdate

func (y *SyntaxFlowVisitor) EmitUpdate(i string)

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) VisitAlertStatement

func (y *SyntaxFlowVisitor) VisitAlertStatement(raw sf.IAlertStatementContext)

func (*SyntaxFlowVisitor) VisitChainFilter

func (y *SyntaxFlowVisitor) VisitChainFilter(raw sf.IChainFilterContext) interface{}

func (*SyntaxFlowVisitor) VisitCheckStatement

func (y *SyntaxFlowVisitor) VisitCheckStatement(raw sf.ICheckStatementContext) interface{}

func (*SyntaxFlowVisitor) VisitConditionExpression

func (y *SyntaxFlowVisitor) VisitConditionExpression(raw sf.IConditionExpressionContext) any

func (*SyntaxFlowVisitor) VisitDescriptionStatement

func (y *SyntaxFlowVisitor) VisitDescriptionStatement(raw sf.IDescriptionStatementContext) interface{}

func (*SyntaxFlowVisitor) VisitFileFilterContent

func (y *SyntaxFlowVisitor) VisitFileFilterContent(raw sf.IFileFilterContentStatementContext) error

func (*SyntaxFlowVisitor) VisitFileFilterContentInput

func (y *SyntaxFlowVisitor) VisitFileFilterContentInput(raw sf.IFileFilterContentInputContext) (string, error)

func (*SyntaxFlowVisitor) VisitFileFilterContentMethod

func (y *SyntaxFlowVisitor) VisitFileFilterContentMethod(raw sf.IFileFilterContentMethodContext, f string) error

func (*SyntaxFlowVisitor) VisitFileFilterContentMethodParam

func (y *SyntaxFlowVisitor) VisitFileFilterContentMethodParam(raw sf.IFileFilterContentMethodParamContext) (map[string]string, []string)

func (*SyntaxFlowVisitor) VisitFilterExpr

func (y *SyntaxFlowVisitor) VisitFilterExpr(raw sf.IFilterExprContext) error

func (*SyntaxFlowVisitor) VisitFilterItem

func (y *SyntaxFlowVisitor) VisitFilterItem(raw sf.IFilterItemContext) error

func (*SyntaxFlowVisitor) VisitFilterItemFirst

func (y *SyntaxFlowVisitor) VisitFilterItemFirst(raw sf.IFilterItemFirstContext) error

func (*SyntaxFlowVisitor) VisitFilterStatement

func (y *SyntaxFlowVisitor) VisitFilterStatement(raw sf.IFilterStatementContext)

func (*SyntaxFlowVisitor) VisitFlow

func (y *SyntaxFlowVisitor) VisitFlow(raw sf.IFlowContext)

func (*SyntaxFlowVisitor) VisitHereDoc

func (v *SyntaxFlowVisitor) VisitHereDoc(i any) string

func (*SyntaxFlowVisitor) VisitNameFilter added in v1.3.3

func (y *SyntaxFlowVisitor) VisitNameFilter(isMember bool, i sf.INameFilterContext) (err error)

func (*SyntaxFlowVisitor) VisitNativeCallActualParams

func (v *SyntaxFlowVisitor) VisitNativeCallActualParams(i *sf.NativeCallActualParamsContext) []*RecursiveConfigItem

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.ConfigContext) []*RecursiveConfigItem

func (*SyntaxFlowVisitor) VisitRecursiveNameFilter

func (y *SyntaxFlowVisitor) VisitRecursiveNameFilter(recursive bool, isMember bool, i sf.INameFilterContext) error

func (*SyntaxFlowVisitor) VisitRefVariable

func (y *SyntaxFlowVisitor) VisitRefVariable(raw sf.IRefVariableContext) string

func (*SyntaxFlowVisitor) VisitStatement

func (y *SyntaxFlowVisitor) VisitStatement(raw sf.IStatementContext)

func (*SyntaxFlowVisitor) VisitStringLiteral

func (y *SyntaxFlowVisitor) VisitStringLiteral(raw sf.IStringLiteralContext) (string, bool)

func (*SyntaxFlowVisitor) VisitStringLiteralWithoutStarGroup

func (y *SyntaxFlowVisitor) VisitStringLiteralWithoutStarGroup(raw sf.IStringLiteralWithoutStarGroupContext) []string

type ValueList added in v1.3.3

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

func (*ValueList) AppendPredecessor

func (v *ValueList) AppendPredecessor(value ValueOperator, opts ...AnalysisContextOption) error

func (*ValueList) ExactMatch added in v1.3.3

func (v *ValueList) ExactMatch(mod int, s string) (bool, ValueOperator, error)

func (*ValueList) FileFilter

func (v *ValueList) FileFilter(path string, mode string, rule1 map[string]string, rule2 []string) (ValueOperator, error)

func (*ValueList) ForEach added in v1.3.3

func (v *ValueList) ForEach(h func(i any))

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) GetFields

func (v *ValueList) GetFields() (ValueOperator, error)

func (*ValueList) GetOpcode

func (v *ValueList) GetOpcode() string

func (*ValueList) GetSyntaxFlowBottomUse added in v1.3.3

func (v *ValueList) GetSyntaxFlowBottomUse(sfResult *SFFrameResult, sfConfig *Config, 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(sfResult *SFFrameResult, sfConfig *Config, config ...*RecursiveConfigItem) (ValueOperator, error)

func (*ValueList) GetSyntaxFlowUse added in v1.3.3

func (v *ValueList) GetSyntaxFlowUse() (ValueOperator, error)

func (*ValueList) GlobMatch added in v1.3.3

func (v *ValueList) GlobMatch(mod int, s string) (bool, ValueOperator, error)

func (*ValueList) IsList added in v1.3.3

func (v *ValueList) IsList() bool

func (*ValueList) IsMap added in v1.3.3

func (v *ValueList) IsMap() bool

func (*ValueList) ListIndex added in v1.3.3

func (v *ValueList) ListIndex(i int) (ValueOperator, error)

func (*ValueList) Merge

func (v *ValueList) Merge(values ...ValueOperator) (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

func (v *ValueList) RegexpMatch(mod int, regexp string) (bool, ValueOperator, error)

func (*ValueList) Remove

func (v *ValueList) Remove(values ...ValueOperator) (ValueOperator, error)

func (*ValueList) String added in v1.3.3

func (v *ValueList) String() string

type ValueOperator added in v1.3.3

type ValueOperator interface {
	String() string
	IsMap() bool
	IsList() bool
	GetOpcode() string

	// Recursive will execute with handler for every list or map
	Recursive(func(ValueOperator) error) error

	// ExactMatch return ops, for OpPushSearchExact
	ExactMatch(int, string) (bool, ValueOperator, error)
	// GlobMatch return opts, for OpPushSearchGlob
	GlobMatch(int, string) (bool, ValueOperator, error)
	// RegexpMatch for OpPushSearchRegexp
	RegexpMatch(int, string) (bool, ValueOperator, error)

	// GetCallActualParams for OpGetCallArgs
	GetCalled() (ValueOperator, error)
	GetCallActualParams(int) (ValueOperator, error)
	GetAllCallActualParams() (ValueOperator, error)
	GetFields() (ValueOperator, error)

	// GetTopDef and GetBottomUse is for OpBottomUse
	// use and def
	GetSyntaxFlowUse() (ValueOperator, error)
	GetSyntaxFlowDef() (ValueOperator, error)
	// top and bottom
	GetSyntaxFlowTopDef(*SFFrameResult, *Config, ...*RecursiveConfigItem) (ValueOperator, error)
	GetSyntaxFlowBottomUse(*SFFrameResult, *Config, ...*RecursiveConfigItem) (ValueOperator, error)

	// ListIndex for OpListIndex, like a[1] a must be list...
	ListIndex(i int) (ValueOperator, error)

	Merge(...ValueOperator) (ValueOperator, error)
	Remove(...ValueOperator) (ValueOperator, error)

	AppendPredecessor(ValueOperator, ...AnalysisContextOption) error

	// fileFilter
	FileFilter(string, string, map[string]string, []string) (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 NewEmptyValues

func NewEmptyValues() ValueOperator

func NewValues added in v1.3.3

func NewValues(values []ValueOperator) ValueOperator

Jump to

Keyboard shortcuts

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