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

Class CompilerLibrary

compiler/compiler.h:43–80  ·  view source on GitHub ↗

A CompilerLibrary represents a package of CEL configuration that can be added to a Compiler. It may contain either or both of a Parser configuration and a TypeChecker configuration.

Source from the content-addressed store, hash-verified

41// It may contain either or both of a Parser configuration and a
42// TypeChecker configuration.
43struct CompilerLibrary {
44 // Optional identifier to avoid collisions re-adding the same library.
45 // If id is empty, it is not considered.
46 std::string id;
47 // Optional callback for configuring the parser.
48 ParserBuilderConfigurer configure_parser;
49 // Optional callback for configuring the type checker.
50 TypeCheckerBuilderConfigurer configure_checker;
51
52 CompilerLibrary(std::string id, ParserBuilderConfigurer configure_parser,
53 TypeCheckerBuilderConfigurer configure_checker = nullptr)
54 : id(std::move(id)),
55 configure_parser(std::move(configure_parser)),
56 configure_checker(std::move(configure_checker)) {}
57
58 CompilerLibrary(std::string id,
59 TypeCheckerBuilderConfigurer configure_checker)
60 : id(std::move(id)),
61 configure_parser(std::move(nullptr)),
62 configure_checker(std::move(configure_checker)) {}
63
64 // Convenience conversion from the CheckerLibrary type.
65 //
66 // Note: if a related CompilerLibrary exists, prefer to use that to
67 // include expected parser configuration.
68 static CompilerLibrary FromCheckerLibrary(CheckerLibrary checker_library) {
69 return CompilerLibrary(std::move(checker_library.id),
70 /*configure_parser=*/nullptr,
71 std::move(checker_library.configure));
72 }
73
74 // For backwards compatibility. To be removed.
75 // NOLINTNEXTLINE(google-explicit-constructor)
76 CompilerLibrary(CheckerLibrary checker_library)
77 : id(std::move(checker_library.id)),
78 configure_parser(nullptr),
79 configure_checker(std::move(checker_library.configure)) {}
80};
81
82struct CompilerLibrarySubset {
83 // The id of the library to subset. Only one subset can be applied per

Callers 7

FromCheckerLibraryMethod · 0.85
TESTFunction · 0.85
MathCompilerLibraryFunction · 0.85
BindingsCompilerLibraryFunction · 0.85
ProtoExtCompilerLibraryFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68