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

Function Macros

parser/options.go:101–113  ·  view source on GitHub ↗

Macros adds the given macros to the parser.

(macros ...Macro)

Source from the content-addressed store, hash-verified

99
100// Macros adds the given macros to the parser.
101func Macros(macros ...Macro) Option {
102 return func(opts *options) error {
103 for _, m := range macros {
104 if m != nil {
105 if opts.macros == nil {
106 opts.macros = make(map[string]Macro)
107 }
108 opts.macros[m.MacroKey()] = m
109 }
110 }
111 return nil
112 }
113}
114
115// PopulateMacroCalls ensures that the original call signatures replaced by expanded macros
116// 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
TestCostFunction · 0.92
configureMethod · 0.92
TestConvertExprFunction · 0.92
TestSourceInfoToProtoFunction · 0.92
mustTypeCheckFunction · 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
TestCostFunction · 0.74
TestConvertExprFunction · 0.74
TestSourceInfoToProtoFunction · 0.74
mustTypeCheckFunction · 0.74