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

Method Cat

extern/re2/re2/compile.cc:276–298  ·  view source on GitHub ↗

Given fragments a and b, returns fragment for ab.

Source from the content-addressed store, hash-verified

274
275// Given fragments a and b, returns fragment for ab.
276Frag Compiler::Cat(Frag a, Frag b) {
277 if (IsNoMatch(a) || IsNoMatch(b))
278 return NoMatch();
279
280 // Elide no-op.
281 Prog::Inst* begin = &inst_[a.begin];
282 if (begin->opcode() == kInstNop &&
283 a.end.head == (a.begin << 1) &&
284 begin->out() == 0) {
285 // in case refs to a somewhere
286 PatchList::Patch(inst_.data(), a.end, b.begin);
287 return b;
288 }
289
290 // To run backward over string, reverse all concatenations.
291 if (reversed_) {
292 PatchList::Patch(inst_.data(), b.end, a.begin);
293 return Frag(b.begin, a.end);
294 }
295
296 PatchList::Patch(inst_.data(), a.end, b.begin);
297 return Frag(a.begin, b.end);
298}
299
300// Given fragments for a and b, returns fragment for a|b.
301Frag Compiler::Alt(Frag a, Frag b) {

Callers 2

CompileMethod · 0.80
CompileSetMethod · 0.80

Calls 5

IsNoMatchFunction · 0.85
FragClass · 0.85
opcodeMethod · 0.80
outMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected