Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
43c9350f
Kaydet (Commit)
43c9350f
authored
Ara 29, 1997
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Getting uglier. But it doesn't completely bomb except for some table stuff.
I'll get to it when I can.
üst
78f8e982
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
80 deletions
+146
-80
partparse.py
Doc/partparse.py
+73
-40
partparse.py
Doc/tools/partparse.py
+73
-40
No files found.
Doc/partparse.py
Dosyayı görüntüle @
43c9350f
...
...
@@ -827,7 +827,7 @@ class Wobj:
self
.
data
=
self
.
data
+
data
# ignore these commands
ignoredcommands
=
(
'bcode'
,
'ecode'
,
'hline'
,
'
fulllineitems'
,
'
small'
,
'/'
)
ignoredcommands
=
(
'bcode'
,
'ecode'
,
'hline'
,
'small'
,
'/'
)
# map commands like these to themselves as plaintext
wordsselves
=
(
'UNIX'
,
'ABC'
,
'C'
,
'ASCII'
,
'EOF'
,
'LaTeX'
)
# \{ --> {, \} --> }, etc
...
...
@@ -1191,18 +1191,19 @@ def do_opcodedesc(length, buf, pp, i):
del
pp
[
i
:
newi
]
length
=
length
-
(
newi
-
i
)
ch
.
chtype
=
chunk_type
[
CSLINE
]
ch
.
data
=
"def
cv
"
ch
.
chtype
=
CSLINE
ch
.
data
=
"def
fn
"
cslinearg
=
[
chunk
(
GROUP
,
wh
,
[
chunk
(
PLAIN
,
wh
,
"data
"
)]),
chunk
(
PLAIN
,
wh
,
' '
),
cslinearg
=
[
#chunk(GROUP, wh, [chunk(PLAIN, wh, "exception
")]),
chunk
(
PLAIN
,
wh
,
'
exception
'
),
chunk
(
GROUP
,
wh
,
[
chunk
(
PLAIN
,
wh
,
"byte code instruction"
)]),
chunk
(
PLAIN
,
wh
,
' '
),
dataname
,
chunk
(
PLAIN
,
wh
,
' '
),
pp
[
i
],
]
pp
.
insert
(
i
,
chunk
(
GROUP
,
wh
,
cslinearg
))
i
,
length
=
i
+
1
,
length
+
1
pp
[
i
]
=
chunk
(
GROUP
,
wh
,
cslinearg
)
hist
.
command
=
ch
.
data
return
length
,
i
...
...
@@ -1224,7 +1225,7 @@ def rm_commas_etc(text):
result
=
result
+
text
break
if
changed
:
print
'Warning: nodename chang
h
ed to '
+
`result`
print
'Warning: nodename changed to '
+
`result`
return
result
...
...
@@ -1232,6 +1233,10 @@ def rm_commas_etc(text):
flags
=
{
'texi'
:
1
}
# map of \label{} to node names
label_nodes
=
{}
##
## changeit: the actual routine, that changes the contents of the parsed
## chunks
...
...
@@ -1260,12 +1265,22 @@ def changeit(buf, pp):
# check for {\em ...} constructs
if
ch
.
data
and
\
ch
.
data
[
0
]
.
chtype
==
chunk_type
[
CSNAME
]
and
\
s
(
buf
,
ch
.
data
[
0
]
.
data
)
in
fontchanges
.
keys
(
):
fontchanges
.
has_key
(
s
(
buf
,
ch
.
data
[
0
]
.
data
)
):
k
=
s
(
buf
,
ch
.
data
[
0
]
.
data
)
del
ch
.
data
[
0
]
pp
.
insert
(
i
-
1
,
chunk
(
CSNAME
,
ch
.
where
,
fontchanges
[
k
]))
length
,
i
=
length
+
1
,
i
+
1
elif
ch
.
data
:
k
=
s
(
buf
,
ch
.
data
[
0
]
.
data
)
if
k
==
"fulllineitems"
:
del
ch
.
data
[
0
]
data
=
ch
.
data
pp
[
i
-
1
:
i
]
=
data
i
=
i
-
1
length
=
length
+
len
(
data
)
-
1
continue
# recursively parse the contents of the group
changeit
(
buf
,
ch
.
data
)
...
...
@@ -1424,6 +1439,9 @@ def changeit(buf, pp):
length
=
length
+
len
(
chunks
)
-
1
i
=
i
+
len
(
chunks
)
-
1
elif
envname
in
(
'sloppypar'
,
'flushleft'
):
pass
else
:
print
'WARNING: don
\'
t know what to do with env '
+
`envname`
...
...
@@ -1436,48 +1454,48 @@ def changeit(buf, pp):
i
,
length
=
i
-
1
,
length
-
1
if
envname
==
'verbatim'
:
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'example'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'example'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
==
'itemize'
:
hist
.
itemizenesting
=
hist
.
itemizenesting
-
1
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'itemize'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'itemize'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
==
'enumerate'
:
hist
.
enumeratenesting
=
hist
.
enumeratenesting
-
1
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'enumerate'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'enumerate'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
==
'description'
:
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
(
envname
==
'tableiii'
)
or
(
envname
==
'tableii'
):
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
i
,
length
=
i
+
2
,
length
+
2
pp
.
insert
(
i
,
chunk
(
DENDLINE
,
ch
.
where
,
'
\n
'
))
i
,
length
=
i
+
1
,
length
+
1
elif
envname
in
(
'funcdesc'
,
'excdesc'
,
'datadesc'
):
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
hist
.
command
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
hist
.
command
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
in
(
'seealso'
,
'opcodedesc'
):
elif
envname
==
'opcodedesc'
:
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
"deffn"
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
in
(
'seealso'
,
'sloppypar'
,
'flushleft'
):
pass
else
:
...
...
@@ -1553,6 +1571,10 @@ def changeit(buf, pp):
del
pp
[
i
:
newi
]
length
=
length
-
(
newi
-
i
)
elif
s_buf_data
==
"fulllineitems"
:
del
pp
[
i
-
1
]
i
,
length
=
i
-
1
,
length
-
1
elif
s_buf_data
==
'item'
:
ch
.
chtype
=
chunk_type
[
CSLINE
]
length
,
newi
=
getoptarg
(
length
,
buf
,
pp
,
i
)
...
...
@@ -1828,12 +1850,6 @@ def changeit(buf, pp):
del
pp
[
i
:
newi
]
length
=
length
-
(
newi
-
i
)
## ingroupch.append(chunk(PLAIN, ch.where, ' '))
## ingroupch.append(chunk(CSNAME, ch.where, 'r'))
## ingroupch.append(chunk(GROUP, ch.where, [
## chunk(PLAIN, ch.where,
## '(built-in)')]))
pp
.
insert
(
i
,
chunk
(
GROUP
,
ch
.
where
,
ingroupch
))
length
,
i
=
length
+
1
,
i
+
1
...
...
@@ -2048,13 +2064,30 @@ def changeit(buf, pp):
i
=
i
-
1
length
=
length
+
len
(
data
)
-
2
elif
s_buf_data
==
"quad"
:
ch
.
chtype
=
PLAIN
ch
.
data
=
" "
elif
s_buf_data
in
(
'noindent'
,
'indexsubitem'
):
pass
elif
s_buf_data
==
'label'
:
name
=
s
(
buf
,
pp
[
i
]
.
data
[
0
]
.
data
)
del
pp
[
i
-
1
:
i
+
1
]
length
=
length
-
2
i
=
i
-
1
label_nodes
[
name
]
=
hist
.
nodenames
[
-
1
]
elif
s_buf_data
==
'ref'
:
name
=
s
(
buf
,
pp
[
i
]
.
data
[
0
]
.
data
)
if
label_nodes
.
has_key
(
name
):
pp
[
i
]
.
data
[
0
]
.
data
=
label_nodes
[
name
]
else
:
pp
[
i
-
1
:
i
+
1
]
=
[
chunk
(
PLAIN
,
ch
.
where
,
"(unknown node reference:
%
s)"
%
name
)]
length
=
length
-
1
print
"WARNING: unknown node label"
,
`name`
else
:
print
"don't know what to do with keyword "
+
s_buf_data
...
...
Doc/tools/partparse.py
Dosyayı görüntüle @
43c9350f
...
...
@@ -827,7 +827,7 @@ class Wobj:
self
.
data
=
self
.
data
+
data
# ignore these commands
ignoredcommands
=
(
'bcode'
,
'ecode'
,
'hline'
,
'
fulllineitems'
,
'
small'
,
'/'
)
ignoredcommands
=
(
'bcode'
,
'ecode'
,
'hline'
,
'small'
,
'/'
)
# map commands like these to themselves as plaintext
wordsselves
=
(
'UNIX'
,
'ABC'
,
'C'
,
'ASCII'
,
'EOF'
,
'LaTeX'
)
# \{ --> {, \} --> }, etc
...
...
@@ -1191,18 +1191,19 @@ def do_opcodedesc(length, buf, pp, i):
del
pp
[
i
:
newi
]
length
=
length
-
(
newi
-
i
)
ch
.
chtype
=
chunk_type
[
CSLINE
]
ch
.
data
=
"def
cv
"
ch
.
chtype
=
CSLINE
ch
.
data
=
"def
fn
"
cslinearg
=
[
chunk
(
GROUP
,
wh
,
[
chunk
(
PLAIN
,
wh
,
"data
"
)]),
chunk
(
PLAIN
,
wh
,
' '
),
cslinearg
=
[
#chunk(GROUP, wh, [chunk(PLAIN, wh, "exception
")]),
chunk
(
PLAIN
,
wh
,
'
exception
'
),
chunk
(
GROUP
,
wh
,
[
chunk
(
PLAIN
,
wh
,
"byte code instruction"
)]),
chunk
(
PLAIN
,
wh
,
' '
),
dataname
,
chunk
(
PLAIN
,
wh
,
' '
),
pp
[
i
],
]
pp
.
insert
(
i
,
chunk
(
GROUP
,
wh
,
cslinearg
))
i
,
length
=
i
+
1
,
length
+
1
pp
[
i
]
=
chunk
(
GROUP
,
wh
,
cslinearg
)
hist
.
command
=
ch
.
data
return
length
,
i
...
...
@@ -1224,7 +1225,7 @@ def rm_commas_etc(text):
result
=
result
+
text
break
if
changed
:
print
'Warning: nodename chang
h
ed to '
+
`result`
print
'Warning: nodename changed to '
+
`result`
return
result
...
...
@@ -1232,6 +1233,10 @@ def rm_commas_etc(text):
flags
=
{
'texi'
:
1
}
# map of \label{} to node names
label_nodes
=
{}
##
## changeit: the actual routine, that changes the contents of the parsed
## chunks
...
...
@@ -1260,12 +1265,22 @@ def changeit(buf, pp):
# check for {\em ...} constructs
if
ch
.
data
and
\
ch
.
data
[
0
]
.
chtype
==
chunk_type
[
CSNAME
]
and
\
s
(
buf
,
ch
.
data
[
0
]
.
data
)
in
fontchanges
.
keys
(
):
fontchanges
.
has_key
(
s
(
buf
,
ch
.
data
[
0
]
.
data
)
):
k
=
s
(
buf
,
ch
.
data
[
0
]
.
data
)
del
ch
.
data
[
0
]
pp
.
insert
(
i
-
1
,
chunk
(
CSNAME
,
ch
.
where
,
fontchanges
[
k
]))
length
,
i
=
length
+
1
,
i
+
1
elif
ch
.
data
:
k
=
s
(
buf
,
ch
.
data
[
0
]
.
data
)
if
k
==
"fulllineitems"
:
del
ch
.
data
[
0
]
data
=
ch
.
data
pp
[
i
-
1
:
i
]
=
data
i
=
i
-
1
length
=
length
+
len
(
data
)
-
1
continue
# recursively parse the contents of the group
changeit
(
buf
,
ch
.
data
)
...
...
@@ -1424,6 +1439,9 @@ def changeit(buf, pp):
length
=
length
+
len
(
chunks
)
-
1
i
=
i
+
len
(
chunks
)
-
1
elif
envname
in
(
'sloppypar'
,
'flushleft'
):
pass
else
:
print
'WARNING: don
\'
t know what to do with env '
+
`envname`
...
...
@@ -1436,48 +1454,48 @@ def changeit(buf, pp):
i
,
length
=
i
-
1
,
length
-
1
if
envname
==
'verbatim'
:
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'example'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'example'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
==
'itemize'
:
hist
.
itemizenesting
=
hist
.
itemizenesting
-
1
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'itemize'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'itemize'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
==
'enumerate'
:
hist
.
enumeratenesting
=
hist
.
enumeratenesting
-
1
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'enumerate'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'enumerate'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
==
'description'
:
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
(
envname
==
'tableiii'
)
or
(
envname
==
'tableii'
):
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
'table'
)])]
i
,
length
=
i
+
2
,
length
+
2
pp
.
insert
(
i
,
chunk
(
DENDLINE
,
ch
.
where
,
'
\n
'
))
i
,
length
=
i
+
1
,
length
+
1
elif
envname
in
(
'funcdesc'
,
'excdesc'
,
'datadesc'
):
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
hist
.
command
)])]
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
hist
.
command
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
in
(
'seealso'
,
'opcodedesc'
):
elif
envname
==
'opcodedesc'
:
pp
[
i
:
i
]
=
[
chunk
(
CSLINE
,
ch
.
where
,
'end'
),
chunk
(
GROUP
,
ch
.
where
,
[
chunk
(
PLAIN
,
ch
.
where
,
"deffn"
)])]
i
,
length
=
i
+
2
,
length
+
2
elif
envname
in
(
'seealso'
,
'sloppypar'
,
'flushleft'
):
pass
else
:
...
...
@@ -1553,6 +1571,10 @@ def changeit(buf, pp):
del
pp
[
i
:
newi
]
length
=
length
-
(
newi
-
i
)
elif
s_buf_data
==
"fulllineitems"
:
del
pp
[
i
-
1
]
i
,
length
=
i
-
1
,
length
-
1
elif
s_buf_data
==
'item'
:
ch
.
chtype
=
chunk_type
[
CSLINE
]
length
,
newi
=
getoptarg
(
length
,
buf
,
pp
,
i
)
...
...
@@ -1828,12 +1850,6 @@ def changeit(buf, pp):
del
pp
[
i
:
newi
]
length
=
length
-
(
newi
-
i
)
## ingroupch.append(chunk(PLAIN, ch.where, ' '))
## ingroupch.append(chunk(CSNAME, ch.where, 'r'))
## ingroupch.append(chunk(GROUP, ch.where, [
## chunk(PLAIN, ch.where,
## '(built-in)')]))
pp
.
insert
(
i
,
chunk
(
GROUP
,
ch
.
where
,
ingroupch
))
length
,
i
=
length
+
1
,
i
+
1
...
...
@@ -2048,13 +2064,30 @@ def changeit(buf, pp):
i
=
i
-
1
length
=
length
+
len
(
data
)
-
2
elif
s_buf_data
==
"quad"
:
ch
.
chtype
=
PLAIN
ch
.
data
=
" "
elif
s_buf_data
in
(
'noindent'
,
'indexsubitem'
):
pass
elif
s_buf_data
==
'label'
:
name
=
s
(
buf
,
pp
[
i
]
.
data
[
0
]
.
data
)
del
pp
[
i
-
1
:
i
+
1
]
length
=
length
-
2
i
=
i
-
1
label_nodes
[
name
]
=
hist
.
nodenames
[
-
1
]
elif
s_buf_data
==
'ref'
:
name
=
s
(
buf
,
pp
[
i
]
.
data
[
0
]
.
data
)
if
label_nodes
.
has_key
(
name
):
pp
[
i
]
.
data
[
0
]
.
data
=
label_nodes
[
name
]
else
:
pp
[
i
-
1
:
i
+
1
]
=
[
chunk
(
PLAIN
,
ch
.
where
,
"(unknown node reference:
%
s)"
%
name
)]
length
=
length
-
1
print
"WARNING: unknown node label"
,
`name`
else
:
print
"don't know what to do with keyword "
+
s_buf_data
...
...
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