(charset, flags, code)
| 214 | raise error("internal: unsupported operand type %r" % (op,)) |
| 215 | |
| 216 | def _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 | |
| 243 | def _optimize_charset(charset, iscased=None, fixup=None, fixes=None): |
| 244 | # internal: optimize character set |
no test coverage detected