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

Method step

java/com/google/re2j/Machine.java:310–376  ·  view source on GitHub ↗
(
      Queue runq,
      Queue nextq,
      int pos,
      int nextPos,
      int c,
      int nextCond,
      int anchor,
      boolean atEnd)

Source from the content-addressed store, hash-verified

308 // |anchor| is the anchoring flag and |atEnd| signals if we are at the end of
309 // the input string.
310 private void step(
311 Queue runq,
312 Queue nextq,
313 int pos,
314 int nextPos,
315 int c,
316 int nextCond,
317 int anchor,
318 boolean atEnd) {
319 boolean longest = re2.longest;
320 for (int j = 0; j < runq.size; ++j) {
321 Thread t = runq.denseThreads[j];
322 if (t == null) {
323 continue;
324 }
325 if (longest && matched && ncap > 0 && matchcap[0] < t.cap[0]) {
326 free(t);
327 continue;
328 }
329 Inst i = t.inst;
330 boolean add = false;
331 switch (i.op) {
332 case Inst.MATCH:
333 if (anchor == RE2.ANCHOR_BOTH && !atEnd) {
334 // Don't match if we anchor at both start and end and those
335 // expectations aren't met.
336 break;
337 }
338 if (ncap > 0 && (!longest || !matched || matchcap[1] < pos)) {
339 t.cap[1] = pos;
340 System.arraycopy(t.cap, 0, matchcap, 0, ncap);
341 }
342 if (!longest) {
343 free(runq, j + 1);
344 }
345 matched = true;
346 break;
347
348 case Inst.RUNE:
349 add = i.matchRune(c);
350 break;
351
352 case Inst.RUNE1:
353 add = c == i.runes[0];
354 break;
355
356 case Inst.RUNE_ANY:
357 add = true;
358 break;
359
360 case Inst.RUNE_ANY_NOT_NL:
361 add = c != '\n';
362 break;
363
364 default:
365 throw new IllegalStateException("bad inst");
366 }
367 if (add) {

Callers 2

matchMethod · 0.95
allMatchesMethod · 0.45

Calls 4

freeMethod · 0.95
matchRuneMethod · 0.95
addMethod · 0.95
clearMethod · 0.80

Tested by

no test coverage detected