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

Method prefix

java/com/google/re2j/Prog.java:63–77  ·  view source on GitHub ↗
(StringBuilder prefix)

Source from the content-addressed store, hash-verified

61 // regexp must start with, and a boolean which is true if the prefix is the
62 // entire match. The string is returned by appending to |prefix|.
63 boolean prefix(StringBuilder prefix) {
64 Inst i = skipNop(start);
65
66 // Avoid allocation of buffer if prefix is empty.
67 if (!Inst.isRuneOp(i.op) || i.runes.length != 1) {
68 return i.op == Inst.MATCH; // (append "" to prefix)
69 }
70
71 // Have prefix; gather characters.
72 while (Inst.isRuneOp(i.op) && i.runes.length == 1 && (i.arg & RE2.FOLD_CASE) == 0) {
73 prefix.appendCodePoint(i.runes[0]); // an int, not a byte.
74 i = skipNop(i.out);
75 }
76 return i.op == Inst.MATCH;
77 }
78
79 // startCond() returns the leading empty-width conditions that must be true
80 // in any match. It returns -1 (all bits set) if no matches are possible.

Callers 1

compileImplMethod · 0.95

Calls 2

skipNopMethod · 0.95
isRuneOpMethod · 0.95

Tested by

no test coverage detected