| Index: third_party/WebKit/Source/devtools/front_end/cm_modes/python.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/cm_modes/python.js b/third_party/WebKit/Source/devtools/front_end/cm_modes/python.js
|
| index be65ad76876c7723da96cae9f14c02ddc1e8a873..b539d84aa6a9229a4e1f8eecf2f01fa1f97a4015 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/cm_modes/python.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/cm_modes/python.js
|
| @@ -55,7 +55,7 @@
|
| if (parserConf.extra_builtins != undefined)
|
| myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
|
|
|
| - var py3 = parserConf.version && parseInt(parserConf.version, 10) == 3
|
| + var py3 = !(parserConf.version && Number(parserConf.version) < 3)
|
| if (py3) {
|
| // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
|
| var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!@]/;
|
| @@ -70,7 +70,7 @@
|
| myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
|
| "file", "intern", "long", "raw_input", "reduce", "reload",
|
| "unichr", "unicode", "xrange", "False", "True", "None"]);
|
| - var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
| + var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
| }
|
| var keywords = wordRegexp(myKeywords);
|
| var builtins = wordRegexp(myBuiltins);
|
| @@ -85,7 +85,7 @@
|
| var lineOffset = stream.indentation();
|
| if (lineOffset > scopeOffset)
|
| pushPyScope(state);
|
| - else if (lineOffset < scopeOffset && dedent(stream, state))
|
| + else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
|
| state.errorToken = true;
|
| return null;
|
| } else {
|
| @@ -113,8 +113,8 @@
|
| if (stream.match(/^[0-9\.]/, false)) {
|
| var floatLiteral = false;
|
| // Floats
|
| - if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
| - if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
|
| + if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
| + if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
|
| if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
| if (floatLiteral) {
|
| // Float literals may be "imaginary"
|
| @@ -124,13 +124,13 @@
|
| // Integers
|
| var intLiteral = false;
|
| // Hex
|
| - if (stream.match(/^0x[0-9a-f]+/i)) intLiteral = true;
|
| + if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
|
| // Binary
|
| - if (stream.match(/^0b[01]+/i)) intLiteral = true;
|
| + if (stream.match(/^0b[01_]+/i)) intLiteral = true;
|
| // Octal
|
| - if (stream.match(/^0o[0-7]+/i)) intLiteral = true;
|
| + if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
|
| // Decimal
|
| - if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
|
| + if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
|
| // Decimal literals may be "imaginary"
|
| stream.eat(/J/i);
|
| // TODO - Can you have imaginary longs?
|
| @@ -185,7 +185,7 @@
|
| }
|
|
|
| function tokenStringFactory(delimiter) {
|
| - while ("rub".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
| + while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
| delimiter = delimiter.substr(1);
|
|
|
| var singleline = delimiter.length == 1;
|
|
|