mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
work in lookbehind assertions in regular expressions.
This commit is contained in:
commit
6276b32799
4 changed files with 67 additions and 12 deletions
|
@ -351,10 +351,11 @@ class Scanner:
|
|||
s = sre_parse.Pattern()
|
||||
s.flags = flags
|
||||
for phrase, action in lexicon:
|
||||
gid = s.opengroup()
|
||||
p.append(sre_parse.SubPattern(s, [
|
||||
(SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))),
|
||||
(SUBPATTERN, (gid, sre_parse.parse(phrase, flags))),
|
||||
]))
|
||||
s.groups = len(p)+1
|
||||
s.closegroup(gid, p[-1])
|
||||
p = sre_parse.SubPattern(s, [(BRANCH, (None, p))])
|
||||
self.scanner = sre_compile.compile(p)
|
||||
def scan(self, string):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue