SF.net SVN: jython:[7241] trunk/jython/src/org/python/core/PyString.java

[email protected] Wed, 16 Mar 2011 05:44:13 +0000
Newsgroups gmane.comp.lang.jython.cvs
Message-ID <[email protected]>
Revision: 7241
          http://jython.svn.sourceforge.net/jython/?rev=7241&view=rev
Author:   fwierzbicki
Date:     2011-03-16 05:44:13 +0000 (Wed, 16 Mar 2011)

Log Message:
-----------
Fixes various calls to int() with new numerical literals.

Modified Paths:
--------------
    trunk/jython/src/org/python/core/PyString.java

Modified: trunk/jython/src/org/python/core/PyString.java
===================================================================
--- trunk/jython/src/org/python/core/PyString.java	2011-03-14 23:09:29 UTC (rev 7240)
+++ trunk/jython/src/org/python/core/PyString.java	2011-03-16 05:44:13 UTC (rev 7241)
@@ -1587,17 +1587,37 @@
                 while (b < e && Character.isWhitespace(getString().charAt(b))) b++;
             }
 
-            if (base == 0 || base == 16) {
+            if (base == 16) {
                 if (getString().charAt(b) == '0') {
                     if (b < e-1 &&
                            Character.toUpperCase(getString().charAt(b+1)) == 'X') {
+                        b += 2;
+                    }
+                }
+            } else if (base == 0) {
+                if (getString().charAt(b) == '0') {
+                    if (b < e-1 && Character.toUpperCase(getString().charAt(b+1)) == 'X') {
                         base = 16;
                         b += 2;
+                    } else if (b < e-1 && Character.toUpperCase(getString().charAt(b+1)) == 'O') {
+                        base = 8;
+                        b += 2;
+                    } else if (b < e-1 && Character.toUpperCase(getString().charAt(b+1)) == 'B') {
+                        base = 2;
+                        b += 2;
                     } else {
-                        if (base == 0)
-                            base = 8;
+                        base = 8;
                     }
                 }
+            } else if (base == 8) {
+                if (b < e-1 && Character.toUpperCase(getString().charAt(b+1)) == 'O') {
+                    b += 2;
+                }
+            } else if (base == 2) {
+                if (b < e-1 &&
+                       Character.toUpperCase(getString().charAt(b+1)) == 'B') {
+                    b += 2;
+                }
             }
         }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d