Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
90a07913
Commit
90a07913
authored
Jun 30, 2000
by
Fredrik Lundh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- pedantic: make sure "python -t" doesn't complain...
parent
df02d0b3
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
587 additions
and
587 deletions
+587
-587
Lib/sre.py
Lib/sre.py
+11
-11
Lib/sre_compile.py
Lib/sre_compile.py
+153
-153
Lib/sre_parse.py
Lib/sre_parse.py
+418
-418
Lib/test/test_sre.py
Lib/test/test_sre.py
+5
-5
No files found.
Lib/sre.py
View file @
90a07913
...
...
@@ -98,7 +98,7 @@ def _subn(pattern, template, string, count=0):
if
callable
(
template
):
filter
=
template
else
:
template
=
sre_parse
.
parse_template
(
template
,
pattern
)
template
=
sre_parse
.
parse_template
(
template
,
pattern
)
def
filter
(
match
,
template
=
template
):
return
sre_parse
.
expand_template
(
template
,
match
)
n
=
i
=
0
...
...
@@ -109,11 +109,11 @@ def _subn(pattern, template, string, count=0):
m
=
c
.
search
()
if
not
m
:
break
b
,
e
=
m
.
span
()
b
,
e
=
m
.
span
()
if
i
<
b
:
append
(
string
[
i
:
b
])
append
(
filter
(
m
))
i
=
e
i
=
e
n
=
n
+
1
append
(
string
[
i
:])
return
string
[:
0
].
join
(
s
),
n
...
...
@@ -130,15 +130,15 @@ def _split(pattern, string, maxsplit=0):
m
=
c
.
search
()
if
not
m
:
break
b
,
e
=
m
.
span
()
if
b
==
e
:
if
i
>=
len
(
string
):
break
continue
b
,
e
=
m
.
span
()
if
b
==
e
:
if
i
>=
len
(
string
):
break
continue
append
(
string
[
i
:
b
])
if
g
and
b
!=
e
:
extend
(
m
.
groups
())
i
=
e
if
g
and
b
!=
e
:
extend
(
m
.
groups
())
i
=
e
n
=
n
+
1
append
(
string
[
i
:])
return
s
Lib/sre_compile.py
View file @
90a07913
This diff is collapsed.
Click to expand it.
Lib/sre_parse.py
View file @
90a07913
This diff is collapsed.
Click to expand it.
Lib/test/test_sre.py
View file @
90a07913
# FIXME: this is basically test_re.py, with a few
# FIXME: this is basically test_re.py, with a few
minor changes
import
sys
sys
.
path
=
[
'.'
]
+
sys
.
path
...
...
@@ -337,7 +337,7 @@ for t in tests:
print repr(repl)+'
should
be
'+repr(expected)
else:
print '
===
Failed
incorrectly
', t
continue
continue
# Try the match on a unicode string, and check that it
# still succeeds.
...
...
@@ -359,9 +359,9 @@ for t in tests:
if
pattern
[:
2
]
!=
'
\
\
B'
and
pattern
[
-
2
:]
!=
'
\
\
B'
:
obj
=
sre
.
compile
(
pattern
)
result
=
obj
.
search
(
s
,
result
.
start
(
0
),
result
.
end
(
0
)
+
1
)
if
result
==
None
:
print
'=== Failed on range-limited match'
,
t
result
=
obj
.
search
(
s
,
result
.
start
(
0
),
result
.
end
(
0
)
+
1
)
if
result
==
None
:
print
'=== Failed on range-limited match'
,
t
# Try the match with IGNORECASE enabled, and check that it
# still succeeds.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment