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

Method Alt

extern/re2/re2/compile.cc:301–314  ·  view source on GitHub ↗

Given fragments for a and b, returns fragment for a|b.

Source from the content-addressed store, hash-verified

299
300// Given fragments for a and b, returns fragment for a|b.
301Frag Compiler::Alt(Frag a, Frag b) {
302 // Special case for convenience in loops.
303 if (IsNoMatch(a))
304 return b;
305 if (IsNoMatch(b))
306 return a;
307
308 int id = AllocInst(1);
309 if (id < 0)
310 return NoMatch();
311
312 inst_[id].InitAlt(a.begin, b.begin);
313 return Frag(id, PatchList::Append(inst_.data(), a.end, b.end));
314}
315
316// When capturing submatches in like-Perl mode, a kOpAlt Inst
317// treats out_ as the first choice, out1_ as the second.

Callers

nothing calls this directly

Calls 4

IsNoMatchFunction · 0.85
FragClass · 0.85
InitAltMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected