misc: maintenance trivia

This commit is contained in:
Kyryl Melekhin
2021-10-02 16:03:39 +00:00
parent 8728bcf941
commit 04c9aae3fa
2 changed files with 5 additions and 3 deletions

1
README
View File

@@ -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 repetition operator {n} and {n,m}.
* Support for Unicode (UTF-8). * Support for Unicode (UTF-8).
* Unlike other engines, the output is byte level offset. (Which is more useful) * Unlike other engines, the output is byte level offset. (Which is more useful)
* Support for non capture group ?:
* Support for wordend & wordbeg assertions * Support for wordend & wordbeg assertions
- Some limitations for word assertions are meta chars like spaces being used - Some limitations for word assertions are meta chars like spaces being used
in for expression itself, for example "\< abc" should match " abc" exactly at in for expression itself, for example "\< abc" should match " abc" exactly at

7
pike.c
View File

@@ -187,7 +187,8 @@ void re_dumpcode(rcode *prog)
/* next todo: crack and factor out this recursion, /* next todo: crack and factor out this recursion,
no recursion will allow to make a meta macro out 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) static int _compilecode(const char **re_loc, rcode *prog, int sizecode)
{ {
const char *re = *re_loc; const char *re = *re_loc;
@@ -316,8 +317,8 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode)
i++; i++;
icnt++; icnt++;
} }
prog->len += maxcnt * icnt;
} }
prog->len += maxcnt * icnt;
break; break;
case '?': case '?':
if (PC == term) goto syntax_error; 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; uc_len(c, re) re += c;
} }
if (alt_label) { if (code && alt_label) {
EMIT(alt_label, REL(alt_label, PC) + 1); EMIT(alt_label, REL(alt_label, PC) + 1);
for (int alts = altc; altc; altc--) { for (int alts = altc; altc; altc--) {
int at = alt_stack[alts-altc]+altc*3; int at = alt_stack[alts-altc]+altc*3;