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
57531fea
Kaydet (Commit)
57531fea
authored
Kas 30, 1993
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
change syntactical position of lambdef (was an atom, now is a test)
üst
ae3b3a33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
102 deletions
+111
-102
Grammar
Grammar/Grammar
+2
-4
compile.c
Python/compile.c
+28
-25
graminit.c
Python/graminit.c
+81
-73
No files found.
Grammar/Grammar
Dosyayı görüntüle @
57531fea
...
...
@@ -123,7 +123,7 @@ try_stmt: 'try' ':' suite (except_clause ':' suite)+ | 'try' ':' suite 'finally'
except_clause: 'except' [test [',' test]]
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
test: and_test ('or' and_test)*
test: and_test ('or' and_test)*
| lambdef
and_test: not_test ('and' not_test)*
not_test: 'not' not_test | comparison
comparison: expr (comp_op expr)*
...
...
@@ -135,9 +135,7 @@ shift_expr: arith_expr (('<<'|'>>') arith_expr)*
arith_expr: term (('+'|'-') term)*
term: factor (('*'|'/'|'%') factor)*
factor: ('+'|'-'|'~') factor | atom trailer*
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | lambdef | NAME | NUMBER | STRING
# Note ambiguity in grammar: "lambda x: x[1]" could mean "(lambda x: x)[1]"
# but the parser is eager so interprets it as "lambda x: (x[1])"...
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING
lambdef: 'lambda' [varargslist] ':' test
trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME
subscript: test | [test] ':' [test]
...
...
Python/compile.c
Dosyayı görüntüle @
57531fea
...
...
@@ -659,18 +659,6 @@ com_atom(c, n)
}
com_addoparg
(
c
,
LOAD_CONST
,
i
);
break
;
case
lambdef
:
if
((
v
=
(
object
*
)
compile
(
ch
,
c
->
c_filename
))
==
NULL
)
{
c
->
c_errors
++
;
i
=
255
;
}
else
{
i
=
com_addconst
(
c
,
v
);
DECREF
(
v
);
}
com_addoparg
(
c
,
LOAD_CONST
,
i
);
com_addbyte
(
c
,
BUILD_FUNCTION
);
break
;
case
NAME
:
com_addopname
(
c
,
LOAD_NAME
,
ch
);
break
;
...
...
@@ -1106,20 +1094,35 @@ com_test(c, n)
struct
compiling
*
c
;
node
*
n
;
{
int
i
;
int
anchor
;
REQ
(
n
,
test
);
/* and_test ('and' and_test)* */
anchor
=
0
;
i
=
0
;
for
(;;)
{
com_and_test
(
c
,
CHILD
(
n
,
i
));
if
((
i
+=
2
)
>=
NCH
(
n
))
break
;
com_addfwref
(
c
,
JUMP_IF_TRUE
,
&
anchor
);
com_addbyte
(
c
,
POP_TOP
);
REQ
(
n
,
test
);
/* and_test ('and' and_test)* | lambdef */
if
(
NCH
(
n
)
==
1
&&
TYPE
(
CHILD
(
n
,
0
))
==
lambdef
)
{
object
*
v
;
int
i
;
v
=
(
object
*
)
compile
(
CHILD
(
n
,
0
),
c
->
c_filename
);
if
(
v
==
NULL
)
{
c
->
c_errors
++
;
i
=
255
;
}
else
{
i
=
com_addconst
(
c
,
v
);
DECREF
(
v
);
}
com_addoparg
(
c
,
LOAD_CONST
,
i
);
com_addbyte
(
c
,
BUILD_FUNCTION
);
}
else
{
int
anchor
=
0
;
int
i
=
0
;
for
(;;)
{
com_and_test
(
c
,
CHILD
(
n
,
i
));
if
((
i
+=
2
)
>=
NCH
(
n
))
break
;
com_addfwref
(
c
,
JUMP_IF_TRUE
,
&
anchor
);
com_addbyte
(
c
,
POP_TOP
);
}
if
(
anchor
)
com_backpatch
(
c
,
anchor
);
}
if
(
anchor
)
com_backpatch
(
c
,
anchor
);
}
static
void
...
...
Python/graminit.c
Dosyayı görüntüle @
57531fea
...
...
@@ -674,22 +674,31 @@ static state states_31[5] = {
{
1
,
arcs_31_3
},
{
2
,
arcs_31_4
},
};
static
arc
arcs_32_0
[
1
]
=
{
static
arc
arcs_32_0
[
2
]
=
{
{
72
,
1
},
{
74
,
2
},
};
static
arc
arcs_32_1
[
2
]
=
{
{
73
,
0
},
{
73
,
3
},
{
0
,
1
},
};
static
state
states_32
[
2
]
=
{
{
1
,
arcs_32_0
},
static
arc
arcs_32_2
[
1
]
=
{
{
0
,
2
},
};
static
arc
arcs_32_3
[
1
]
=
{
{
72
,
1
},
};
static
state
states_32
[
4
]
=
{
{
2
,
arcs_32_0
},
{
2
,
arcs_32_1
},
{
1
,
arcs_32_2
},
{
1
,
arcs_32_3
},
};
static
arc
arcs_33_0
[
1
]
=
{
{
7
4
,
1
},
{
7
5
,
1
},
};
static
arc
arcs_33_1
[
2
]
=
{
{
7
5
,
0
},
{
7
6
,
0
},
{
0
,
1
},
};
static
state
states_33
[
2
]
=
{
...
...
@@ -697,11 +706,11 @@ static state states_33[2] = {
{
2
,
arcs_33_1
},
};
static
arc
arcs_34_0
[
2
]
=
{
{
7
6
,
1
},
{
7
7
,
2
},
{
7
7
,
1
},
{
7
8
,
2
},
};
static
arc
arcs_34_1
[
1
]
=
{
{
7
4
,
2
},
{
7
5
,
2
},
};
static
arc
arcs_34_2
[
1
]
=
{
{
0
,
2
},
...
...
@@ -715,7 +724,7 @@ static arc arcs_35_0[1] = {
{
54
,
1
},
};
static
arc
arcs_35_1
[
2
]
=
{
{
7
8
,
0
},
{
7
9
,
0
},
{
0
,
1
},
};
static
state
states_35
[
2
]
=
{
...
...
@@ -723,16 +732,16 @@ static state states_35[2] = {
{
2
,
arcs_35_1
},
};
static
arc
arcs_36_0
[
10
]
=
{
{
79
,
1
},
{
80
,
1
},
{
81
,
1
},
{
82
,
1
},
{
83
,
1
},
{
84
,
1
},
{
85
,
1
},
{
86
,
1
},
{
55
,
1
},
{
7
6
,
2
},
{
8
6
,
3
},
{
7
7
,
2
},
{
8
7
,
3
},
};
static
arc
arcs_36_1
[
1
]
=
{
{
0
,
1
},
...
...
@@ -741,7 +750,7 @@ static arc arcs_36_2[1] = {
{
55
,
1
},
};
static
arc
arcs_36_3
[
2
]
=
{
{
7
6
,
1
},
{
7
7
,
1
},
{
0
,
3
},
};
static
state
states_36
[
4
]
=
{
...
...
@@ -751,10 +760,10 @@ static state states_36[4] = {
{
2
,
arcs_36_3
},
};
static
arc
arcs_37_0
[
1
]
=
{
{
8
7
,
1
},
{
8
8
,
1
},
};
static
arc
arcs_37_1
[
2
]
=
{
{
8
8
,
0
},
{
8
9
,
0
},
{
0
,
1
},
};
static
state
states_37
[
2
]
=
{
...
...
@@ -762,10 +771,10 @@ static state states_37[2] = {
{
2
,
arcs_37_1
},
};
static
arc
arcs_38_0
[
1
]
=
{
{
89
,
1
},
{
90
,
1
},
};
static
arc
arcs_38_1
[
2
]
=
{
{
9
0
,
0
},
{
9
1
,
0
},
{
0
,
1
},
};
static
state
states_38
[
2
]
=
{
...
...
@@ -773,10 +782,10 @@ static state states_38[2] = {
{
2
,
arcs_38_1
},
};
static
arc
arcs_39_0
[
1
]
=
{
{
9
1
,
1
},
{
9
2
,
1
},
};
static
arc
arcs_39_1
[
2
]
=
{
{
9
2
,
0
},
{
9
3
,
0
},
{
0
,
1
},
};
static
state
states_39
[
2
]
=
{
...
...
@@ -784,11 +793,11 @@ static state states_39[2] = {
{
2
,
arcs_39_1
},
};
static
arc
arcs_40_0
[
1
]
=
{
{
9
3
,
1
},
{
9
4
,
1
},
};
static
arc
arcs_40_1
[
3
]
=
{
{
94
,
0
},
{
95
,
0
},
{
96
,
0
},
{
0
,
1
},
};
static
state
states_40
[
2
]
=
{
...
...
@@ -796,11 +805,11 @@ static state states_40[2] = {
{
3
,
arcs_40_1
},
};
static
arc
arcs_41_0
[
1
]
=
{
{
9
6
,
1
},
{
9
7
,
1
},
};
static
arc
arcs_41_1
[
3
]
=
{
{
97
,
0
},
{
98
,
0
},
{
99
,
0
},
{
0
,
1
},
};
static
state
states_41
[
2
]
=
{
...
...
@@ -808,12 +817,12 @@ static state states_41[2] = {
{
3
,
arcs_41_1
},
};
static
arc
arcs_42_0
[
1
]
=
{
{
99
,
1
},
{
100
,
1
},
};
static
arc
arcs_42_1
[
4
]
=
{
{
21
,
0
},
{
100
,
0
},
{
101
,
0
},
{
102
,
0
},
{
0
,
1
},
};
static
state
states_42
[
2
]
=
{
...
...
@@ -821,16 +830,16 @@ static state states_42[2] = {
{
4
,
arcs_42_1
},
};
static
arc
arcs_43_0
[
4
]
=
{
{
97
,
1
},
{
98
,
1
},
{
102
,
1
},
{
103
,
2
},
{
99
,
1
},
{
103
,
1
},
{
104
,
2
},
};
static
arc
arcs_43_1
[
1
]
=
{
{
99
,
3
},
{
100
,
3
},
};
static
arc
arcs_43_2
[
2
]
=
{
{
10
4
,
2
},
{
10
5
,
2
},
{
0
,
2
},
};
static
arc
arcs_43_3
[
1
]
=
{
...
...
@@ -842,12 +851,11 @@ static state states_43[4] = {
{
2
,
arcs_43_2
},
{
1
,
arcs_43_3
},
};
static
arc
arcs_44_0
[
8
]
=
{
static
arc
arcs_44_0
[
7
]
=
{
{
16
,
1
},
{
105
,
2
},
{
107
,
3
},
{
110
,
4
},
{
111
,
5
},
{
106
,
2
},
{
108
,
3
},
{
111
,
4
},
{
12
,
5
},
{
112
,
5
},
{
113
,
5
},
...
...
@@ -858,11 +866,11 @@ static arc arcs_44_1[2] = {
};
static
arc
arcs_44_2
[
2
]
=
{
{
9
,
7
},
{
10
6
,
5
},
{
10
7
,
5
},
};
static
arc
arcs_44_3
[
2
]
=
{
{
10
8
,
8
},
{
1
09
,
5
},
{
10
9
,
8
},
{
1
10
,
5
},
};
static
arc
arcs_44_4
[
1
]
=
{
{
9
,
9
},
...
...
@@ -874,16 +882,16 @@ static arc arcs_44_6[1] = {
{
18
,
5
},
};
static
arc
arcs_44_7
[
1
]
=
{
{
10
6
,
5
},
{
10
7
,
5
},
};
static
arc
arcs_44_8
[
1
]
=
{
{
1
09
,
5
},
{
1
10
,
5
},
};
static
arc
arcs_44_9
[
1
]
=
{
{
11
0
,
5
},
{
11
1
,
5
},
};
static
state
states_44
[
10
]
=
{
{
8
,
arcs_44_0
},
{
7
,
arcs_44_0
},
{
2
,
arcs_44_1
},
{
2
,
arcs_44_2
},
{
2
,
arcs_44_3
},
...
...
@@ -919,7 +927,7 @@ static state states_45[5] = {
};
static
arc
arcs_46_0
[
3
]
=
{
{
16
,
1
},
{
10
5
,
2
},
{
10
6
,
2
},
{
116
,
3
},
};
static
arc
arcs_46_1
[
2
]
=
{
...
...
@@ -939,7 +947,7 @@ static arc arcs_46_5[1] = {
{
0
,
5
},
};
static
arc
arcs_46_6
[
1
]
=
{
{
10
6
,
5
},
{
10
7
,
5
},
};
static
state
states_46
[
7
]
=
{
{
3
,
arcs_46_0
},
...
...
@@ -1064,11 +1072,11 @@ static state states_51[8] = {
};
static
dfa
dfas
[
52
]
=
{
{
256
,
"single_input"
,
0
,
3
,
states_0
,
"
\004\030\001\000\250\360\057\040\007\0
20\000\000\106\112
\047
"
},
"
\004\030\001\000\250\360\057\040\007\0
40\000\000\214\224
\047
"
},
{
257
,
"file_input"
,
0
,
2
,
states_1
,
"
\204\030\001\000\250\360\057\040\007\0
20\000\000\106\112
\047
"
},
"
\204\030\001\000\250\360\057\040\007\0
40\000\000\214\224
\047
"
},
{
258
,
"eval_input"
,
0
,
3
,
states_2
,
"
\000\020\001\000\000\000\000\000\000\0
20\000\000\106\112
\007
"
},
"
\000\020\001\000\000\000\000\000\000\0
40\000\000\214\224
\007
"
},
{
259
,
"funcdef"
,
0
,
6
,
states_3
,
"
\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000
"
},
{
260
,
"parameters"
,
0
,
4
,
states_4
,
...
...
@@ -1080,13 +1088,13 @@ static dfa dfas[52] = {
{
263
,
"fplist"
,
0
,
3
,
states_7
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\000\000\000
"
},
{
264
,
"stmt"
,
0
,
2
,
states_8
,
"
\000\030\001\000\250\360\057\040\007\0
20\000\000\106\112
\047
"
},
"
\000\030\001\000\250\360\057\040\007\0
40\000\000\214\224
\047
"
},
{
265
,
"simple_stmt"
,
0
,
4
,
states_9
,
"
\000\020\001\000\250\360\057\000\000\0
20\000\000\106\112
\007
"
},
"
\000\020\001\000\250\360\057\000\000\0
40\000\000\214\224
\007
"
},
{
266
,
"small_stmt"
,
0
,
2
,
states_10
,
"
\000\020\001\000\250\360\057\000\000\0
20\000\000\106\112
\007
"
},
"
\000\020\001\000\250\360\057\000\000\0
40\000\000\214\224
\007
"
},
{
267
,
"expr_stmt"
,
0
,
2
,
states_11
,
"
\000\020\001\000\000\000\000\000\000\0
20\000\000\106\112
\007
"
},
"
\000\020\001\000\000\000\000\000\000\0
40\000\000\214\224
\007
"
},
{
268
,
"print_stmt"
,
0
,
3
,
states_12
,
"
\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000
"
},
{
269
,
"del_stmt"
,
0
,
3
,
states_13
,
...
...
@@ -1126,45 +1134,45 @@ static dfa dfas[52] = {
{
286
,
"except_clause"
,
0
,
5
,
states_30
,
"
\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000
"
},
{
287
,
"suite"
,
0
,
5
,
states_31
,
"
\004\020\001\000\250\360\057\000\000\0
20\000\000\106\112
\007
"
},
{
288
,
"test"
,
0
,
2
,
states_32
,
"
\000\020\001\000\000\000\000\000\000\0
20\000\000\106\112
\007
"
},
"
\004\020\001\000\250\360\057\000\000\0
40\000\000\214\224
\007
"
},
{
288
,
"test"
,
0
,
4
,
states_32
,
"
\000\020\001\000\000\000\000\000\000\0
40\000\000\214\224
\007
"
},
{
289
,
"and_test"
,
0
,
2
,
states_33
,
"
\000\020\001\000\000\000\000\000\000\0
20\000\000\106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\0
40\000\000\214\224\003
"
},
{
290
,
"not_test"
,
0
,
3
,
states_34
,
"
\000\020\001\000\000\000\000\000\000\0
20\000\000\106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\0
40\000\000\214\224\003
"
},
{
291
,
"comparison"
,
0
,
2
,
states_35
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
292
,
"comp_op"
,
0
,
4
,
states_36
,
"
\000\000\000\000\000\000\200\000\000\
220\1
77\000\000\000\000
"
},
"
\000\000\000\000\000\000\200\000\000\
040\3
77\000\000\000\000
"
},
{
293
,
"expr"
,
0
,
2
,
states_37
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
294
,
"xor_expr"
,
0
,
2
,
states_38
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
295
,
"and_expr"
,
0
,
2
,
states_39
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
296
,
"shift_expr"
,
0
,
2
,
states_40
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
297
,
"arith_expr"
,
0
,
2
,
states_41
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
298
,
"term"
,
0
,
2
,
states_42
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
299
,
"factor"
,
0
,
4
,
states_43
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
300
,
"atom"
,
0
,
10
,
states_44
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\000\
112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\000\
224\003
"
},
{
301
,
"lambdef"
,
0
,
5
,
states_45
,
"
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004
"
},
{
302
,
"trailer"
,
0
,
7
,
states_46
,
"
\000\000\001\000\000\000\000\000\000\000\000\000\000\00
2
\020
"
},
"
\000\000\001\000\000\000\000\000\000\000\000\000\000\00
4
\020
"
},
{
303
,
"subscript"
,
0
,
4
,
states_47
,
"
\000\120\001\000\000\000\000\000\000\0
20\000\000\106\112
\007
"
},
"
\000\120\001\000\000\000\000\000\000\0
40\000\000\214\224
\007
"
},
{
304
,
"exprlist"
,
0
,
3
,
states_48
,
"
\000\020\001\000\000\000\000\000\000\000\000\000\
106\112\007
"
},
"
\000\020\001\000\000\000\000\000\000\000\000\000\
214\224\003
"
},
{
305
,
"testlist"
,
0
,
3
,
states_49
,
"
\000\020\001\000\000\000\000\000\000\0
20\000\000\106\112
\007
"
},
"
\000\020\001\000\000\000\000\000\000\0
40\000\000\214\224
\007
"
},
{
306
,
"dictmaker"
,
0
,
5
,
states_50
,
"
\000\020\001\000\000\000\000\000\000\0
20\000\000\106\112
\007
"
},
"
\000\020\001\000\000\000\000\000\000\0
40\000\000\214\224
\007
"
},
{
307
,
"classdef"
,
0
,
8
,
states_51
,
"
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040
"
},
};
...
...
@@ -1243,6 +1251,7 @@ static label labels[118] = {
{
6
,
0
},
{
289
,
0
},
{
1
,
"or"
},
{
301
,
0
},
{
290
,
0
},
{
1
,
"and"
},
{
1
,
"not"
},
...
...
@@ -1280,7 +1289,6 @@ static label labels[118] = {
{
306
,
0
},
{
27
,
0
},
{
25
,
0
},
{
301
,
0
},
{
2
,
0
},
{
3
,
0
},
{
1
,
"lambda"
},
...
...
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