backout 9fcf4008b626 (#9179) for further consideration

This commit is contained in:
Benjamin Peterson 2014-11-30 11:49:00 -05:00
parent b7138e24e3
commit 66323415c7
4 changed files with 12 additions and 67 deletions

View file

@ -352,11 +352,10 @@ class Scanner:
s = sre_parse.Pattern()
s.flags = flags
for phrase, action in lexicon:
gid = s.opengroup()
p.append(sre_parse.SubPattern(s, [
(SUBPATTERN, (gid, sre_parse.parse(phrase, flags))),
(SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))),
]))
s.closegroup(gid, p[-1])
s.groups = len(p)+1
p = sre_parse.SubPattern(s, [(BRANCH, (None, p))])
self.scanner = sre_compile.compile(p)
def scan(self, string):