From: <fwi...@us...> - 2008-12-07 18:57:32
|
Revision: 5721 http://jython.svn.sourceforge.net/jython/?rev=5721&view=rev Author: fwierzbicki Date: 2008-12-07 18:57:27 +0000 (Sun, 07 Dec 2008) Log Message: ----------- A couple more missed adaptations revealed by sympy testing. Modified Paths: -------------- trunk/jython/src/org/python/antlr/adapter/AstAdapters.java Modified: trunk/jython/src/org/python/antlr/adapter/AstAdapters.java =================================================================== --- trunk/jython/src/org/python/antlr/adapter/AstAdapters.java 2008-12-07 06:35:04 UTC (rev 5720) +++ trunk/jython/src/org/python/antlr/adapter/AstAdapters.java 2008-12-07 18:57:27 UTC (rev 5721) @@ -103,6 +103,7 @@ return (stmt)stmtAdapter.py2ast(o); } + //XXX: Unnecessary but needs to be fixed in the code generation of asdl_antlr.py public static Object py2string(Object o) { if (o == null || o instanceof PyString) { return o; @@ -187,7 +188,29 @@ } public static PyObject cmpop2py(cmpopType o) { - return cmpopAdapter.ast2py(o); + switch (o) { + case Eq: + return new Eq(); + case NotEq: + return new NotEq(); + case Lt: + return new Lt(); + case LtE: + return new LtE(); + case Gt: + return new Gt(); + case GtE: + return new GtE(); + case Is: + return new Is(); + case IsNot: + return new IsNot(); + case In: + return new In(); + case NotIn: + return new NotIn(); + } + return Py.None; } public static PyObject unaryop2py(unaryopType o) { @@ -263,6 +286,18 @@ if (o == null || o instanceof unaryopType) { return (unaryopType)o; } + if (o instanceof PyObject) { + switch (((PyObject)o).asInt()) { + case 1: + return unaryopType.Invert; + case 2: + return unaryopType.Not; + case 3: + return unaryopType.UAdd; + case 4: + return unaryopType.USub; + } + } //FIXME: investigate the right exception throw Py.TypeError("Can't convert " + o.getClass().getName() + " to unaryop node"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |