MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / LegacyParse

Function LegacyParse

conformance/service.cc:237–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237absl::Status LegacyParse(const conformance::v1alpha1::ParseRequest& request,
238 conformance::v1alpha1::ParseResponse& response,
239 bool enable_optional_syntax) {
240 if (request.cel_source().empty()) {
241 return absl::InvalidArgumentError("no source code");
242 }
243 cel::ParserOptions options;
244 options.enable_optional_syntax = enable_optional_syntax;
245 options.enable_quoted_identifiers = true;
246 cel::MacroRegistry macros;
247 CEL_RETURN_IF_ERROR(cel::RegisterStandardMacros(macros, options));
248 CEL_RETURN_IF_ERROR(
249 cel::extensions::RegisterComprehensionsV2Macros(macros, options));
250 CEL_RETURN_IF_ERROR(cel::extensions::RegisterBindingsMacros(macros, options));
251 CEL_RETURN_IF_ERROR(cel::extensions::RegisterMathMacros(macros, options));
252 CEL_RETURN_IF_ERROR(cel::extensions::RegisterProtoMacros(macros, options));
253 CEL_RETURN_IF_ERROR(RegisterCelBlockMacros(macros));
254 CEL_ASSIGN_OR_RETURN(auto source, cel::NewSource(request.cel_source(),
255 request.source_location()));
256 CEL_ASSIGN_OR_RETURN(auto parsed_expr,
257 parser::Parse(*source, macros, options));
258 ABSL_CHECK( // Crash OK
259 ConvertWireCompatProto(parsed_expr, response.mutable_parsed_expr()));
260 return absl::OkStatus();
261}
262
263absl::Status CheckImpl(google::protobuf::Arena* arena,
264 const conformance::v1alpha1::CheckRequest& request,

Callers 2

ParseMethod · 0.85
ParseMethod · 0.85

Calls 8

RegisterStandardMacrosFunction · 0.85
RegisterBindingsMacrosFunction · 0.85
RegisterMathMacrosFunction · 0.85
RegisterProtoMacrosFunction · 0.85
RegisterCelBlockMacrosFunction · 0.85
ConvertWireCompatProtoFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected