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
24315238
Kaydet (Commit)
24315238
authored
Nis 17, 2003
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
- use Tue/False for booleans
- some very minor cleanups
üst
dbd6503e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
shlex.py
Lib/shlex.py
+8
-9
No files found.
Lib/shlex.py
Dosyayı görüntüle @
24315238
...
...
@@ -21,7 +21,7 @@ __all__ = ["shlex", "split"]
class
shlex
:
"A lexical analyzer class for simple shell-like syntaxes."
def
__init__
(
self
,
instream
=
None
,
infile
=
None
,
posix
=
0
):
def
__init__
(
self
,
instream
=
None
,
infile
=
None
,
posix
=
False
):
if
type
(
instream
)
in
StringTypes
:
instream
=
StringIO
(
instream
)
if
instream
is
not
None
:
...
...
@@ -42,7 +42,7 @@ class shlex:
self
.
wordchars
+=
(
''
''
)
self
.
whitespace
=
'
\t\r\n
'
self
.
whitespace_split
=
0
self
.
whitespace_split
=
False
self
.
quotes
=
'
\'
"'
self
.
escape
=
'
\\
'
self
.
escapedquotes
=
'"'
...
...
@@ -61,7 +61,7 @@ class shlex:
"Push a token onto the stack popped by the get_token method"
if
self
.
debug
>=
1
:
print
"shlex: pushing token "
+
`tok`
self
.
pushback
=
[
tok
]
+
self
.
pushback
self
.
pushback
.
insert
(
0
,
tok
)
def
push_source
(
self
,
newstream
,
newfile
=
None
):
"Push an input source onto the lexer's input source stack."
...
...
@@ -90,8 +90,7 @@ class shlex:
def
get_token
(
self
):
"Get a token from the input stream (or from stack if it's nonempty)"
if
self
.
pushback
:
tok
=
self
.
pushback
[
0
]
self
.
pushback
=
self
.
pushback
[
1
:]
tok
=
self
.
pushback
.
pop
(
0
)
if
self
.
debug
>=
1
:
print
"shlex: popping token "
+
`tok`
return
tok
...
...
@@ -107,7 +106,7 @@ class shlex:
raw
=
self
.
get_token
()
# Maybe we got EOF instead?
while
raw
==
self
.
eof
:
if
len
(
self
.
filestack
)
==
0
:
if
not
self
.
filestack
:
return
self
.
eof
else
:
self
.
pop_source
()
...
...
@@ -121,7 +120,7 @@ class shlex:
return
raw
def
read_token
(
self
):
quoted
=
0
quoted
=
False
escapedstate
=
' '
while
1
:
nextchar
=
self
.
instream
.
read
(
1
)
...
...
@@ -167,7 +166,7 @@ class shlex:
else
:
continue
elif
self
.
state
in
self
.
quotes
:
quoted
=
1
quoted
=
True
if
not
nextchar
:
# end of file
if
self
.
debug
>=
2
:
print
"shlex: I see EOF in quotes state"
...
...
@@ -229,7 +228,7 @@ class shlex:
or
self
.
whitespace_split
:
self
.
token
=
self
.
token
+
nextchar
else
:
self
.
pushback
=
[
nextchar
]
+
self
.
pushback
self
.
pushback
.
insert
(
0
,
nextchar
)
if
self
.
debug
>=
2
:
print
"shlex: I see punctuation in word state"
self
.
state
=
' '
...
...
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