| 30 | namespace cel { |
| 31 | |
| 32 | void RegisterStandardExtensions(Env& env) { |
| 33 | env.RegisterCompilerLibrary("cel.lib.ext.bindings", "bindings", 0, []() { |
| 34 | return extensions::BindingsCompilerLibrary(); |
| 35 | }); |
| 36 | env.RegisterCompilerLibrary("cel.lib.ext.encoders", "encoders", 0, []() { |
| 37 | return extensions::EncodersCompilerLibrary(); |
| 38 | }); |
| 39 | for (int version = 0; version <= extensions::kListsExtensionLatestVersion; |
| 40 | ++version) { |
| 41 | env.RegisterCompilerLibrary( |
| 42 | "cel.lib.ext.lists", "lists", version, |
| 43 | [version]() { return extensions::ListsCompilerLibrary(version); }); |
| 44 | } |
| 45 | for (int version = 0; version <= extensions::kMathExtensionLatestVersion; |
| 46 | ++version) { |
| 47 | env.RegisterCompilerLibrary( |
| 48 | "cel.lib.ext.math", "math", version, |
| 49 | [version]() { return extensions::MathCompilerLibrary(version); }); |
| 50 | } |
| 51 | for (int version = 0; version <= kOptionalExtensionLatestVersion; ++version) { |
| 52 | env.RegisterCompilerLibrary("optional", "", version, [version]() { |
| 53 | return OptionalCompilerLibrary(version); |
| 54 | }); |
| 55 | } |
| 56 | env.RegisterCompilerLibrary("cel.lib.ext.protos", "protos", 0, []() { |
| 57 | return extensions::ProtoExtCompilerLibrary(); |
| 58 | }); |
| 59 | env.RegisterCompilerLibrary("cel.lib.ext.sets", "sets", 0, []() { |
| 60 | return extensions::SetsCompilerLibrary(); |
| 61 | }); |
| 62 | for (int version = 0; version <= extensions::kStringsExtensionLatestVersion; |
| 63 | ++version) { |
| 64 | env.RegisterCompilerLibrary( |
| 65 | "cel.lib.ext.strings", "strings", version, |
| 66 | [version]() { return extensions::StringsCompilerLibrary(version); }); |
| 67 | } |
| 68 | env.RegisterCompilerLibrary( |
| 69 | "cel.lib.ext.comprev2", "two-var-comprehensions", 0, |
| 70 | []() { return extensions::ComprehensionsV2CompilerLibrary(); }); |
| 71 | env.RegisterCompilerLibrary("cel.lib.ext.regex", "regex", 0, []() { |
| 72 | return extensions::RegexExtCompilerLibrary(); |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | } // namespace cel |