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
6dc9f0ec
Kaydet (Commit)
6dc9f0ec
authored
Tem 09, 2012
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merged upstream changes.
üst
a945ad1a
848245a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
highlight.py
Tools/scripts/highlight.py
+9
-1
No files found.
Tools/scripts/highlight.py
Dosyayı görüntüle @
6dc9f0ec
...
@@ -10,7 +10,7 @@ import keyword, tokenize, cgi, functools
...
@@ -10,7 +10,7 @@ import keyword, tokenize, cgi, functools
def
is_builtin
(
s
):
def
is_builtin
(
s
):
'Return True if s is the name of a builtin'
'Return True if s is the name of a builtin'
return
s
in
vars
(
__builtins__
)
return
hasattr
(
__builtins__
,
s
)
def
combine_range
(
lines
,
start
,
end
):
def
combine_range
(
lines
,
start
,
end
):
'Join content from a range of lines between start and end'
'Join content from a range of lines between start and end'
...
@@ -161,6 +161,8 @@ if __name__ == '__main__':
...
@@ -161,6 +161,8 @@ if __name__ == '__main__':
help
=
'build a complete html webpage'
)
help
=
'build a complete html webpage'
)
parser
.
add_argument
(
'-s'
,
'--section'
,
action
=
'store_true'
,
parser
.
add_argument
(
'-s'
,
'--section'
,
action
=
'store_true'
,
help
=
'show an HTML section rather than a complete webpage'
)
help
=
'show an HTML section rather than a complete webpage'
)
parser
.
add_argument
(
'-v'
,
'--verbose'
,
action
=
'store_true'
,
help
=
'display categorized text to stderr'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
section
and
(
args
.
browser
or
args
.
complete
):
if
args
.
section
and
(
args
.
browser
or
args
.
complete
):
...
@@ -172,6 +174,12 @@ if __name__ == '__main__':
...
@@ -172,6 +174,12 @@ if __name__ == '__main__':
source
=
f
.
read
()
source
=
f
.
read
()
classified_text
=
analyze_python
(
source
)
classified_text
=
analyze_python
(
source
)
if
args
.
verbose
:
classified_text
=
list
(
classified_text
)
for
line_upto_token
,
kind
,
line_thru_token
in
classified_text
:
sys
.
stderr
.
write
(
'
%15
s:
%
r
\n
'
%
(
'leadin'
,
line_upto_token
))
sys
.
stderr
.
write
(
'
%15
s:
%
r
\n\n
'
%
(
kind
,
line_thru_token
))
if
args
.
complete
or
args
.
browser
:
if
args
.
complete
or
args
.
browser
:
encoded
=
build_html_page
(
classified_text
,
title
=
sourcefile
)
encoded
=
build_html_page
(
classified_text
,
title
=
sourcefile
)
elif
args
.
section
:
elif
args
.
section
:
...
...
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