MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _compile_charset

Function _compile_charset

tools/python-3.11.9-amd64/Lib/re/_compiler.py:216–241  ·  view source on GitHub ↗
(charset, flags, code)

Source from the content-addressed store, hash-verified

214 raise error("internal: unsupported operand type %r" % (op,))
215
216def _compile_charset(charset, flags, code):
217 # compile charset subprogram
218 emit = code.append
219 for op, av in charset:
220 emit(op)
221 if op is NEGATE:
222 pass
223 elif op is LITERAL:
224 emit(av)
225 elif op is RANGE or op is RANGE_UNI_IGNORE:
226 emit(av[0])
227 emit(av[1])
228 elif op is CHARSET:
229 code.extend(av)
230 elif op is BIGCHARSET:
231 code.extend(av)
232 elif op is CATEGORY:
233 if flags & SRE_FLAG_LOCALE:
234 emit(CH_LOCALE[av])
235 elif flags & SRE_FLAG_UNICODE:
236 emit(CH_UNICODE[av])
237 else:
238 emit(av)
239 else:
240 raise error("internal: unsupported set operator %r" % (op,))
241 emit(FAILURE)
242
243def _optimize_charset(charset, iscased=None, fixup=None, fixes=None):
244 # internal: optimize character set

Callers 2

_compileFunction · 0.85
_compile_infoFunction · 0.85

Calls 2

errorClass · 0.70
extendMethod · 0.45

Tested by

no test coverage detected