diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js index b0ba8d017f4ed9155ca75a0695634b30419793d9..fac8d57769adf41a701631aff16497416c4d9ff9 100644 --- a/mode/javascript/javascript.js +++ b/mode/javascript/javascript.js @@ -205,6 +205,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { ++depth; } else if (wordRE.test(ch)) { sawSomething = true; + } else if (/["'\/]/.test(ch)) { + return; } else if (sawSomething && !depth) { ++pos; break; diff --git a/mode/javascript/test.js b/mode/javascript/test.js index aaeb8e0c0707de5b2faa77eda24c9250f766e8dd..91b0e89a06a7e0a6503b238fbb906ba0f085bb49 100644 --- a/mode/javascript/test.js +++ b/mode/javascript/test.js @@ -61,6 +61,12 @@ " [keyword yield] [variable-2 i];", "}"); + MT("quotedStringAddition", + "[keyword let] [variable f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];"); + + MT("quotedFatArrow", + "[keyword let] [variable f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];"); + MT("fatArrow", "[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);", "[variable a];", // No longer in scope