grpc
third_party
bloaty
third_party
re2
re2
bloaty/third_party/re2/re2/set.h
Go to the documentation of this file.
1
// Copyright 2010 The RE2 Authors. All Rights Reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
5
#ifndef RE2_SET_H_
6
#define RE2_SET_H_
7
8
#include <string>
9
#include <utility>
10
#include <vector>
11
12
#include "re2/re2.h"
13
14
namespace
re2
{
15
class
Prog;
16
class
Regexp;
17
}
// namespace re2
18
19
namespace
re2
{
20
21
// An RE2::Set represents a collection of regexps that can
22
// be searched for simultaneously.
23
class
RE2::Set
{
24
public
:
25
enum
ErrorKind
{
26
kNoError
= 0,
27
kNotCompiled
,
// The set is not compiled.
28
kOutOfMemory
,
// The DFA ran out of memory.
29
kInconsistent
,
// The result is inconsistent. This should never happen.
30
};
31
32
struct
ErrorInfo
{
33
ErrorKind
kind
;
34
};
35
36
Set
(
const
RE2::Options
&
options
,
RE2::Anchor
anchor);
37
~Set
();
38
39
// Adds pattern to the set using the options passed to the constructor.
40
// Returns the index that will identify the regexp in the output of Match(),
41
// or -1 if the regexp cannot be parsed.
42
// Indices are assigned in sequential order starting from 0.
43
// Errors do not increment the index; if error is not NULL, *error will hold
44
// the error message from the parser.
45
int
Add
(
const
StringPiece
&
pattern
,
std::string
*
error
);
46
47
// Compiles the set in preparation for matching.
48
// Returns false if the compiler runs out of memory.
49
// Add() must not be called again after Compile().
50
// Compile() must be called before Match().
51
bool
Compile
();
52
53
// Returns true if text matches at least one of the regexps in the set.
54
// Fills v (if not NULL) with the indices of the matching regexps.
55
// Callers must not expect v to be sorted.
56
bool
Match
(
const
StringPiece
&
text
, std::vector<int>*
v
)
const
;
57
58
// As above, but populates error_info (if not NULL) when none of the regexps
59
// in the set matched. This can inform callers when DFA execution fails, for
60
// example, because they might wish to handle that case differently.
61
bool
Match
(
const
StringPiece
&
text
, std::vector<int>*
v
,
62
ErrorInfo
* error_info)
const
;
63
64
private
:
65
typedef
std::pair<std::string, re2::Regexp*>
Elem
;
66
67
RE2::Options
options_
;
68
RE2::Anchor
anchor_
;
69
std::vector<Elem>
elem_
;
70
re2::Prog
*
prog_
;
71
bool
compiled_
;
72
int
size_
;
73
74
Set
(
const
Set
&) =
delete
;
75
Set
&
operator=
(
const
Set
&) =
delete
;
76
};
77
78
}
// namespace re2
79
80
#endif // RE2_SET_H_
re2::RE2::Set::kOutOfMemory
@ kOutOfMemory
Definition:
bloaty/third_party/re2/re2/set.h:28
re2::RE2::Set
Definition:
bloaty/third_party/re2/re2/set.h:23
re2::RE2::Set::kNoError
@ kNoError
Definition:
bloaty/third_party/re2/re2/set.h:26
re2::RE2::Set::Match
bool Match(const StringPiece &text, std::vector< int > *v) const
Definition:
bloaty/third_party/re2/re2/set.cc:105
re2::RE2::Set::size_
int size_
Definition:
bloaty/third_party/re2/re2/set.h:72
re2::RE2::Set::operator=
Set & operator=(const Set &)=delete
testing::internal::string
::std::string string
Definition:
bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
re2::RE2::Set::prog_
re2::Prog * prog_
Definition:
bloaty/third_party/re2/re2/set.h:70
re2::RE2::error
const std::string & error() const
Definition:
bloaty/third_party/re2/re2/re2.h:275
re2::RE2::Set::Elem
std::pair< std::string, re2::Regexp * > Elem
Definition:
bloaty/third_party/re2/re2/set.h:65
re2
Definition:
bloaty/third_party/re2/re2/bitmap256.h:17
re2::RE2::Set::compiled_
bool compiled_
Definition:
bloaty/third_party/re2/re2/set.h:71
re2::RE2::Set::ErrorKind
ErrorKind
Definition:
bloaty/third_party/re2/re2/set.h:25
gen_server_registered_method_bad_client_test_body.text
def text
Definition:
gen_server_registered_method_bad_client_test_body.py:50
re2::RE2::options
const Options & options() const
Definition:
bloaty/third_party/re2/re2/re2.h:699
setup.v
v
Definition:
third_party/bloaty/third_party/capstone/bindings/python/setup.py:42
re2::RE2::Set::Set
Set(const RE2::Options &options, RE2::Anchor anchor)
Definition:
bloaty/third_party/re2/re2/set.cc:21
re2::RE2::Set::kInconsistent
@ kInconsistent
Definition:
bloaty/third_party/re2/re2/set.h:29
re2::RE2::Set::options_
RE2::Options options_
Definition:
bloaty/third_party/re2/re2/set.h:67
re2::RE2::Set::anchor_
RE2::Anchor anchor_
Definition:
bloaty/third_party/re2/re2/set.h:68
re2::RE2::Options
Definition:
bloaty/third_party/re2/re2/re2.h:548
re2::RE2::Set::Compile
bool Compile()
Definition:
bloaty/third_party/re2/re2/set.cc:75
re2::RE2::Set::~Set
~Set()
Definition:
bloaty/third_party/re2/re2/set.cc:30
re2::Prog
Definition:
bloaty/third_party/re2/re2/prog.h:56
re2::RE2::pattern
const std::string & pattern() const
Definition:
bloaty/third_party/re2/re2/re2.h:271
re2::RE2::Set::elem_
std::vector< Elem > elem_
Definition:
bloaty/third_party/re2/re2/set.h:69
re2::RE2::Set::ErrorInfo
Definition:
bloaty/third_party/re2/re2/set.h:32
re2::RE2::Set::Add
int Add(const StringPiece &pattern, std::string *error)
Definition:
bloaty/third_party/re2/re2/set.cc:36
re2::RE2::Anchor
Anchor
Definition:
bloaty/third_party/re2/re2/re2.h:472
re2::RE2::Set::ErrorInfo::kind
ErrorKind kind
Definition:
bloaty/third_party/re2/re2/set.h:33
re2::StringPiece
Definition:
bloaty/third_party/re2/re2/stringpiece.h:39
re2::RE2::Set::kNotCompiled
@ kNotCompiled
Definition:
bloaty/third_party/re2/re2/set.h:27
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:12