From: <fwi...@us...> - 2008-08-20 15:23:16
|
Revision: 5219 http://jython.svn.sourceforge.net/jython/?rev=5219&view=rev Author: fwierzbicki Date: 2008-08-20 15:23:14 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Conditional Expression support. Modified Paths: -------------- branches/nowalker/grammar/Python.g Modified: branches/nowalker/grammar/Python.g =================================================================== --- branches/nowalker/grammar/Python.g 2008-08-20 14:39:21 UTC (rev 5218) +++ branches/nowalker/grammar/Python.g 2008-08-20 15:23:14 UTC (rev 5219) @@ -78,10 +78,6 @@ PYNODE; Interactive; Expression; - Test; - Body; - Dict; - IfExp; Ellipsis; ListComp; Repr; @@ -133,6 +129,7 @@ import org.python.antlr.ast.FunctionDef; import org.python.antlr.ast.Global; import org.python.antlr.ast.If; +import org.python.antlr.ast.IfExp; import org.python.antlr.ast.Import; import org.python.antlr.ast.ImportFrom; import org.python.antlr.ast.Index; @@ -778,8 +775,8 @@ //test: or_test ['if' or_test 'else' test] | lambdef test[expr_contextType ctype] :o1=or_test[ctype] - ( (IF or_test[expr_contextType.Load] ORELSE) => IF o2=or_test[ctype] ORELSE test[expr_contextType.Load] - -> ^(IfExp ^(Test $o2) ^(Body $o1) ^(ORELSE test)) + ( (IF or_test[expr_contextType.Load] ORELSE) => IF o2=or_test[expr_contextType.Load] ORELSE e=test[expr_contextType.Load] + -> ^(IF<IfExp>[$IF, (exprType)$o2.tree, (exprType)$o1.tree, (exprType)$e.tree]) | -> or_test ) | lambdef {debug("parsed lambdef");} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |