Commit 8fe6cbf5 authored by Joel Einbinder's avatar Joel Einbinder Committed by Commit Bot

DevTools: Roll CodeMirror to 5.42.1

Bug: 908243
Change-Id: Ic049c51f0c631699a2117a4f3e275e4d51e8d91c
Reviewed-on: https://chromium-review.googlesource.com/c/1357545Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612884}
parent 0018a29a
...@@ -3,192 +3,192 @@ ...@@ -3,192 +3,192 @@
/* The rest of this file contains styles related to the mechanics of /* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */ the editor. You probably shouldn't touch them. */
.CodeMirror { .CodeMirror {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
background: white; background: white;
} }
.CodeMirror-scroll { .CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */ overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */ /* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */ /* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px; margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px; padding-bottom: 30px;
height: 100%; height: 100%;
outline: none; /* Prevent dragging from highlighting the element */ outline: none; /* Prevent dragging from highlighting the element */
position: relative; position: relative;
} }
.CodeMirror-sizer { .CodeMirror-sizer {
position: relative; position: relative;
border-right: 30px solid transparent; border-right: 30px solid transparent;
} }
/* The fake, visible scrollbars. Used to force redraw during scrolling /* The fake, visible scrollbars. Used to force redraw during scrolling
before actual scrolling happens, thus preventing shaking and before actual scrolling happens, thus preventing shaking and
flickering artifacts. */ flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute; position: absolute;
z-index: 6; z-index: 6;
display: none; display: none;
} }
.CodeMirror-vscrollbar { .CodeMirror-vscrollbar {
right: 0; top: 0; right: 0; top: 0;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
} }
.CodeMirror-hscrollbar { .CodeMirror-hscrollbar {
bottom: 0; left: 0; bottom: 0; left: 0;
overflow-y: hidden; overflow-y: hidden;
overflow-x: scroll; overflow-x: scroll;
} }
.CodeMirror-scrollbar-filler { .CodeMirror-scrollbar-filler {
right: 0; bottom: 0; right: 0; bottom: 0;
} }
.CodeMirror-gutter-filler { .CodeMirror-gutter-filler {
left: 0; bottom: 0; left: 0; bottom: 0;
} }
.CodeMirror-gutters { .CodeMirror-gutters {
position: absolute; left: 0; top: 0; position: absolute; left: 0; top: 0;
min-height: 100%; min-height: 100%;
z-index: 3; z-index: 3;
} }
.CodeMirror-gutter { .CodeMirror-gutter {
white-space: normal; white-space: normal;
height: 100%; height: 100%;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
margin-bottom: -30px; margin-bottom: -30px;
} }
.CodeMirror-gutter-wrapper { .CodeMirror-gutter-wrapper {
position: absolute; position: absolute;
z-index: 4; z-index: 4;
background: none !important; background: none !important;
border: none !important; border: none !important;
} }
.CodeMirror-gutter-background { .CodeMirror-gutter-background {
position: absolute; position: absolute;
top: 0; bottom: 0; top: 0; bottom: 0;
z-index: 4; z-index: 4;
} }
.CodeMirror-gutter-elt { .CodeMirror-gutter-elt {
position: absolute; position: absolute;
cursor: default; cursor: default;
z-index: 4; z-index: 4;
} }
.CodeMirror-gutter-wrapper ::selection { background-color: transparent } .CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } .CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
.CodeMirror-lines { .CodeMirror-lines {
cursor: text; cursor: text;
min-height: 1px; /* prevents collapsing before first draw */ min-height: 1px; /* prevents collapsing before first draw */
} }
.CodeMirror pre { .CodeMirror pre {
/* Reset some styles that the rest of the page might have set */ /* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0; border-width: 0;
background: transparent; background: transparent;
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
margin: 0; margin: 0;
white-space: pre; white-space: pre;
word-wrap: normal; word-wrap: normal;
line-height: inherit; line-height: inherit;
color: inherit; color: inherit;
z-index: 2; z-index: 2;
position: relative; position: relative;
overflow: visible; overflow: visible;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: contextual; -webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual; font-variant-ligatures: contextual;
} }
.CodeMirror-wrap pre { .CodeMirror-wrap pre {
word-wrap: break-word; word-wrap: break-word;
white-space: pre-wrap; white-space: pre-wrap;
word-break: normal; word-break: normal;
} }
.CodeMirror-linebackground { .CodeMirror-linebackground {
position: absolute; position: absolute;
left: 0; right: 0; top: 0; bottom: 0; left: 0; right: 0; top: 0; bottom: 0;
z-index: 0; z-index: 0;
} }
.CodeMirror-linewidget { .CodeMirror-linewidget {
position: relative; position: relative;
z-index: 2; z-index: 2;
padding: 0.1px; /* Force widget margins to stay inside of the container */ padding: 0.1px; /* Force widget margins to stay inside of the container */
} }
.CodeMirror-widget {} .CodeMirror-widget {}
.CodeMirror-rtl pre { direction: rtl; } .CodeMirror-rtl pre { direction: rtl; }
.CodeMirror-code { .CodeMirror-code {
outline: none; outline: none;
} }
/* Force content-box sizing for the elements where we expect it */ /* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll, .CodeMirror-scroll,
.CodeMirror-sizer, .CodeMirror-sizer,
.CodeMirror-gutter, .CodeMirror-gutter,
.CodeMirror-gutters, .CodeMirror-gutters,
.CodeMirror-linenumber { .CodeMirror-linenumber {
-moz-box-sizing: content-box; -moz-box-sizing: content-box;
box-sizing: content-box; box-sizing: content-box;
} }
.CodeMirror-measure { .CodeMirror-measure {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 0; height: 0;
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
} }
.CodeMirror-cursor { .CodeMirror-cursor {
position: absolute; position: absolute;
pointer-events: none; pointer-events: none;
} }
.CodeMirror-measure pre { position: static; } .CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors { div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background-color: #ffa;
background-color: rgba(255, 255, 0, .4);
}
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden; visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background-color: #ffa;
background-color: rgba(255, 255, 0, .4);
}
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
} }
}
/* See issue #2901 */ /* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; } .cm-tab-wrap-hack:after { content: ''; }
/* Help users use markselection to safely style text background */ /* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; } span.CodeMirror-selectedtext { background: none; }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
var Pos = CodeMirror.Pos; var Pos = CodeMirror.Pos;
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<"};
function findMatchingBracket(cm, where, config) { function findMatchingBracket(cm, where, config) {
var line = cm.getLineHandle(where.line), pos = where.ch - 1; var line = cm.getLineHandle(where.line), pos = where.ch - 1;
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
var maxScanLines = (config && config.maxScanLines) || 1000; var maxScanLines = (config && config.maxScanLines) || 1000;
var stack = []; var stack = [];
var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/; var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]<>]/;
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
: Math.max(cm.firstLine() - 1, where.line - maxScanLines); : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
......
...@@ -91,7 +91,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { ...@@ -91,7 +91,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
, textRE = /^[^#!\[\]*_\\<>` "'(~:]+/ , textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
, fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/ , fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/
, linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition , linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
, punctuation = /[!\"#$%&\'()*+,\-\.\/:;<=>?@\[\\\]^_`{|}~\u2014]/ , punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
, expandedTab = " " // CommonMark specifies tab as 4 spaces , expandedTab = " " // CommonMark specifies tab as 4 spaces
function switchInline(stream, state, f) { function switchInline(stream, state, f) {
...@@ -620,7 +620,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { ...@@ -620,7 +620,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
} }
} }
if (modeCfg.emoji && ch === ":" && stream.match(/^[a-z_\d+-]+:/)) { if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
state.emoji = true; state.emoji = true;
if (modeCfg.highlightFormatting) state.formatting = "emoji"; if (modeCfg.highlightFormatting) state.formatting = "emoji";
var retType = getType(state); var retType = getType(state);
...@@ -869,6 +869,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { ...@@ -869,6 +869,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
getType: getType, getType: getType,
blockCommentStart: "<!--",
blockCommentEnd: "-->",
closeBrackets: "()[]{}''\"\"``", closeBrackets: "()[]{}''\"\"``",
fold: "markdown" fold: "markdown"
}; };
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
if (stream.match(stringPrefixes)) { if (stream.match(stringPrefixes)) {
var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1; var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
if (!isFmtString) { if (!isFmtString) {
state.tokenize = tokenStringFactory(stream.current()); state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
return state.tokenize(stream, state); return state.tokenize(stream, state);
} else { } else {
state.tokenize = formatStringFactory(stream.current(), state.tokenize); state.tokenize = formatStringFactory(stream.current(), state.tokenize);
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
return tokenString; return tokenString;
} }
function tokenStringFactory(delimiter) { function tokenStringFactory(delimiter, tokenOuter) {
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0) while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
delimiter = delimiter.substr(1); delimiter = delimiter.substr(1);
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
if (singleline && stream.eol()) if (singleline && stream.eol())
return OUTCLASS; return OUTCLASS;
} else if (stream.match(delimiter)) { } else if (stream.match(delimiter)) {
state.tokenize = tokenBase; state.tokenize = tokenOuter;
return OUTCLASS; return OUTCLASS;
} else { } else {
stream.eat(/['"]/); stream.eat(/['"]/);
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
if (parserConf.singleLineStringErrors) if (parserConf.singleLineStringErrors)
return ERRORCLASS; return ERRORCLASS;
else else
state.tokenize = tokenBase; state.tokenize = tokenOuter;
} }
return OUTCLASS; return OUTCLASS;
} }
......
...@@ -14,26 +14,27 @@ ...@@ -14,26 +14,27 @@
CodeMirror.defineMode('shell', function() { CodeMirror.defineMode('shell', function() {
var words = {}; var words = {};
function define(style, string) { function define(style, dict) {
var split = string.split(' '); for(var i = 0; i < dict.length; i++) {
for(var i = 0; i < split.length; i++) { words[dict[i]] = style;
words[split[i]] = style;
} }
}; };
// Atoms var commonAtoms = ["true", "false"];
define('atom', 'true false'); var commonKeywords = ["if", "then", "do", "else", "elif", "while", "until", "for", "in", "esac", "fi",
"fin", "fil", "done", "exit", "set", "unset", "export", "function"];
// Keywords var commonCommands = ["ab", "awk", "bash", "beep", "cat", "cc", "cd", "chown", "chmod", "chroot", "clear",
define('keyword', 'if then do else elif while until for in esac fi fin ' + "cp", "curl", "cut", "diff", "echo", "find", "gawk", "gcc", "get", "git", "grep", "hg", "kill", "killall",
'fil done exit set unset export function'); "ln", "ls", "make", "mkdir", "openssl", "mv", "nc", "nl", "node", "npm", "ping", "ps", "restart", "rm",
"rmdir", "sed", "service", "sh", "shopt", "shred", "source", "sort", "sleep", "ssh", "start", "stop",
// Commands "su", "sudo", "svn", "tee", "telnet", "top", "touch", "vi", "vim", "wall", "wc", "wget", "who", "write",
define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' + "yes", "zsh"];
'curl cut diff echo find gawk gcc get git grep hg kill killall ln ls make ' +
'mkdir openssl mv nc nl node npm ping ps restart rm rmdir sed service sh ' + CodeMirror.registerHelper("hintWords", "shell", commonAtoms.concat(commonKeywords, commonCommands));
'shopt shred source sort sleep ssh start stop su sudo svn tee telnet top ' +
'touch vi vim wall wc wget who write yes zsh'); define('atom', commonAtoms);
define('keyword', commonKeywords);
define('builtin', commonCommands);
function tokenBase(stream, state) { function tokenBase(stream, state) {
if (stream.eatSpace()) return null; if (stream.eatSpace()) return null;
......
...@@ -63,7 +63,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { ...@@ -63,7 +63,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
if (/[\d.]/.test(stream.peek())) { if (/[\d.]/.test(stream.peek())) {
stream.eatWhile(/[\w.%]/); stream.eatWhile(/[\w.%]/);
return ret("number", "unit"); return ret("number", "unit");
} else if (stream.match(/^-[\w\\\-]+/)) { } else if (stream.match(/^-[\w\\\-]*/)) {
stream.eatWhile(/[\w\\\-]/); stream.eatWhile(/[\w\\\-]/);
if (stream.match(/^\s*:/, false)) if (stream.match(/^\s*:/, false))
return ret("variable-2", "variable-definition"); return ret("variable-2", "variable-definition");
...@@ -501,7 +501,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { ...@@ -501,7 +501,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"margin-bottom", "margin-left", "margin-right", "margin-top", "margin-bottom", "margin-left", "margin-right", "margin-top",
"marks", "marquee-direction", "marquee-loop", "marks", "marquee-direction", "marquee-loop",
"marquee-play-count", "marquee-speed", "marquee-style", "max-height", "marquee-play-count", "marquee-speed", "marquee-style", "max-height",
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index", "max-width", "min-height", "min-width", "mix-blend-mode", "move-to", "nav-down", "nav-index",
"nav-left", "nav-right", "nav-up", "object-fit", "object-position", "nav-left", "nav-right", "nav-up", "object-fit", "object-position",
"opacity", "order", "orphans", "outline", "opacity", "order", "orphans", "outline",
"outline-color", "outline-offset", "outline-style", "outline-width", "outline-color", "outline-offset", "outline-style", "outline-width",
......
...@@ -644,7 +644,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { ...@@ -644,7 +644,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) } if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) }
if (type == "variable") { register(value); return cont(); } if (type == "variable") { register(value); return cont(); }
if (type == "spread") return cont(pattern); if (type == "spread") return cont(pattern);
if (type == "[") return contCommasep(pattern, "]"); if (type == "[") return contCommasep(eltpattern, "]");
if (type == "{") return contCommasep(proppattern, "}"); if (type == "{") return contCommasep(proppattern, "}");
} }
function proppattern(type, value) { function proppattern(type, value) {
...@@ -655,8 +655,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { ...@@ -655,8 +655,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "variable") cx.marked = "property"; if (type == "variable") cx.marked = "property";
if (type == "spread") return cont(pattern); if (type == "spread") return cont(pattern);
if (type == "}") return pass(); if (type == "}") return pass();
if (type == "[") return cont(expression, expect(']'), expect(':'), proppattern);
return cont(expect(":"), pattern, maybeAssign); return cont(expect(":"), pattern, maybeAssign);
} }
function eltpattern() {
return pass(pattern, maybeAssign)
}
function maybeAssign(_type, value) { function maybeAssign(_type, value) {
if (value == "=") return cont(expressionNoComma); if (value == "=") return cont(expressionNoComma);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment