mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
- fixed code generation error in multiline mode
- fixed parser flag propagation (of all stupid bugs...)
This commit is contained in:
parent
361b583e88
commit
55a4f4a528
2 changed files with 8 additions and 7 deletions
|
@ -31,7 +31,7 @@ DIGITS = tuple(string.digits)
|
|||
OCTDIGITS = tuple("01234567")
|
||||
HEXDIGITS = tuple("0123456789abcdefABCDEF")
|
||||
|
||||
WHITESPACE = string.whitespace
|
||||
WHITESPACE = tuple(string.whitespace)
|
||||
|
||||
ESCAPES = {
|
||||
r"\a": (LITERAL, 7),
|
||||
|
@ -296,7 +296,7 @@ def _branch(pattern, items):
|
|||
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.
|
||||
|
||||
|
@ -468,7 +468,7 @@ def _parse(source, state, flags=0):
|
|||
char = source.get()
|
||||
b = []
|
||||
while 1:
|
||||
p = _parse(source, state, flags)
|
||||
p = _parse(source, state)
|
||||
if source.next == ")":
|
||||
if b:
|
||||
b.append(p)
|
||||
|
@ -495,7 +495,7 @@ def _parse(source, state, flags=0):
|
|||
else:
|
||||
group = state.getgroup(name)
|
||||
while 1:
|
||||
p = _parse(source, state, flags)
|
||||
p = _parse(source, state)
|
||||
if source.match(")"):
|
||||
if b:
|
||||
b.append(p)
|
||||
|
@ -532,9 +532,10 @@ def parse(pattern, flags=0):
|
|||
# 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue