summaryrefslogtreecommitdiffstats
path: root/Lib/tokenize.py
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2008-03-17 19:43:40 (GMT)
committerEric Smith <eric@trueblade.com>2008-03-17 19:43:40 (GMT)
commit0aed07ad80795bd5856ed60e7edcadeb353cf5a0 (patch)
tree55268a52e9e0686949dea35b218275817b2a1bbe /Lib/tokenize.py
parent6f778cfb5ba0291ed29c51fbdd6e40760097fd36 (diff)
downloadcpython-0aed07ad80795bd5856ed60e7edcadeb353cf5a0.zip
cpython-0aed07ad80795bd5856ed60e7edcadeb353cf5a0.tar.gz
cpython-0aed07ad80795bd5856ed60e7edcadeb353cf5a0.tar.bz2
Added PEP 3127 support to tokenize (with tests); added PEP 3127 to NEWS.
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r--Lib/tokenize.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py
index 1c93944..76ab430 100644
--- a/Lib/tokenize.py
+++ b/Lib/tokenize.py
@@ -51,9 +51,10 @@ Ignore = Whitespace + any(r'\\\r?\n' + Whitespace) + maybe(Comment)
Name = r'[a-zA-Z_]\w*'
Hexnumber = r'0[xX][\da-fA-F]+[lL]?'
-Octnumber = r'0[0-7]*[lL]?'
+Octnumber = r'(0[oO][0-7]+)|(0[0-7]*)[lL]?'
+Binnumber = r'0[bB][01]+[lL]?'
Decnumber = r'[1-9]\d*[lL]?'
-Intnumber = group(Hexnumber, Octnumber, Decnumber)
+Intnumber = group(Hexnumber, Binnumber, Octnumber, Decnumber)
Exponent = r'[eE][-+]?\d+'
Pointfloat = group(r'\d+\.\d*', r'\.\d+') + maybe(Exponent)
Expfloat = r'\d+' + Exponent