+
+ }
+ else /* not greedy */
+ { /* I wish the greedy and non-greedy cases could be merged. */
+
+ if (many_times_ok)
+ {
+ /* The greedy multiple match looks like a repeat..until:
+ we only need a conditional jump at the end of the loop */
+ GET_BUFFER_SPACE (3);
+ STORE_JUMP (on_failure_jump, b, laststart);
+ b += 3;
+ if (zero_times_ok)
+ {
+ /* The repeat...until naturally matches one or more.
+ To also match zero times, we need to first jump to
+ the end of the loop (its conditional jump). */
+ GET_BUFFER_SPACE (3);
+ INSERT_JUMP (jump, laststart, b);
+ b += 3;
+ }
+ }
+ else
+ {
+ /* non-greedy a?? */
+ GET_BUFFER_SPACE (6);
+ INSERT_JUMP (jump, laststart, b + 3);
+ b += 3;
+ INSERT_JUMP (on_failure_jump, laststart, laststart + 6);
+ b += 3;
+ }
+ }
+ }