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

Function Macros

parser/options.go:116–128  ·  view source on GitHub ↗

Macros adds the given macros to the parser.

(macros ...Macro)

Source from the content-addressed store, hash-verified

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

Callers 15

TestPruneFunction · 0.92
parseMutabilityExprFunction · 0.92
TestListMapAccessCostFunction · 0.92
programFunction · 0.92
evalTestMemoryTrackerFunction · 0.92
benchmarkMemoryTrackerFunction · 0.92
runOptionsBenchmarkFunction · 0.92
TestCheckFunction · 0.92
BenchmarkCheckFunction · 0.92

Calls 1

MacroKeyMethod · 0.65

Tested by 15

TestPruneFunction · 0.74
parseMutabilityExprFunction · 0.74
TestListMapAccessCostFunction · 0.74
programFunction · 0.74
evalTestMemoryTrackerFunction · 0.74
benchmarkMemoryTrackerFunction · 0.74
runOptionsBenchmarkFunction · 0.74
TestCheckFunction · 0.74
BenchmarkCheckFunction · 0.74