| 23 | namespace cel { |
| 24 | |
| 25 | CompilerLibrary OptionalCompilerLibrary(int version) { |
| 26 | CompilerLibrary library = |
| 27 | CompilerLibrary::FromCheckerLibrary(OptionalCheckerLibrary(version)); |
| 28 | |
| 29 | library.configure_parser = [version](ParserBuilder& builder) { |
| 30 | builder.GetOptions().enable_optional_syntax = true; |
| 31 | absl::Status status; |
| 32 | status.Update(builder.AddMacro(OptMapMacro())); |
| 33 | if (version == 0) { |
| 34 | return status; |
| 35 | } |
| 36 | status.Update(builder.AddMacro(OptFlatMapMacro())); |
| 37 | return status; |
| 38 | }; |
| 39 | |
| 40 | return library; |
| 41 | } |
| 42 | |
| 43 | } // namespace cel |