diff options
author | Eric Smith <eric@trueblade.com> | 2008-03-17 19:43:40 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2008-03-17 19:43:40 (GMT) |
commit | 0aed07ad80795bd5856ed60e7edcadeb353cf5a0 (patch) | |
tree | 55268a52e9e0686949dea35b218275817b2a1bbe /Lib/tokenize.py | |
parent | 6f778cfb5ba0291ed29c51fbdd6e40760097fd36 (diff) | |
download | cpython-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.py | 5 |
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 |