From: <fwi...@us...> - 2007-12-16 14:02:10
|
Revision: 3816 http://jython.svn.sourceforge.net/jython/?rev=3816&view=rev Author: fwierzbicki Date: 2007-12-16 06:02:08 -0800 (Sun, 16 Dec 2007) Log Message: ----------- Global support. Modified Paths: -------------- trunk/sandbox/ast/grammar/PythonWalker.g Modified: trunk/sandbox/ast/grammar/PythonWalker.g =================================================================== --- trunk/sandbox/ast/grammar/PythonWalker.g 2007-12-16 02:59:37 UTC (rev 3815) +++ trunk/sandbox/ast/grammar/PythonWalker.g 2007-12-16 14:02:08 UTC (rev 3816) @@ -34,6 +34,7 @@ import org.python.antlr.ast.Expr; import org.python.antlr.ast.For; import org.python.antlr.ast.FunctionDef; +import org.python.antlr.ast.Global; import org.python.antlr.ast.Import; import org.python.antlr.ast.Module; import org.python.antlr.ast.Name; @@ -530,9 +531,21 @@ ; global_stmt - : ^(Global NAME+) +@init { + List nms = new ArrayList(); +} + : ^(Global name_expr[nms]+) { + String[] n = (String[])nms.toArray(new String[nms.size()]); + $stmts::statements.add(new Global($Global, n)); + } ; +name_expr[List nms] + : NAME { + nms.add($NAME.text); + } + ; + exec_stmt : ^(Exec test[expr_contextType.Load] (^(Globals test[expr_contextType.Load]))? (^(Locals test[expr_contextType.Load]))?) ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |