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

Method PostVisit

extern/re2/re2/prefilter.cc:527–643  ·  view source on GitHub ↗

Constructs the Prefilter::Info for the given regular expression. Assumes re is simplified.

Source from the content-addressed store, hash-verified

525// Constructs the Prefilter::Info for the given regular expression.
526// Assumes re is simplified.
527Prefilter::Info* Prefilter::Info::Walker::PostVisit(
528 Regexp* re, Prefilter::Info* parent_arg,
529 Prefilter::Info* pre_arg, Prefilter::Info** child_args,
530 int nchild_args) {
531 Prefilter::Info *info;
532 switch (re->op()) {
533 default:
534 case kRegexpRepeat:
535 LOG(DFATAL) << "Bad regexp op " << re->op();
536 info = EmptyString();
537 break;
538
539 case kRegexpNoMatch:
540 info = NoMatch();
541 break;
542
543 // These ops match the empty string:
544 case kRegexpEmptyMatch: // anywhere
545 case kRegexpBeginLine: // at beginning of line
546 case kRegexpEndLine: // at end of line
547 case kRegexpBeginText: // at beginning of text
548 case kRegexpEndText: // at end of text
549 case kRegexpWordBoundary: // at word boundary
550 case kRegexpNoWordBoundary: // not at word boundary
551 info = EmptyString();
552 break;
553
554 case kRegexpLiteral:
555 if (latin1()) {
556 info = LiteralLatin1(re->rune());
557 }
558 else {
559 info = Literal(re->rune());
560 }
561 break;
562
563 case kRegexpLiteralString:
564 if (re->nrunes() == 0) {
565 info = NoMatch();
566 break;
567 }
568 if (latin1()) {
569 info = LiteralLatin1(re->runes()[0]);
570 for (int i = 1; i < re->nrunes(); i++) {
571 info = Concat(info, LiteralLatin1(re->runes()[i]));
572 }
573 } else {
574 info = Literal(re->runes()[0]);
575 for (int i = 1; i < re->nrunes(); i++) {
576 info = Concat(info, Literal(re->runes()[i]));
577 }
578 }
579 break;
580
581 case kRegexpConcat: {
582 // Accumulate in info.
583 // Exact is concat of recent contiguous exact nodes.
584 info = NULL;

Callers

nothing calls this directly

Calls 8

runeMethod · 0.80
nrunesMethod · 0.80
runesMethod · 0.80
is_exactMethod · 0.80
opMethod · 0.45
sizeMethod · 0.45
ccMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected