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
ca2d2529
Kaydet (Commit)
ca2d2529
authored
Eki 15, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
some cleanups
üst
e5265722
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
tokenize.py
Lib/tokenize.py
+10
-10
No files found.
Lib/tokenize.py
Dosyayı görüntüle @
ca2d2529
...
@@ -23,15 +23,15 @@ function to which the 5 fields described above are passed as 5 arguments,
...
@@ -23,15 +23,15 @@ function to which the 5 fields described above are passed as 5 arguments,
each time a new token is found."""
each time a new token is found."""
__author__
=
'Ka-Ping Yee <ping@lfw.org>'
__author__
=
'Ka-Ping Yee <ping@lfw.org>'
__credits__
=
\
__credits__
=
(
'GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '
'GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger'
'Skip Montanaro, Raymond Hettinger'
)
import
string
,
re
import
string
,
re
from
token
import
*
from
token
import
*
import
token
import
token
__all__
=
[
x
for
x
in
dir
(
token
)
if
x
[
0
]
!=
'_'
]
+
[
"COMMENT"
,
"tokenize"
,
__all__
=
[
x
for
x
in
dir
(
token
)
if
not
x
.
startswith
(
"_"
)]
"generate_tokens"
,
"NL"
,
"untokenize"
]
__all__
+=
[
"COMMENT"
,
"tokenize"
,
"generate_tokens"
,
"NL"
,
"untokenize"
]
del
x
del
x
del
token
del
token
...
@@ -288,7 +288,7 @@ def generate_tokens(readline):
...
@@ -288,7 +288,7 @@ def generate_tokens(readline):
line
=
readline
()
line
=
readline
()
except
StopIteration
:
except
StopIteration
:
line
=
''
line
=
''
lnum
=
lnum
+
1
lnum
+=
1
pos
,
max
=
0
,
len
(
line
)
pos
,
max
=
0
,
len
(
line
)
if
contstr
:
# continued string
if
contstr
:
# continued string
...
@@ -317,14 +317,14 @@ def generate_tokens(readline):
...
@@ -317,14 +317,14 @@ def generate_tokens(readline):
column
=
0
column
=
0
while
pos
<
max
:
# measure leading whitespace
while
pos
<
max
:
# measure leading whitespace
if
line
[
pos
]
==
' '
:
if
line
[
pos
]
==
' '
:
column
=
column
+
1
column
+=
1
elif
line
[
pos
]
==
'
\t
'
:
elif
line
[
pos
]
==
'
\t
'
:
column
=
(
column
//
tabsize
+
1
)
*
tabsize
column
=
(
column
//
tabsize
+
1
)
*
tabsize
elif
line
[
pos
]
==
'
\f
'
:
elif
line
[
pos
]
==
'
\f
'
:
column
=
0
column
=
0
else
:
else
:
break
break
pos
=
pos
+
1
pos
+=
1
if
pos
==
max
:
if
pos
==
max
:
break
break
...
@@ -403,14 +403,14 @@ def generate_tokens(readline):
...
@@ -403,14 +403,14 @@ def generate_tokens(readline):
continued
=
1
continued
=
1
else
:
else
:
if
initial
in
'([{'
:
if
initial
in
'([{'
:
parenlev
=
parenlev
+
1
parenlev
+=
1
elif
initial
in
')]}'
:
elif
initial
in
')]}'
:
parenlev
=
parenlev
-
1
parenlev
-=
1
yield
(
OP
,
token
,
spos
,
epos
,
line
)
yield
(
OP
,
token
,
spos
,
epos
,
line
)
else
:
else
:
yield
(
ERRORTOKEN
,
line
[
pos
],
yield
(
ERRORTOKEN
,
line
[
pos
],
(
lnum
,
pos
),
(
lnum
,
pos
+
1
),
line
)
(
lnum
,
pos
),
(
lnum
,
pos
+
1
),
line
)
pos
=
pos
+
1
pos
+=
1
for
indent
in
indents
[
1
:]:
# pop remaining indent levels
for
indent
in
indents
[
1
:]:
# pop remaining indent levels
yield
(
DEDENT
,
''
,
(
lnum
,
0
),
(
lnum
,
0
),
''
)
yield
(
DEDENT
,
''
,
(
lnum
,
0
),
(
lnum
,
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