This commit is contained in:
Benjamin Peterson 2014-11-30 11:51:16 -05:00
commit 16e802f4ae
4 changed files with 12 additions and 67 deletions

View file

@ -351,11 +351,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):