MCPcopy
hub / github.com/TomWright/dasel / exprExecutor

Function exprExecutor

execution/execute.go:87–166  ·  view source on GitHub ↗
(options *Options, expr ast.Expr)

Source from the content-addressed store, hash-verified

85}
86
87func exprExecutor(options *Options, expr ast.Expr) (expressionExecutor, error) {
88 if !options.Unstable && (slices.Contains(unstableAstTypes, reflect.TypeOf(expr)) ||
89 slices.Contains(unstableAstTypes, reflect.ValueOf(expr).Type())) {
90 return nil, errors.New("unstable ast types are not enabled. to enable them use --unstable")
91 }
92
93 switch e := expr.(type) {
94 case ast.BinaryExpr:
95 return binaryExprExecutor(e)
96 case ast.UnaryExpr:
97 return unaryExprExecutor(e)
98 case ast.CallExpr:
99 return callExprExecutor(options, e)
100 case ast.ChainedExpr:
101 return chainedExprExecutor(e)
102 case ast.SpreadExpr:
103 return spreadExprExecutor()
104 case ast.RangeExpr:
105 return rangeExprExecutor(e)
106 case ast.IndexExpr:
107 return indexExprExecutor(e)
108 case ast.PropertyExpr:
109 return propertyExprExecutor(e)
110 case ast.VariableExpr:
111 return variableExprExecutor(e)
112 case ast.NumberIntExpr:
113 return numberIntExprExecutor(e)
114 case ast.NumberFloatExpr:
115 return numberFloatExprExecutor(e)
116 case ast.StringExpr:
117 return stringExprExecutor(e)
118 case ast.BoolExpr:
119 return boolExprExecutor(e)
120 case ast.ObjectExpr:
121 return objectExprExecutor(e)
122 case ast.MapExpr:
123 return mapExprExecutor(e)
124 case ast.EachExpr:
125 return eachExprExecutor(e)
126 case ast.FilterExpr:
127 return filterExprExecutor(e)
128 case ast.SearchExpr:
129 return searchExprExecutor(e)
130 case ast.RecursiveDescentExpr:
131 return recursiveDescentExprExecutor2(e)
132 case ast.ConditionalExpr:
133 return conditionalExprExecutor(e)
134 case ast.BranchExpr:
135 return branchExprExecutor(e)
136 case ast.ArrayExpr:
137 return arrayExprExecutor(e)
138 case ast.RegexExpr:
139 // Noop
140 return func(ctx context.Context, options *Options, data *model.Value) (*model.Value, error) {
141 //ctx = WithExecutorID(ctx, "regexExpr")
142 return data, nil
143 }, nil
144 case ast.SortByExpr:

Callers 1

ExecuteASTFunction · 0.85

Calls 15

NewNullValueFunction · 0.92
binaryExprExecutorFunction · 0.85
unaryExprExecutorFunction · 0.85
callExprExecutorFunction · 0.85
chainedExprExecutorFunction · 0.85
spreadExprExecutorFunction · 0.85
rangeExprExecutorFunction · 0.85
indexExprExecutorFunction · 0.85
propertyExprExecutorFunction · 0.85
variableExprExecutorFunction · 0.85
numberIntExprExecutorFunction · 0.85
numberFloatExprExecutorFunction · 0.85

Tested by

no test coverage detected