I was translating to C3 language and found these two bugs.
slre.c: 322 line, change this
int i, result = -1, is_anchored = info->brackets[0].ptr[0] == '^';
as follows
int result = -1;
bool is_anchored = (info.brackets[0].ptr[0] == '^') || (info.brackets[0].ptr[0] == '(' && info.brackets[0].ptr[1] == '^');
to pass this test
ASSERT(slre_match("(^o)", "fooklmn", 7, NULL, 0, 0) == SLRE_NO_MATCH);
slre.c: 387 line, add following
FAIL_IF(i >= re_len - 1, SLRE_INVALID_METACHARACTER);
if (i >= (re_len - 2)) {
if (re[i+1] == ')') {
if (info.brackets[info.num_brackets-1].len == -1) {
return INVALID_METACHARACTER;
}
}
}
to pass this test
ASSERT(slre_match("(\\)", "a", 1, NULL, 0, 0) == SLRE_INVALID_METACHARACTER);
I was translating to C3 language and found these two bugs.
slre.c: 322 line, change this
as follows
to pass this test
slre.c: 387 line, add following
to pass this test