From: <fwi...@us...> - 2008-08-20 15:37:05
|
Revision: 5220 http://jython.svn.sourceforge.net/jython/?rev=5220&view=rev Author: fwierzbicki Date: 2008-08-20 15:37:02 +0000 (Wed, 20 Aug 2008) Log Message: ----------- repr support. Modified Paths: -------------- branches/nowalker/grammar/Python.g Modified: branches/nowalker/grammar/Python.g =================================================================== --- branches/nowalker/grammar/Python.g 2008-08-20 15:23:14 UTC (rev 5219) +++ branches/nowalker/grammar/Python.g 2008-08-20 15:37:02 UTC (rev 5220) @@ -80,7 +80,6 @@ Expression; Ellipsis; ListComp; - Repr; Target; GeneratorExp; Ifs; @@ -88,7 +87,6 @@ GenFor; GenIf; - ListFor; ListIf; } @@ -139,10 +137,11 @@ import org.python.antlr.ast.Module; import org.python.antlr.ast.Name; import org.python.antlr.ast.Num; +import org.python.antlr.ast.operatorType; import org.python.antlr.ast.Pass; import org.python.antlr.ast.Print; import org.python.antlr.ast.Raise; -import org.python.antlr.ast.operatorType; +import org.python.antlr.ast.Repr; import org.python.antlr.ast.Return; import org.python.antlr.ast.Slice; import org.python.antlr.ast.sliceType; @@ -775,7 +774,7 @@ //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[expr_contextType.Load] ORELSE e=test[expr_contextType.Load] + ( (IF or_test[expr_contextType.Load] ORELSE) => IF o2=or_test[ctype] ORELSE e=test[expr_contextType.Load] -> ^(IF<IfExp>[$IF, (exprType)$o2.tree, (exprType)$o1.tree, (exprType)$e.tree]) | -> or_test ) @@ -1000,7 +999,7 @@ | -> ^(LCURLY<Dict>[$LCURLY, new exprType[0\], new exprType[0\]]) ) RCURLY - | BACKQUOTE testlist[expr_contextType.Load] BACKQUOTE -> ^(Repr BACKQUOTE testlist) + | lb=BACKQUOTE testlist[expr_contextType.Load] rb=BACKQUOTE -> ^(BACKQUOTE<Repr>[$lb, (exprType)$testlist.tree]) | NAME -> ^(PYNODE<Name>[$NAME, $NAME.text, $expr::ctype]) | INT -> ^(PYNODE<Num>[$INT, actions.makeInt($INT)]) | LONGINT -> ^(PYNODE<Num>[$LONGINT, actions.makeInt($LONGINT)]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |