Skip to content

Commit

Permalink
15_anchored_1
Browse files Browse the repository at this point in the history
  • Loading branch information
aroger-r7 committed Mar 29, 2018
1 parent 58e3fac commit 0991e6c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion java/com/google/re2j/Machine.java
Expand Up @@ -234,7 +234,7 @@ boolean match(MachineInput in, int pos, int anchor) {
width1 = r & 7;
}
}
if (!matched && (pos == 0 || anchor == RE2.UNANCHORED)) {
if ((anchor == RE2.UNANCHORED || pos == 0) && !matched) {
// If we are anchoring at begin then only add threads that begin
// at |pos| = 0.
if (captures) {
Expand Down Expand Up @@ -313,6 +313,7 @@ private void step(Queue runq, Queue nextq, int pos, int nextPos, int c,
} else if (i.matchRune(c)){
tcap = i.outInst.add(nextq, nextPos, tcap, nextCond, tcap, this, captures);
}

if (tcap != null) {
free(tcap);
}
Expand Down

0 comments on commit 0991e6c

Please sign in to comment.