[Python-checkins] r54503 - in sandbox/trunk/2to3: fixes/fix_numliterals.py pgen2/tokenize.py
collin.winter
python-checkins at python.org
Wed Mar 21 22:53:29 CET 2007
Author: collin.winter
Date: Wed Mar 21 22:53:25 2007
New Revision: 54503
Modified:
sandbox/trunk/2to3/fixes/fix_numliterals.py
sandbox/trunk/2to3/pgen2/tokenize.py
Log:
Changes needed to make fix_numliterals work correctly.
Modified: sandbox/trunk/2to3/fixes/fix_numliterals.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_numliterals.py (original)
+++ sandbox/trunk/2to3/fixes/fix_numliterals.py Wed Mar 21 22:53:25 2007
@@ -21,7 +21,8 @@
return (node.type == token.NUMBER and
(node.value.startswith("0") or
'E' in node.value or
- 'J' in node.value))
+ 'J' in node.value or
+ node.value[-1] in "Ll"))
def transform(self, node):
val = node.value
Modified: sandbox/trunk/2to3/pgen2/tokenize.py
==============================================================================
--- sandbox/trunk/2to3/pgen2/tokenize.py (original)
+++ sandbox/trunk/2to3/pgen2/tokenize.py Wed Mar 21 22:53:25 2007
@@ -47,7 +47,7 @@
Name = r'[a-zA-Z_]\w*'
Hexnumber = r'0[xX][\da-fA-F]*[lL]?'
-Octnumber = r'0[0-7]*[lL]?'
+Octnumber = r'0[o]?[0-7]*[lL]?'
Decnumber = r'[1-9]\d*[lL]?'
Intnumber = group(Hexnumber, Octnumber, Decnumber)
Exponent = r'[eE][-+]?\d+'
More information about the Python-checkins
mailing list