diff options
author | Kruti Shah | 2012-07-17 12:40:00 -0700 |
---|---|---|
committer | Kruti Shah | 2012-07-17 12:40:00 -0700 |
commit | bf2d7bdb22c28089dc1067bc9094ebc590daac87 (patch) | |
tree | 2156d9920ea1b7db49ed6460545fea7cda121bae /imports/codemirror/mode/javascript/javascript.js | |
parent | 7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (diff) | |
parent | b4b3e45d6684e77d361b4f8ca5be4889428320c5 (diff) | |
download | ninja-bf2d7bdb22c28089dc1067bc9094ebc590daac87.tar.gz |
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'imports/codemirror/mode/javascript/javascript.js')
-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; |