diff options
author | Jon Reid | 2012-07-17 16:03:14 -0700 |
---|---|---|
committer | Jon Reid | 2012-07-17 16:03:14 -0700 |
commit | 42a51e0c27f2e2cd825d07b3af5ec05b0e5208b3 (patch) | |
tree | 67deeb8c5b34aacc91f737cc64a3bc9ef1f4f05f /imports/codemirror/mode/javascript | |
parent | a12cabc16273ffe04af4bce1f7438dc9326efa89 (diff) | |
parent | b4b3e45d6684e77d361b4f8ca5be4889428320c5 (diff) | |
download | ninja-42a51e0c27f2e2cd825d07b3af5ec05b0e5208b3.tar.gz |
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Diffstat (limited to 'imports/codemirror/mode/javascript')
-rw-r--r-- | imports/codemirror/mode/javascript/javascript.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/imports/codemirror/mode/javascript/javascript.js b/imports/codemirror/mode/javascript/javascript.js index 462f4863..65f11c5b 100644 --- a/imports/codemirror/mode/javascript/javascript.js +++ b/imports/codemirror/mode/javascript/javascript.js | |||
@@ -54,7 +54,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { | |||
54 | stream.eatWhile(/[\da-f]/i); | 54 | stream.eatWhile(/[\da-f]/i); |
55 | return ret("number", "number"); | 55 | return ret("number", "number"); |
56 | } | 56 | } |
57 | else if (/\d/.test(ch)) { | 57 | else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) { |
58 | stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); | 58 | stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); |
59 | return ret("number", "number"); | 59 | return ret("number", "number"); |
60 | } | 60 | } |
@@ -243,7 +243,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { | |||
243 | 243 | ||
244 | function maybeoperator(type, value) { | 244 | function maybeoperator(type, value) { |
245 | if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator); | 245 | if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator); |
246 | if (type == "operator") return cont(expression); | 246 | if (type == "operator" || type == ":") return cont(expression); |
247 | if (type == ";") return; | 247 | if (type == ";") return; |
248 | if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator); | 248 | if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator); |
249 | if (type == ".") return cont(property, maybeoperator); | 249 | if (type == ".") return cont(property, maybeoperator); |
@@ -341,8 +341,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { | |||
341 | 341 | ||
342 | indent: function(state, textAfter) { | 342 | indent: function(state, textAfter) { |
343 | if (state.tokenize != jsTokenBase) return 0; | 343 | if (state.tokenize != jsTokenBase) return 0; |
344 | var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, | 344 | var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; |
345 | type = lexical.type, closing = firstChar == type; | 345 | if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; |
346 | var type = lexical.type, closing = firstChar == type; | ||
346 | if (type == "vardef") return lexical.indented + 4; | 347 | if (type == "vardef") return lexical.indented + 4; |
347 | else if (type == "form" && firstChar == "{") return lexical.indented; | 348 | else if (type == "form" && firstChar == "{") return lexical.indented; |
348 | else if (type == "stat" || type == "form") return lexical.indented + indentUnit; | 349 | else if (type == "stat" || type == "form") return lexical.indented + indentUnit; |