aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/javascript
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-07-17 14:01:12 -0700
committerJose Antonio Marquez2012-07-17 14:01:12 -0700
commitf40c8c58638da8fcd9a7abb06b8f2a4c6ba995bd (patch)
treecb1ff6a31b144fe4f584f778d5691f06362b227e /imports/codemirror/mode/javascript
parent17d464e5bd224cdd8940855409359b411325f1df (diff)
parent4f737b24c19ddc02d20f9783b8b080fc6ef11142 (diff)
downloadninja-f40c8c58638da8fcd9a7abb06b8f2a4c6ba995bd.tar.gz
Merge branch 'refs/heads/Ninja-Master' into Document
Diffstat (limited to 'imports/codemirror/mode/javascript')
-rw-r--r--imports/codemirror/mode/javascript/javascript.js9
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;