MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / SimplifyRegexp

Method SimplifyRegexp

extern/re2/re2/simplify.cc:23–40  ·  view source on GitHub ↗

Parses the regexp src and then simplifies it and sets *dst to the string representation of the simplified form. Returns true on success. Returns false and sets *error (if error != NULL) on error.

Source from the content-addressed store, hash-verified

21// string representation of the simplified form. Returns true on success.
22// Returns false and sets *error (if error != NULL) on error.
23bool Regexp::SimplifyRegexp(const StringPiece& src, ParseFlags flags,
24 std::string* dst, RegexpStatus* status) {
25 Regexp* re = Parse(src, flags, status);
26 if (re == NULL)
27 return false;
28 Regexp* sre = re->Simplify();
29 re->Decref();
30 if (sre == NULL) {
31 if (status) {
32 status->set_code(kRegexpInternalError);
33 status->set_error_arg(src);
34 }
35 return false;
36 }
37 *dst = sre->ToString();
38 sre->Decref();
39 return true;
40}
41
42// Assuming the simple_ flags on the children are accurate,
43// is this Regexp* simple?

Callers

nothing calls this directly

Calls 6

ParseFunction · 0.85
set_codeMethod · 0.80
set_error_argMethod · 0.80
SimplifyMethod · 0.45
DecrefMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected