diff --git a/README b/README index 1d46f83..e3712c0 100644 --- a/README +++ b/README @@ -29,7 +29,6 @@ to that. * Matcher does not take size of string as param, it checks for '\0' instead, so that the user does not need to waste time taking strlen() * Highly optimized source code, probably 2x faster than re1.5 -* Support for named character classes: \d \D \s \S \w \W was dropped cause it's redundant. * Support for quoted chars in regex. * Support for ^, $ assertions in regex. * Support for repetition operator {n} and {n,m}. diff --git a/pike.c b/pike.c index ded28a0..b163488 100644 --- a/pike.c +++ b/pike.c @@ -86,8 +86,7 @@ enum enum { RE_SUCCESS = 0, RE_SYNTAX_ERROR = -2, - RE_UNSUPPORTED_ESCAPE = -3, - RE_UNSUPPORTED_SYNTAX = -4, + RE_UNSUPPORTED_SYNTAX = -3, }; typedef struct rsub rsub; @@ -229,12 +228,6 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode) prog->len++; for (cnt = 0; *re != ']'; cnt++) { if (!*re) goto syntax_error; - if (*re == '\\') { - re++; - if (!*re) goto syntax_error; - if (*re != '\\' && *re != ']') - goto unsupported_escape; - } uc_code(c, re) EMIT(PC++, c); uc_len(c, re) if (re[c] == '-' && re[c+1] != ']') @@ -398,9 +391,6 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode) syntax_error: *re_loc = re; return RE_SYNTAX_ERROR; -unsupported_escape: - *re_loc = re; - return RE_UNSUPPORTED_ESCAPE; } int re_sizecode(const char *re) diff --git a/test.sh b/test.sh index 0e6eadb..6fd1694 100755 --- a/test.sh +++ b/test.sh @@ -103,6 +103,8 @@ qwerty.*$ (a|aa)* (a|aa)* (aaaa|aaa|a){3,4} +(a)(a) +(a){2} " input="\ abcdef @@ -207,6 +209,8 @@ aaaa aaaaa aaaaaa aaaaaaaaaa +aaaa +aaaa " expect="\ (0,3) @@ -311,6 +315,8 @@ expect="\ (0,5)(4,5) (0,6)(5,6) (0,10)(9,10) +(0,2)(0,1)(1,2) +(0,2)(1,2) (0,0) "