Go to the documentation of this file.
11 #include "util/util.h"
12 #include "util/logging.h"
14 #include "re2/stringpiece.h"
17 #include "re2/regexp.h"
31 for (
size_t i = 0;
i < elem_.size();
i++)
38 LOG(DFATAL) <<
"RE2::Set::Add() called after compiling";
55 int n =
static_cast<int>(elem_.size());
58 int nsub = re->
nsub();
60 for (
int i = 0;
i < nsub;
i++)
77 LOG(DFATAL) <<
"RE2::Set::Compile() called more than once";
81 size_ =
static_cast<int>(elem_.size());
85 std::sort(elem_.begin(), elem_.end(),
87 return a.first < b.first;
94 elem_.shrink_to_fit();
102 return prog_ != NULL;
112 LOG(DFATAL) <<
"RE2::Set::Match() called before compiling";
113 if (error_info != NULL)
114 error_info->
kind = kNotCompiled;
117 bool dfa_failed =
false;
118 std::unique_ptr<SparseSet> matches;
124 NULL, &dfa_failed, matches.get());
130 if (error_info != NULL)
131 error_info->
kind = kOutOfMemory;
135 if (error_info != NULL)
136 error_info->
kind = kNoError;
140 if (matches->empty()) {
141 LOG(DFATAL) <<
"RE2::Set::Match() matched, but no matches returned?!";
142 if (error_info != NULL)
143 error_info->
kind = kInconsistent;
146 v->assign(matches->begin(), matches->end());
148 if (error_info != NULL)
149 error_info->
kind = kNoError;
SparseSetT< void > SparseSet
bool Match(const StringPiece &text, std::vector< int > *v) const
const std::string & error() const
std::pair< std::string, re2::Regexp * > Elem
static Regexp * Concat(Regexp **subs, int nsubs, ParseFlags flags)
const Options & options() const
Set(const RE2::Options &options, RE2::Anchor anchor)
static Regexp * Parse(const StringPiece &s, ParseFlags flags, RegexpStatus *status)
void set_never_capture(bool b)
static const LogLevel ERROR
bool SearchDFA(const StringPiece &text, const StringPiece &context, Anchor anchor, MatchKind kind, StringPiece *match0, bool *failed, SparseSet *matches)
bool Match(const StringPiece &text, size_t startpos, size_t endpos, Anchor re_anchor, StringPiece *submatch, int nsubmatch) const
UniquePtr< SSL_SESSION > ret
const std::string & pattern() const
static Prog * CompileSet(Regexp *re, RE2::Anchor anchor, int64_t max_mem)
static Regexp * HaveMatch(int match_id, ParseFlags flags)
int Add(const StringPiece &pattern, std::string *error)
static Regexp * Alternate(Regexp **subs, int nsubs, ParseFlags flags)
void Copy(const Options &src)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:12