(charset, flags, code)
| 219 | raise PatternError(f"internal: unsupported operand type {op!r}") |
| 220 | |
| 221 | def _compile_charset(charset, flags, code): |
| 222 | # compile charset subprogram |
| 223 | emit = code.append |
| 224 | for op, av in charset: |
| 225 | emit(op) |
| 226 | if op is NEGATE: |
| 227 | pass |
| 228 | elif op is LITERAL: |
| 229 | emit(av) |
| 230 | elif op is RANGE or op is RANGE_UNI_IGNORE: |
| 231 | emit(av[0]) |
| 232 | emit(av[1]) |
| 233 | elif op is CHARSET: |
| 234 | code.extend(av) |
| 235 | elif op is BIGCHARSET: |
| 236 | code.extend(av) |
| 237 | elif op is CATEGORY: |
| 238 | if flags & SRE_FLAG_LOCALE: |
| 239 | emit(CH_LOCALE[av]) |
| 240 | elif flags & SRE_FLAG_UNICODE: |
| 241 | emit(CH_UNICODE[av]) |
| 242 | else: |
| 243 | emit(av) |
| 244 | else: |
| 245 | raise PatternError(f"internal: unsupported set operator {op!r}") |
| 246 | emit(FAILURE) |
| 247 | |
| 248 | def _optimize_charset(charset, iscased=None, fixup=None, fixes=None): |
| 249 | # internal: optimize character set |
no test coverage detected
searching dependent graphs…