diff options
author | Jonathan Duran | 2012-07-17 11:42:09 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-07-17 11:42:09 -0700 |
commit | b4b3e45d6684e77d361b4f8ca5be4889428320c5 (patch) | |
tree | 2156d9920ea1b7db49ed6460545fea7cda121bae /imports/codemirror/mode/javascript/javascript.js | |
parent | 4a87ff575693509ac578d46af26fa137c0dc3f58 (diff) | |
parent | 4f737b24c19ddc02d20f9783b8b080fc6ef11142 (diff) | |
download | ninja-b4b3e45d6684e77d361b4f8ca5be4889428320c5.tar.gz |
Merge branch 'refs/heads/NINJA-master' into TimelineUber
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; |