forked from google/cel-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregex_functions.h
More file actions
52 lines (45 loc) · 2.18 KB
/
regex_functions.h
File metadata and controls
52 lines (45 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Definitions for extension functions wrapping C++ RE2 APIs. These are
// only defined for the C++ CEL library and distinct from the regex
// extension library (supported by other implementations).
#ifndef THIRD_PARTY_CEL_CPP_EXTENSIONS_REGEX_FUNCTIONS_H_
#define THIRD_PARTY_CEL_CPP_EXTENSIONS_REGEX_FUNCTIONS_H_
#include "absl/base/attributes.h"
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "checker/type_checker_builder.h"
#include "eval/public/cel_function_registry.h"
#include "eval/public/cel_options.h"
#include "runtime/function_registry.h"
#include "runtime/runtime_options.h"
namespace cel::extensions {
inline constexpr absl::string_view kRegexExtract = "re.extract";
inline constexpr absl::string_view kRegexCapture = "re.capture";
inline constexpr absl::string_view kRegexCaptureN = "re.captureN";
// Register Extract and Capture Functions for RE2
// Requires options.enable_regex to be true
// The canonical regex extensions supported by the CEL team are registered
// via the `RegisterRegexExtensionsFunctions`. This extension is deprecated.
ABSL_DEPRECATED("Use RegisterRegexExtensionsFunctions instead.")
absl::Status RegisterRegexFunctions(
google::api::expr::runtime::CelFunctionRegistry* registry,
const google::api::expr::runtime::InterpreterOptions& options);
absl::Status RegisterRegexFunctions(FunctionRegistry& registry,
const RuntimeOptions& options);
// Declarations for the regex extension library.
CheckerLibrary RegexCheckerLibrary();
} // namespace cel::extensions
#endif // THIRD_PARTY_CEL_CPP_EXTENSIONS_REGEX_FUNCTIONS_H_