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
c7d37264
Kaydet (Commit)
c7d37264
authored
Şub 27, 2006
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix parsing of subscriptlist.
(Armin's SF bug report). d = {} d[1,] = 1 Now handled correctly
üst
02cbf4ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
ast.c
Python/ast.c
+30
-4
No files found.
Python/ast.c
Dosyayı görüntüle @
c7d37264
...
...
@@ -1388,7 +1388,10 @@ ast_for_binop(struct compiling *c, const node *n)
static
expr_ty
ast_for_trailer
(
struct
compiling
*
c
,
const
node
*
n
,
expr_ty
left_expr
)
{
/* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME */
/* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
subscriptlist: subscript (',' subscript)* [',']
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
*/
REQ
(
n
,
trailer
);
if
(
TYPE
(
CHILD
(
n
,
0
))
==
LPAR
)
{
if
(
NCH
(
n
)
==
2
)
...
...
@@ -1404,25 +1407,48 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
REQ
(
CHILD
(
n
,
0
),
LSQB
);
REQ
(
CHILD
(
n
,
2
),
RSQB
);
n
=
CHILD
(
n
,
1
);
if
(
NCH
(
n
)
<=
2
)
{
if
(
NCH
(
n
)
==
1
)
{
slice_ty
slc
=
ast_for_slice
(
c
,
CHILD
(
n
,
0
));
if
(
!
slc
)
return
NULL
;
return
Subscript
(
left_expr
,
slc
,
Load
,
LINENO
(
n
),
c
->
c_arena
);
}
else
{
/* The grammar is ambiguous here. The ambiguity is resolved
by treating the sequence as a tuple literal if there are
no slice features.
*/
int
j
;
slice_ty
slc
;
asdl_seq
*
slices
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
expr_ty
e
;
bool
simple
;
asdl_seq
*
slices
,
*
elts
;
slices
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
slices
)
return
NULL
;
for
(
j
=
0
;
j
<
NCH
(
n
);
j
+=
2
)
{
slc
=
ast_for_slice
(
c
,
CHILD
(
n
,
j
));
if
(
!
slc
)
return
NULL
;
if
(
slc
->
kind
!=
Index_kind
)
simple
=
false
;
asdl_seq_SET
(
slices
,
j
/
2
,
slc
);
}
return
Subscript
(
left_expr
,
ExtSlice
(
slices
,
c
->
c_arena
),
if
(
!
simple
)
{
return
Subscript
(
left_expr
,
ExtSlice
(
slices
,
c
->
c_arena
),
Load
,
LINENO
(
n
),
c
->
c_arena
);
}
/* extract Index values and put them in a Tuple */
elts
=
asdl_seq_new
(
asdl_seq_LEN
(
slices
),
c
->
c_arena
);
for
(
j
=
0
;
j
<
asdl_seq_LEN
(
slices
);
++
j
)
{
slc
=
(
slice_ty
)
asdl_seq_GET
(
slices
,
j
);
assert
(
slc
->
kind
==
Index_kind
&&
slc
->
v
.
Index
.
value
);
asdl_seq_SET
(
elts
,
j
,
slc
->
v
.
Index
.
value
);
}
e
=
Tuple
(
elts
,
Load
,
LINENO
(
n
),
c
->
c_arena
);
if
(
!
e
)
return
NULL
;
return
Subscript
(
left_expr
,
Index
(
e
,
c
->
c_arena
),
Load
,
LINENO
(
n
),
c
->
c_arena
);
}
}
...
...
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