From 1490eafdd26a576dcc3832d1811802c0162dfe84 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sat, 30 Jul 2016 12:25:24 +0800 Subject: Update CodeMirror to version 5.17.1 --- .../vendor/codemirror/mode/javascript/javascript.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'public/vendor/codemirror/mode/javascript/javascript.js') diff --git a/public/vendor/codemirror/mode/javascript/javascript.js b/public/vendor/codemirror/mode/javascript/javascript.js index ca875411..da6b760f 100644 --- a/public/vendor/codemirror/mode/javascript/javascript.js +++ b/public/vendor/codemirror/mode/javascript/javascript.js @@ -216,7 +216,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var bracket = brackets.indexOf(ch); if (bracket >= 0 && bracket < 3) { if (!depth) { ++pos; break; } - if (--depth == 0) break; + if (--depth == 0) { if (ch == "(") sawSomething = true; break; } } else if (bracket >= 3 && bracket < 6) { ++depth; } else if (wordRE.test(ch)) { @@ -386,8 +386,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); if (type == "function") return cont(functiondef, maybeop); - if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression); - if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop); + if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression); + if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); if (type == "{") return contCommasep(objprop, "}", null, maybeop); @@ -463,6 +463,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "variable") {cx.marked = "property"; return cont();} } function objprop(type, value) { + if (type == "async") return cont(objprop); if (type == "variable" || cx.style == "keyword") { cx.marked = "property"; if (value == "get" || value == "set") return cont(getterSetter); @@ -494,7 +495,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == ",") { var lex = cx.state.lexical; if (lex.info == "call") lex.pos = (lex.pos || 0) + 1; - return cont(what, proceed); + return cont(function(type, value) { + if (type == end || value == end) return pass() + return pass(what) + }, proceed); } if (type == end || value == end) return cont(); return cont(expect(end)); @@ -637,17 +641,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } function arrayLiteral(type) { if (type == "]") return cont(); - return pass(expressionNoComma, maybeArrayComprehension); - } - function maybeArrayComprehension(type) { - if (type == "for") return pass(comprehension, expect("]")); - if (type == ",") return cont(commasep(maybeexpressionNoComma, "]")); return pass(commasep(expressionNoComma, "]")); } - function comprehension(type) { - if (type == "for") return cont(forspec, comprehension); - if (type == "if") return cont(expression, comprehension); - } function isContinuedStatement(state, textAfter) { return state.lastType == "operator" || state.lastType == "," || -- cgit v1.2.3