Go to the documentation of this file.
11 #include "util/util.h"
12 #include "util/logging.h"
13 #include "util/strutil.h"
15 #include "re2/regexp.h"
16 #include "re2/walker-inl.h"
43 int* child_args,
int nchild_args);
64 #define ToString DontCallToString // Avoid accidental recursion.
69 int prec = parent_arg;
105 LOG(DFATAL) <<
"kRegexpCapture cap() == 0";
130 if (
r != 0 &&
r < 0x80 && strchr(
"(){}[]*+?|.^$\\",
r)) {
132 t->append(1,
static_cast<char>(
r));
133 }
else if (foldcase &&
'a' <=
r &&
r <=
'z') {
136 t->append(1,
static_cast<char>(
r));
137 t->append(1,
static_cast<char>(
r) +
'a' -
'A');
148 int* child_args,
int nchild_args) {
149 int prec = parent_arg;
154 t_->append(
"[^\\x00-\\x{10ffff}]");
185 if ((*
t_)[
t_->size()-1] ==
'|')
186 t_->erase(
t_->size()-1);
188 LOG(DFATAL) <<
"Bad final char: " <<
t_;
220 else if (re->
min() == re->
max())
247 t_->append(
"(?-m:^)");
252 t_->append(
"(?-m:$)");
266 if (re->
cc()->
size() == 0) {
267 t_->append(
"[^\\x00-\\x{10ffff}]");
294 t_->append(
"(?HaveMatch:%d)", re->
match_id());
307 if (0x20 <=
r &&
r <= 0x7E) {
308 if (strchr(
"[]^-\\",
r))
310 t->append(1,
static_cast<char>(
r));
virtual int PreVisit(Regexp *re, int parent_arg, bool *stop)
T WalkExponential(Regexp *re, T top_arg, int max_visits)
virtual int ShortVisit(Regexp *re, int parent_arg)
ToStringWalker & operator=(const ToStringWalker &)=delete
static void AppendCCChar(std::string *t, Rune r)
std::string StringPrintf(const char *format,...)
static void AppendLiteral(std::string *t, Rune r, bool foldcase)
const std::string * name()
ToStringWalker(std::string *t)
static void AppendCCRange(std::string *t, Rune lo, Rune hi)
virtual int PostVisit(Regexp *re, int parent_arg, int pre_arg, int *child_args, int nchild_args)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:40