diff --git a/README b/README index 2d92068..50d86cd 100644 --- a/README +++ b/README @@ -34,6 +34,7 @@ so that the user does not need to waste time taking strlen() * Support for repetition operator {n} and {n,m}. * Support for Unicode (UTF-8). * Unlike other engines, the output is byte level offset. (Which is more useful) +* Support for non capture group ?: * Support for wordend & wordbeg assertions - Some limitations for word assertions are meta chars like spaces being used in for expression itself, for example "\< abc" should match " abc" exactly at diff --git a/pike.c b/pike.c index 6bd5538..ac4e7f8 100644 --- a/pike.c +++ b/pike.c @@ -187,7 +187,8 @@ void re_dumpcode(rcode *prog) /* next todo: crack and factor out this recursion, no recursion will allow to make a meta macro out -of this, such that re_sizecode() becomes efficient */ +of this, such that re_sizecode() becomes efficient +difficulty: very high, probably not any time soon */ static int _compilecode(const char **re_loc, rcode *prog, int sizecode) { const char *re = *re_loc; @@ -316,8 +317,8 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode) i++; icnt++; } + prog->len += maxcnt * icnt; } - prog->len += maxcnt * icnt; break; case '?': if (PC == term) goto syntax_error; @@ -390,7 +391,7 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode) } uc_len(c, re) re += c; } - if (alt_label) { + if (code && alt_label) { EMIT(alt_label, REL(alt_label, PC) + 1); for (int alts = altc; altc; altc--) { int at = alt_stack[alts-altc]+altc*3;