MCPcopy Create free account
hub / github.com/google/re2j / leadingRegexp

Method leadingRegexp

java/com/google/re2j/Parser.java:642–654  ·  view source on GitHub ↗
(Regexp re)

Source from the content-addressed store, hash-verified

640 // leadingRegexp returns the leading regexp that re begins with.
641 // The regexp refers to storage in re or its children.
642 private static Regexp leadingRegexp(Regexp re) {
643 if (re.op == Regexp.Op.EMPTY_MATCH) {
644 return null;
645 }
646 if (re.op == Regexp.Op.CONCAT && re.subs.length > 0) {
647 Regexp sub = re.subs[0];
648 if (sub.op == Regexp.Op.EMPTY_MATCH) {
649 return null;
650 }
651 return sub;
652 }
653 return re;
654 }
655
656 // removeLeadingRegexp removes the leading regexp in re.
657 // It returns the replacement for re.

Callers 1

factorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected