and i ask also what's the problem with this function:

def _code(p, flags):

        flags = p.state.flags | flags
        code = []

        # compile info block
        sre_compile._compile_info(code, p, flags)

        # compile the pattern
        sre_compile._compile(code, p.data, flags)

        code.append(SUCCESS)

        return code


‫בתאריך יום א׳, 26 ביוני 2022 ב-13:48 מאת נתי שטרן <‪nsh...@gmail.com‬‏>:‬

> def compile(p, flags=0):
>         # internal: convert pattern list to internal format
>
>         if (isinstance(p,str)):
>             pattern = p
>             p = sre_parse.parse(p, flags)
>         else:
>             pattern = None
>
>         code = _code(p, flags)
>
>         if flags & SRE_FLAG_DEBUG:
>             print()
>             dis(code)
>
>         # map in either direction
>         groupindex = p.state.groupdict
>         indexgroup = [None] * p.state.groups
>         for k, i in groupindex.items():
>             indexgroup[i] = k
>
>         return sre_compile.compile(
>             pattern, flags | p.state.flags, code,
>             p.state.groups-1,
>             groupindex, tuple(indexgroup)
>         )
>
>
> --
> <https://netanel.ml>
>


-- 
<https://netanel.ml>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to