From: <fwi...@us...> - 2009-01-07 04:01:32
|
Revision: 5861 http://jython.svn.sourceforge.net/jython/?rev=5861&view=rev Author: fwierzbicki Date: 2009-01-07 04:01:27 +0000 (Wed, 07 Jan 2009) Log Message: ----------- added nonlocal Modified Paths: -------------- branches/jy3k/grammar/Python.g Modified: branches/jy3k/grammar/Python.g =================================================================== --- branches/jy3k/grammar/Python.g 2009-01-07 01:21:04 UTC (rev 5860) +++ branches/jy3k/grammar/Python.g 2009-01-07 04:01:27 UTC (rev 5861) @@ -577,14 +577,15 @@ } ; -//small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | -// import_stmt | global_stmt | assert_stmt) +//small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | +// import_stmt | global_stmt | nonlocal_stmt | assert_stmt) small_stmt : expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt + | nonlocal_stmt | assert_stmt ; @@ -785,6 +786,12 @@ -> ^(GLOBAL<Global>[$GLOBAL, actions.makeNames($n)]) ; +//nonlocal_stmt: 'nonlocal' NAME (',' NAME)* +nonlocal_stmt + : NONLOCAL n+=NAME (COMMA n+=NAME)* + -> ^(NONLOCAL<Global>[$NONLOCAL, actions.makeNames($n)]) + ; + //assert_stmt: 'assert' test [',' test] assert_stmt : ASSERT t1=test[expr_contextType.Load] (COMMA t2=test[expr_contextType.Load])? @@ -897,9 +904,9 @@ } ; -//with_var: ('as' | NAME) expr +//with_var: 'as' expr with_var returns [expr etype] - : (AS | NAME) expr[expr_contextType.Store] + : AS expr[expr_contextType.Store] { $etype = actions.castExpr($expr.tree); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |