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
0b7b4b8a
Commit
0b7b4b8a
authored
Sep 18, 2000
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
satisfy the tabnanny
parent
9082cdd0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
358 additions
and
358 deletions
+358
-358
Tools/scripts/eptags.py
Tools/scripts/eptags.py
+15
-14
Tools/scripts/parseentities.py
Tools/scripts/parseentities.py
+21
-21
Tools/scripts/trace.py
Tools/scripts/trace.py
+322
-323
No files found.
Tools/scripts/eptags.py
View file @
0b7b4b8a
...
@@ -24,32 +24,33 @@ matcher = re.compile(expr)
...
@@ -24,32 +24,33 @@ matcher = re.compile(expr)
def treat_file(file, outfp):
def treat_file(file, outfp):
"""Append tags found in file named '
file
' to the open file '
outfp
'"""
"""Append tags found in file named '
file
' to the open file '
outfp
'"""
try:
try:
fp = open(file, 'r')
fp = open(file, 'r')
except:
except:
sys.stderr.write('
Cannot
open
%
s
\
n
'%file)
sys.stderr.write('
Cannot
open
%
s
\
n
'%file)
return
return
charno = 0
charno = 0
lineno = 0
lineno = 0
tags = []
tags = []
size = 0
size = 0
while 1:
while 1:
line = fp.readline()
line = fp.readline()
if not line: break
if not line:
lineno = lineno + 1
break
m = matcher.search(line)
lineno = lineno + 1
if m:
m = matcher.search(line)
tag = m.group(0) + '
\
177
%
d
,
%
d
\
n
'%(lineno,charno)
if m:
tags.append(tag)
tag = m.group(0) + '
\
177
%
d
,
%
d
\
n
'%(lineno,charno)
size = size + len(tag)
tags.append(tag)
charno = charno + len(line)
size = size + len(tag)
charno = charno + len(line)
outfp.write('
\
f
\
n
%
s
,
%
d
\
n
'%(file,size))
outfp.write('
\
f
\
n
%
s
,
%
d
\
n
'%(file,size))
for tag in tags:
for tag in tags:
outfp.write(tag)
outfp.write(tag)
def main():
def main():
outfp = open('
TAGS
', '
w
')
outfp = open('
TAGS
', '
w
')
for file in sys.argv[1:]:
for file in sys.argv[1:]:
treat_file(file, outfp)
treat_file(file, outfp)
if __name__=="__main__":
if __name__=="__main__":
main()
main()
Tools/scripts/parseentities.py
View file @
0b7b4b8a
...
@@ -21,15 +21,15 @@ def parse(text,pos=0,endpos=None):
...
@@ -21,15 +21,15 @@ def parse(text,pos=0,endpos=None):
pos
=
0
pos
=
0
if
endpos
is
None
:
if
endpos
is
None
:
endpos
=
len
(
text
)
endpos
=
len
(
text
)
d
=
{}
d
=
{}
while
1
:
while
1
:
m
=
entityRE
.
search
(
text
,
pos
,
endpos
)
m
=
entityRE
.
search
(
text
,
pos
,
endpos
)
if
not
m
:
if
not
m
:
break
break
name
,
charcode
,
comment
=
m
.
groups
()
name
,
charcode
,
comment
=
m
.
groups
()
d
[
name
]
=
charcode
,
comment
d
[
name
]
=
charcode
,
comment
pos
=
m
.
end
()
pos
=
m
.
end
()
return
d
return
d
def
writefile
(
f
,
defs
):
def
writefile
(
f
,
defs
):
...
@@ -38,27 +38,27 @@ def writefile(f,defs):
...
@@ -38,27 +38,27 @@ def writefile(f,defs):
items
=
defs
.
items
()
items
=
defs
.
items
()
items
.
sort
()
items
.
sort
()
for
name
,(
charcode
,
comment
)
in
items
:
for
name
,(
charcode
,
comment
)
in
items
:
if
charcode
[:
2
]
==
'&#'
:
if
charcode
[:
2
]
==
'&#'
:
code
=
int
(
charcode
[
2
:
-
1
])
code
=
int
(
charcode
[
2
:
-
1
])
if
code
<
256
:
if
code
<
256
:
charcode
=
"'
\
%o
'
"
%
code
charcode
=
"'
\
%o
'
"
%
code
else
:
else
:
charcode
=
repr
(
charcode
)
charcode
=
repr
(
charcode
)
else
:
else
:
charcode
=
repr
(
charcode
)
charcode
=
repr
(
charcode
)
comment
=
TextTools
.
collapse
(
comment
)
comment
=
TextTools
.
collapse
(
comment
)
f
.
write
(
" '%s':
\
t
%s,
\
t
# %s
\
n
"
%
(
name
,
charcode
,
comment
))
f
.
write
(
" '%s':
\
t
%s,
\
t
# %s
\
n
"
%
(
name
,
charcode
,
comment
))
f
.
write
(
'
\
n
}
\
n
'
)
f
.
write
(
'
\
n
}
\
n
'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
>
1
:
if
len
(
sys
.
argv
)
>
1
:
infile
=
open
(
sys
.
argv
[
1
])
infile
=
open
(
sys
.
argv
[
1
])
else
:
else
:
infile
=
sys
.
stdin
infile
=
sys
.
stdin
if
len
(
sys
.
argv
)
>
2
:
if
len
(
sys
.
argv
)
>
2
:
outfile
=
open
(
sys
.
argv
[
2
],
'w'
)
outfile
=
open
(
sys
.
argv
[
2
],
'w'
)
else
:
else
:
outfile
=
sys
.
stdout
outfile
=
sys
.
stdout
text
=
infile
.
read
()
text
=
infile
.
read
()
defs
=
parse
(
text
)
defs
=
parse
(
text
)
writefile
(
outfile
,
defs
)
writefile
(
outfile
,
defs
)
...
...
Tools/scripts/trace.py
View file @
0b7b4b8a
This diff is collapsed.
Click to expand it.
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