re cleanup

pull/28/head
A. R. Shajii 2022-07-09 10:07:15 -04:00
parent ec4b503e24
commit fcbcfb3540
2 changed files with 6 additions and 12 deletions

View File

@ -141,7 +141,7 @@ SEQ_FUNC Span *seq_re_match(Regex *re, seq_int_t anchor, seq_str_t s, seq_int_t
auto *spans = (Span *)seq_alloc_atomic(num_groups * sizeof(Span));
unsigned i = 0;
for (const auto &it : groups) {
if (it.data() == NULL) {
if (it.data() == nullptr) {
spans[i++] = {-1, -1};
} else {
spans[i++] = {static_cast<seq_int_t>(it.data() - s.str),

View File

@ -29,7 +29,7 @@ class Span:
return not (self.start == -1 and self.end == -1)
@C
@nocapture
@pure
def seq_re_match(re: cobj,
anchor: int,
string: str,
@ -61,13 +61,6 @@ def seq_re_group_name_to_index(re: cobj, name: str) -> int:
def seq_re_group_index_to_name(re: cobj, index: int) -> str:
pass
@C
@nocapture
def seq_re_pattern_groupindex(re: cobj,
names: Ptr[Ptr[str]],
indices: Ptr[Ptr[int]]) -> int:
pass
@C
@pure
def seq_re_pattern_error(re: cobj) -> str:
@ -83,6 +76,7 @@ def seq_re_purge() -> void:
pass
@C
@pure
def seq_re_compile(pattern: str, flags: int) -> cobj:
pass
@ -134,13 +128,13 @@ def finditer(pattern: str, string: str, flags: int = 0):
def findall(pattern: str, string: str, flags: int = 0):
return compile(pattern, flags).findall(string)
def split(pattern: str, string: str, maxsplit: int =0, flags: int = 0):
def split(pattern: str, string: str, maxsplit: int = 0, flags: int = 0):
return compile(pattern, flags).split(string, maxsplit)
def sub(pattern: str, repl, string: str, count: int =0, flags: int = 0):
def sub(pattern: str, repl, string: str, count: int = 0, flags: int = 0):
return compile(pattern, flags).sub(repl, string, count)
def subn(pattern: str, repl, string: str, count: int =0, flags: int = 0):
def subn(pattern: str, repl, string: str, count: int = 0, flags: int = 0):
return compile(pattern, flags).subn(repl, string, count)
def escape(pattern: str):