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
5b2355af
Commit
5b2355af
authored
Jul 11, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New version from Jeffrey after I complained about some glaring bugs.
parent
d158cbc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
Lib/re.py
Lib/re.py
+6
-6
Modules/reopmodule.c
Modules/reopmodule.c
+8
-0
No files found.
Lib/re.py
View file @
5b2355af
...
...
@@ -137,7 +137,7 @@ class MatchObject:
except
(
KeyError
,
TypeError
):
raise
IndexError
return
self
.
regs
[
i
]
def
group
(
i
):
def
group
(
self
,
i
):
if
type
(
i
)
==
type
(
''
):
try
:
i
=
self
.
re
.
groupindex
[
i
]
...
...
@@ -188,12 +188,13 @@ class Set(Instruction):
name
=
'set'
def
__init__
(
self
,
set
):
self
.
set
=
set
print
set
Instruction
.
__init__
(
self
,
chr
(
3
),
33
)
def
assemble
_set
(
self
,
position
,
labels
):
def
assemble
(
self
,
position
,
labels
):
result
=
self
.
opcode
temp
=
0
for
i
,
c
in
map
(
lambda
x
:
(
x
,
chr
(
x
)),
range
(
256
)):
if
c
in
self
.
set
[
2
]
:
if
c
in
self
.
set
:
temp
=
temp
|
(
1
<<
(
i
&
7
))
if
(
i
%
8
)
==
7
:
result
=
result
+
chr
(
temp
)
...
...
@@ -203,7 +204,7 @@ class Set(Instruction):
result
=
'%-15s'
%
(
self
.
name
)
self
.
set
.
sort
()
for
char
in
self
.
set
:
result
=
result
+
`char`
result
=
result
+
char
return
result
class
Exact
(
Instruction
):
...
...
@@ -768,7 +769,7 @@ def compile(pattern, flags=0):
expr
.
append
(
Label
(
label
))
label
=
label
+
1
if
stack
[
-
1
][
0
]
[
1
]
>
0
:
if
stack
[
-
1
][
0
]
.
register
>
0
:
expr
=
[
StartMemory
(
stack
[
-
1
][
0
].
register
)]
+
\
expr
+
\
[
EndMemory
(
stack
[
-
1
][
0
].
register
)]
...
...
@@ -1075,7 +1076,6 @@ def compile(pattern, flags=0):
if
next
not
in
set
:
set
.
append
(
next
)
last
=
next
if
pattern
[
index
]
!=
']'
:
raise
error
,
'incomplete set'
...
...
Modules/reopmodule.c
View file @
5b2355af
...
...
@@ -119,6 +119,10 @@ reop_match(self, args)
PyErr_SetString
(
ReopError
,
"match failure"
);
return
NULL
;
}
if
(
result
==
-
1
)
{
Py_INCREF
(
Py_None
);
return
Py_None
;
}
return
makeresult
(
&
re_regs
,
num_regs
);
}
...
...
@@ -162,6 +166,10 @@ reop_search(self, args)
PyErr_SetString
(
ReopError
,
"match failure"
);
return
NULL
;
}
if
(
result
==
-
1
)
{
Py_INCREF
(
Py_None
);
return
Py_None
;
}
return
makeresult
(
&
re_regs
,
num_regs
);
}
...
...
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