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
01b81010
Kaydet (Commit)
01b81010
authored
Nis 11, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make _kind types global for C++ compilation.
Explicitly cast void* to int to cmpop_ty.
üst
9b26122e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
16 deletions
+22
-16
Python-ast.h
Include/Python-ast.h
+16
-12
asdl_c.py
Parser/asdl_c.py
+5
-3
Python-ast.c
Python/Python-ast.c
+1
-1
No files found.
Include/Python-ast.h
Dosyayı görüntüle @
01b81010
...
...
@@ -35,9 +35,10 @@ typedef struct _keyword *keyword_ty;
typedef
struct
_alias
*
alias_ty
;
enum
_mod_kind
{
Module_kind
=
1
,
Interactive_kind
=
2
,
Expression_kind
=
3
,
Suite_kind
=
4
};
struct
_mod
{
enum
{
Module_kind
=
1
,
Interactive_kind
=
2
,
Expression_kind
=
3
,
Suite_kind
=
4
}
kind
;
enum
_mod_kind
kind
;
union
{
struct
{
asdl_seq
*
body
;
...
...
@@ -58,14 +59,15 @@ struct _mod {
}
v
;
};
struct
_stmt
{
enum
{
FunctionDef_kind
=
1
,
ClassDef_kind
=
2
,
Return_kind
=
3
,
enum
_stmt_kind
{
FunctionDef_kind
=
1
,
ClassDef_kind
=
2
,
Return_kind
=
3
,
Delete_kind
=
4
,
Assign_kind
=
5
,
AugAssign_kind
=
6
,
Print_kind
=
7
,
For_kind
=
8
,
While_kind
=
9
,
If_kind
=
10
,
With_kind
=
11
,
Raise_kind
=
12
,
TryExcept_kind
=
13
,
TryFinally_kind
=
14
,
Assert_kind
=
15
,
Import_kind
=
16
,
ImportFrom_kind
=
17
,
Exec_kind
=
18
,
Global_kind
=
19
,
Expr_kind
=
20
,
Pass_kind
=
21
,
Break_kind
=
22
,
Continue_kind
=
23
}
kind
;
Break_kind
=
22
,
Continue_kind
=
23
};
struct
_stmt
{
enum
_stmt_kind
kind
;
union
{
struct
{
identifier
name
;
...
...
@@ -181,12 +183,14 @@ struct _stmt {
int
col_offset
;
};
enum
_expr_kind
{
BoolOp_kind
=
1
,
BinOp_kind
=
2
,
UnaryOp_kind
=
3
,
Lambda_kind
=
4
,
IfExp_kind
=
5
,
Dict_kind
=
6
,
ListComp_kind
=
7
,
GeneratorExp_kind
=
8
,
Yield_kind
=
9
,
Compare_kind
=
10
,
Call_kind
=
11
,
Repr_kind
=
12
,
Num_kind
=
13
,
Str_kind
=
14
,
Attribute_kind
=
15
,
Subscript_kind
=
16
,
Name_kind
=
17
,
List_kind
=
18
,
Tuple_kind
=
19
};
struct
_expr
{
enum
{
BoolOp_kind
=
1
,
BinOp_kind
=
2
,
UnaryOp_kind
=
3
,
Lambda_kind
=
4
,
IfExp_kind
=
5
,
Dict_kind
=
6
,
ListComp_kind
=
7
,
GeneratorExp_kind
=
8
,
Yield_kind
=
9
,
Compare_kind
=
10
,
Call_kind
=
11
,
Repr_kind
=
12
,
Num_kind
=
13
,
Str_kind
=
14
,
Attribute_kind
=
15
,
Subscript_kind
=
16
,
Name_kind
=
17
,
List_kind
=
18
,
Tuple_kind
=
19
}
kind
;
enum
_expr_kind
kind
;
union
{
struct
{
boolop_ty
op
;
...
...
@@ -292,9 +296,9 @@ struct _expr {
int
col_offset
;
};
enum
_slice_kind
{
Ellipsis_kind
=
1
,
Slice_kind
=
2
,
ExtSlice_kind
=
3
,
Index_kind
=
4
};
struct
_slice
{
enum
{
Ellipsis_kind
=
1
,
Slice_kind
=
2
,
ExtSlice_kind
=
3
,
Index_kind
=
4
}
kind
;
enum
_slice_kind
kind
;
union
{
struct
{
expr_ty
lower
;
...
...
Parser/asdl_c.py
Dosyayı görüntüle @
01b81010
...
...
@@ -155,8 +155,10 @@ class StructVisitor(EmitVisitor):
type
=
sum
.
types
[
i
]
enum
.
append
(
"
%
s_kind=
%
d"
%
(
type
.
name
,
i
+
1
))
emit
(
"enum _
%(name)
s_kind {"
+
", "
.
join
(
enum
)
+
"};"
)
emit
(
"struct _
%(name)
s {"
)
emit
(
"enum
{ "
+
", "
.
join
(
enum
)
+
" }
kind;"
,
depth
+
1
)
emit
(
"enum
_
%(name)
s_kind
kind;"
,
depth
+
1
)
emit
(
"union {"
,
depth
+
1
)
for
t
in
sum
.
types
:
self
.
visit
(
t
,
depth
+
2
)
...
...
@@ -679,8 +681,8 @@ class ObjVisitor(PickleVisitor):
self
.
emit
(
"if (!value) goto failed;"
,
depth
+
1
)
self
.
emit
(
"for(i = 0; i < n; i++)"
,
depth
+
1
)
# This cannot fail, so no need for error handling
self
.
emit
(
"PyList_SET_ITEM(value, i, ast2obj_
%
s((
%
s_ty)asdl_seq_GET(
%
s, i)));"
%
(
field
.
type
,
field
.
type
,
value
),
depth
+
2
,
reflow
=
False
)
self
.
emit
(
"PyList_SET_ITEM(value, i, ast2obj_
cmpop((cmpop_ty)(int)asdl_seq_GET(
%
s, i)));"
%
value
,
depth
+
2
,
reflow
=
False
)
self
.
emit
(
"}"
,
depth
)
else
:
self
.
emit
(
"value = ast2obj_list(
%
s, ast2obj_
%
s);"
%
(
value
,
field
.
type
),
depth
)
...
...
Python/Python-ast.c
Dosyayı görüntüle @
01b81010
...
...
@@ -2505,7 +2505,7 @@ ast2obj_expr(void* _o)
value
=
PyList_New
(
n
);
if
(
!
value
)
goto
failed
;
for
(
i
=
0
;
i
<
n
;
i
++
)
PyList_SET_ITEM
(
value
,
i
,
ast2obj_cmpop
((
cmpop_ty
)
asdl_seq_GET
(
o
->
v
.
Compare
.
ops
,
i
)));
PyList_SET_ITEM
(
value
,
i
,
ast2obj_cmpop
((
cmpop_ty
)
(
int
)
asdl_seq_GET
(
o
->
v
.
Compare
.
ops
,
i
)));
}
if
(
!
value
)
goto
failed
;
if
(
PyObject_SetAttrString
(
result
,
"ops"
,
value
)
==
-
1
)
...
...
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