elif op is AT:
emit(OPCODES[op])
if flags & SRE_FLAG_MULTILINE:
- emit(ATCODES[AT_MULTILINE[av]])
+ emit(ATCODES[AT_MULTILINE.get(av, av)])
else:
emit(ATCODES[av])
elif op is BRANCH:
if type(p) in (type(""), type(u"")):
import sre_parse
pattern = p
- p = sre_parse.parse(p)
+ p = sre_parse.parse(p, flags)
else:
pattern = None
OCTDIGITS = tuple("01234567")
HEXDIGITS = tuple("0123456789abcdefABCDEF")
-WHITESPACE = string.whitespace
+WHITESPACE = tuple(string.whitespace)
ESCAPES = {
r"\a": (LITERAL, 7),
subpattern.append((BRANCH, (None, items)))
return subpattern
-def _parse(source, state, flags=0):
+def _parse(source, state):
# parse regular expression pattern into an operator list.
char = source.get()
b = []
while 1:
- p = _parse(source, state, flags)
+ p = _parse(source, state)
if source.next == ")":
if b:
b.append(p)
else:
group = state.getgroup(name)
while 1:
- p = _parse(source, state, flags)
+ p = _parse(source, state)
if source.match(")"):
if b:
b.append(p)
# parse 're' pattern into list of (opcode, argument) tuples
source = Tokenizer(pattern)
state = State()
+ state.flags = flags
b = []
while 1:
- p = _parse(source, state, flags)
+ p = _parse(source, state)
tail = source.get()
if tail == "|":
b.append(p)