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

Method emptyOpContext

java/com/google/re2j/Utils.java:182–202  ·  view source on GitHub ↗
(int r1, int r2)

Source from the content-addressed store, hash-verified

180 // Passing r2 == -1 indicates that the position is at the end of the text.
181 // TODO(adonovan): move to Machine.
182 static int emptyOpContext(int r1, int r2) {
183 int op = 0;
184 if (r1 < 0) {
185 op |= EMPTY_BEGIN_TEXT | EMPTY_BEGIN_LINE;
186 }
187 if (r1 == '\n') {
188 op |= EMPTY_BEGIN_LINE;
189 }
190 if (r2 < 0) {
191 op |= EMPTY_END_TEXT | EMPTY_END_LINE;
192 }
193 if (r2 == '\n') {
194 op |= EMPTY_END_LINE;
195 }
196 if (isWordRune(r1) != isWordRune(r2)) {
197 op |= EMPTY_WORD_BOUNDARY;
198 } else {
199 op |= EMPTY_NO_WORD_BOUNDARY;
200 }
201 return op;
202 }
203
204 private Utils() {} // uninstantiable
205}

Callers 3

contextMethod · 0.95
contextMethod · 0.95
matchMethod · 0.95

Calls 1

isWordRuneMethod · 0.95

Tested by

no test coverage detected