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
951e1458
Commit
951e1458
authored
Jun 30, 2000
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the usual
parent
564c69d2
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
713 additions
and
572 deletions
+713
-572
Lib/dos-8x3/sre_comp.py
Lib/dos-8x3/sre_comp.py
+192
-137
Lib/dos-8x3/sre_cons.py
Lib/dos-8x3/sre_cons.py
+24
-8
Lib/dos-8x3/sre_pars.py
Lib/dos-8x3/sre_pars.py
+471
-427
Lib/dos-8x3/test_has.py
Lib/dos-8x3/test_has.py
+26
-0
No files found.
Lib/dos-8x3/sre_comp.py
View file @
951e1458
This diff is collapsed.
Click to expand it.
Lib/dos-8x3/sre_cons.py
View file @
951e1458
...
...
@@ -23,6 +23,7 @@ SUCCESS = "success"
ANY
=
"any"
ASSERT
=
"assert"
ASSERT_NOT
=
"assert_not"
AT
=
"at"
BRANCH
=
"branch"
CALL
=
"call"
...
...
@@ -81,7 +82,7 @@ OPCODES = [
FAILURE
,
SUCCESS
,
ANY
,
ASSERT
,
ASSERT
,
ASSERT_NOT
,
AT
,
BRANCH
,
CALL
,
...
...
@@ -121,8 +122,8 @@ def makedict(list):
d
=
{}
i
=
0
for
item
in
list
:
d
[
item
]
=
i
i
=
i
+
1
d
[
item
]
=
i
i
=
i
+
1
return
d
OPCODES
=
makedict
(
OPCODES
)
...
...
@@ -176,12 +177,27 @@ SRE_FLAG_VERBOSE = 64
if
__name__
==
"__main__"
:
import
string
def
dump
(
f
,
d
,
prefix
):
items
=
d
.
items
()
items
.
sort
(
lambda
a
,
b
:
cmp
(
a
[
1
],
b
[
1
]))
for
k
,
v
in
items
:
f
.
write
(
"#define %s_%s %s
\
n
"
%
(
prefix
,
string
.
upper
(
k
),
v
))
items
=
d
.
items
()
items
.
sort
(
lambda
a
,
b
:
cmp
(
a
[
1
],
b
[
1
]))
for
k
,
v
in
items
:
f
.
write
(
"#define %s_%s %s
\
n
"
%
(
prefix
,
string
.
upper
(
k
),
v
))
f
=
open
(
"sre_constants.h"
,
"w"
)
f
.
write
(
"/* generated from sre_constants.py */
\
n
"
)
f
.
write
(
"""
\
/*
* Secret Labs' Regular Expression Engine
*
* regular expression matching engine
*
* NOTE: This file is generated by sre_constants.py. If you need
* to change anything in here, edit sre_constants.py and run it.
*
* Copyright (c) 1997-2000 by Secret Labs AB. All rights reserved.
*
* See the _sre.c file for information on usage and redistribution.
*/
"""
)
dump
(
f
,
OPCODES
,
"SRE_OP"
)
dump
(
f
,
ATCODES
,
"SRE"
)
dump
(
f
,
CHCODES
,
"SRE"
)
...
...
Lib/dos-8x3/sre_pars.py
View file @
951e1458
This diff is collapsed.
Click to expand it.
Lib/dos-8x3/test_has.py
0 → 100644
View file @
951e1458
# test the invariant that
# iff a==b then hash(a)==hash(b)
#
import
test_support
def
same_hash
(
*
objlist
):
# hash each object given an raise TestFailed if
# the hash values are not all the same
hashed
=
map
(
hash
,
objlist
)
for
h
in
hashed
[
1
:]:
if
h
!=
hashed
[
0
]:
raise
TestFailed
,
"hashed values differ: %s"
%
`objlist`
same_hash
(
1
,
1L
,
1.0
,
1.0
+
0.0j
)
same_hash
(
int
(
1
),
long
(
1
),
float
(
1
),
complex
(
1
))
same_hash
(
long
(
1.23e300
),
float
(
1.23e300
))
same_hash
(
float
(
0.5
),
complex
(
0.5
,
0.0
))
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