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
da952f3f
Kaydet (Commit)
da952f3f
authored
Nis 10, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add matrix multiplication operator support to 2to3
üst
c177b1cb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
9 deletions
+19
-9
Grammar.txt
Lib/lib2to3/Grammar.txt
+2
-2
grammar.py
Lib/lib2to3/pgen2/grammar.py
+1
-0
token.py
Lib/lib2to3/pgen2/token.py
+7
-6
tokenize.py
Lib/lib2to3/pgen2/tokenize.py
+1
-1
test_parser.py
Lib/lib2to3/tests/test_parser.py
+6
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/lib2to3/Grammar.txt
Dosyayı görüntüle @
da952f3f
...
@@ -56,7 +56,7 @@ small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt |
...
@@ -56,7 +56,7 @@ small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt |
expr_stmt: testlist_star_expr (augassign (yield_expr|testlist) |
expr_stmt: testlist_star_expr (augassign (yield_expr|testlist) |
('=' (yield_expr|testlist_star_expr))*)
('=' (yield_expr|testlist_star_expr))*)
testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' |
augassign: ('+=' | '-=' | '*=' | '
@=' | '
/=' | '%=' | '&=' | '|=' | '^=' |
'<<=' | '>>=' | '**=' | '//=')
'<<=' | '>>=' | '**=' | '//=')
# For normal assignments, additional restrictions enforced by the interpreter
# For normal assignments, additional restrictions enforced by the interpreter
print_stmt: 'print' ( [ test (',' test)* [','] ] |
print_stmt: 'print' ( [ test (',' test)* [','] ] |
...
@@ -119,7 +119,7 @@ xor_expr: and_expr ('^' and_expr)*
...
@@ -119,7 +119,7 @@ xor_expr: and_expr ('^' and_expr)*
and_expr: shift_expr ('&' shift_expr)*
and_expr: shift_expr ('&' shift_expr)*
shift_expr: arith_expr (('<<'|'>>') arith_expr)*
shift_expr: arith_expr (('<<'|'>>') arith_expr)*
arith_expr: term (('+'|'-') term)*
arith_expr: term (('+'|'-') term)*
term: factor (('*'|'/'|'%'|'//') factor)*
term: factor (('*'|'
@'|'
/'|'%'|'//') factor)*
factor: ('+'|'-'|'~') factor | power
factor: ('+'|'-'|'~') factor | power
power: atom trailer* ['**' factor]
power: atom trailer* ['**' factor]
atom: ('(' [yield_expr|testlist_gexp] ')' |
atom: ('(' [yield_expr|testlist_gexp] ')' |
...
...
Lib/lib2to3/pgen2/grammar.py
Dosyayı görüntüle @
da952f3f
...
@@ -151,6 +151,7 @@ opmap_raw = """
...
@@ -151,6 +151,7 @@ opmap_raw = """
{ LBRACE
{ LBRACE
} RBRACE
} RBRACE
@ AT
@ AT
@= ATEQUAL
== EQEQUAL
== EQEQUAL
!= NOTEQUAL
!= NOTEQUAL
<> NOTEQUAL
<> NOTEQUAL
...
...
Lib/lib2to3/pgen2/token.py
Dosyayı görüntüle @
da952f3f
...
@@ -57,12 +57,13 @@ DOUBLESTAREQUAL = 47
...
@@ -57,12 +57,13 @@ DOUBLESTAREQUAL = 47
DOUBLESLASH
=
48
DOUBLESLASH
=
48
DOUBLESLASHEQUAL
=
49
DOUBLESLASHEQUAL
=
49
AT
=
50
AT
=
50
OP
=
51
ATEQUAL
=
51
COMMENT
=
52
OP
=
52
NL
=
53
COMMENT
=
53
RARROW
=
54
NL
=
54
ERRORTOKEN
=
55
RARROW
=
55
N_TOKENS
=
56
ERRORTOKEN
=
56
N_TOKENS
=
57
NT_OFFSET
=
256
NT_OFFSET
=
256
#--end constants--
#--end constants--
...
...
Lib/lib2to3/pgen2/tokenize.py
Dosyayı görüntüle @
da952f3f
...
@@ -84,7 +84,7 @@ String = group(r"[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'",
...
@@ -84,7 +84,7 @@ String = group(r"[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'",
# recognized as two instances of =).
# recognized as two instances of =).
Operator
=
group
(
r"\*\*=?"
,
r">>=?"
,
r"<<=?"
,
r"<>"
,
r"!="
,
Operator
=
group
(
r"\*\*=?"
,
r">>=?"
,
r"<<=?"
,
r"<>"
,
r"!="
,
r"//=?"
,
r"->"
,
r"//=?"
,
r"->"
,
r"[+\-*/
%
&|^=<>]=?"
,
r"[+\-*/
%
&
@
|^=<>]=?"
,
r"~"
)
r"~"
)
Bracket
=
'[][(){}]'
Bracket
=
'[][(){}]'
...
...
Lib/lib2to3/tests/test_parser.py
Dosyayı görüntüle @
da952f3f
...
@@ -44,6 +44,12 @@ class GrammarTest(support.TestCase):
...
@@ -44,6 +44,12 @@ class GrammarTest(support.TestCase):
raise
AssertionError
(
"Syntax shouldn't have been valid"
)
raise
AssertionError
(
"Syntax shouldn't have been valid"
)
class
TestMatrixMultiplication
(
GrammarTest
):
def
test_matrix_multiplication_operator
(
self
):
self
.
validate
(
"a @ b"
)
self
.
validate
(
"a @= b"
)
class
TestRaiseChanges
(
GrammarTest
):
class
TestRaiseChanges
(
GrammarTest
):
def
test_2x_style_1
(
self
):
def
test_2x_style_1
(
self
):
self
.
validate
(
"raise"
)
self
.
validate
(
"raise"
)
...
...
Misc/NEWS
Dosyayı görüntüle @
da952f3f
...
@@ -266,6 +266,8 @@ Library
...
@@ -266,6 +266,8 @@ Library
Tools
/
Demos
Tools
/
Demos
-----------
-----------
-
Add
support
for
the
PEP
465
matrix
multiplication
operator
to
2
to3
.
-
Issue
#
19936
:
Added
executable
bits
or
shebang
lines
to
Python
scripts
which
-
Issue
#
19936
:
Added
executable
bits
or
shebang
lines
to
Python
scripts
which
requires
them
.
Disable
executable
bits
and
shebang
lines
in
test
and
requires
them
.
Disable
executable
bits
and
shebang
lines
in
test
and
benchmark
files
in
order
to
prevent
using
a
random
system
python
,
and
in
benchmark
files
in
order
to
prevent
using
a
random
system
python
,
and
in
...
...
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