[Python-checkins] r55480 - in sandbox/trunk/2to3: Grammar.txt tests/data/py3_test_grammar.py
collin.winter
python-checkins at python.org
Mon May 21 06:21:15 CEST 2007
Author: collin.winter
Date: Mon May 21 06:21:11 2007
New Revision: 55480
Modified:
sandbox/trunk/2to3/Grammar.txt
sandbox/trunk/2to3/tests/data/py3_test_grammar.py
Log:
Add support (and tests) for class decorators
Modified: sandbox/trunk/2to3/Grammar.txt
==============================================================================
--- sandbox/trunk/2to3/Grammar.txt (original)
+++ sandbox/trunk/2to3/Grammar.txt Mon May 21 06:21:11 2007
@@ -33,7 +33,8 @@
decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
decorators: decorator+
-funcdef: [decorators] 'def' NAME parameters ['->' test] ':' suite
+decorated: decorators (classdef | funcdef)
+funcdef: 'def' NAME parameters ['->' test] ':' suite
parameters: '(' [typedargslist] ')'
typedargslist: ((tfpdef ['=' test] ',')*
('*' [tname] (',' tname ['=' test])* [',' '**' tname] | '**' tname)
@@ -80,7 +81,7 @@
exec_stmt: 'exec' expr ['in' test [',' test]]
assert_stmt: 'assert' test [',' test]
-compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef
+compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
while_stmt: 'while' test ':' suite ['else' ':' suite]
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
Modified: sandbox/trunk/2to3/tests/data/py3_test_grammar.py
==============================================================================
--- sandbox/trunk/2to3/tests/data/py3_test_grammar.py (original)
+++ sandbox/trunk/2to3/tests/data/py3_test_grammar.py Mon May 21 06:21:11 2007
@@ -16,6 +16,7 @@
# testing import *
from sys import *
+ at class_decorator
class TokenTests(unittest.TestCase):
def testBackslash(self):
More information about the Python-checkins
mailing list