aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/javascript
diff options
context:
space:
mode:
authorAnanya Sen2012-07-16 16:04:05 -0700
committerAnanya Sen2012-07-16 16:04:05 -0700
commit0e04fff0ea80fa5cbe96b8354db38bd334aea83a (patch)
tree212d164c0f83d80394e34f1df532ea0461ad328d /imports/codemirror/mode/javascript
parent5146f224258929415adf4a8022e492454b4e2476 (diff)
downloadninja-0e04fff0ea80fa5cbe96b8354db38bd334aea83a.tar.gz
upgrade to codemirror 2.3
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> Conflicts: js/code-editor/codemirror-ninja/theme/lesser-dark-ninja.css Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
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;