MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Macros

Function Macros

parser/options.go:114–126  ·  view source on GitHub ↗

Macros adds the given macros to the parser.

(macros ...Macro)

Source from the content-addressed store, hash-verified

112
113// Macros adds the given macros to the parser.
114func Macros(macros ...Macro) Option {
115 return func(opts *options) error {
116 for _, m := range macros {
117 if m != nil {
118 if opts.macros == nil {
119 opts.macros = make(map[string]Macro)
120 }
121 opts.macros[m.MacroKey()] = m
122 }
123 }
124 return nil
125 }
126}
127
128// PopulateMacroCalls ensures that the original call signatures replaced by expanded macros
129// are preserved in the `SourceInfo` of parse result.

Callers 15

TestPruneFunction · 0.92
computeCostFunction · 0.92
programFunction · 0.92
TestCheckFunction · 0.92
BenchmarkCheckFunction · 0.92
TestCheckErrorDataFunction · 0.92
TestVarsInheritanceFunction · 0.92
TestCostFunction · 0.92
configureMethod · 0.92
TestConvertExprFunction · 0.92

Calls 1

MacroKeyMethod · 0.65

Tested by 15

TestPruneFunction · 0.74
computeCostFunction · 0.74
programFunction · 0.74
TestCheckFunction · 0.74
BenchmarkCheckFunction · 0.74
TestCheckErrorDataFunction · 0.74
TestVarsInheritanceFunction · 0.74
TestCostFunction · 0.74
TestConvertExprFunction · 0.74
TestSourceInfoToProtoFunction · 0.74