Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1688)

Unified Diff: Source/devtools/front_end/cm/coffeescript.js

Issue 354833004: DevTools: [CodeMirror] roll CodeMirror to version @e20d175 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/cm/codemirror.js ('k') | Source/devtools/front_end/cm/comment.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/cm/coffeescript.js
diff --git a/Source/devtools/front_end/cm/coffeescript.js b/Source/devtools/front_end/cm/coffeescript.js
index e8bfe48a248bca6b692b1e0848d9603c5a143c16..16956501262839daf9bdfc57f32dcbbda64c60f0 100644
--- a/Source/devtools/front_end/cm/coffeescript.js
+++ b/Source/devtools/front_end/cm/coffeescript.js
@@ -1,7 +1,20 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
/**
* Link to the project's GitHub page:
* https://github.com/pickhardt/coffeescript-codemirror-mode
*/
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
CodeMirror.defineMode("coffeescript", function(conf) {
var ERRORCLASS = "error";
@@ -119,13 +132,13 @@ CodeMirror.defineMode("coffeescript", function(conf) {
// Handle strings
if (stream.match(stringPrefixes)) {
- state.tokenize = tokenFactory(stream.current(), "string");
+ state.tokenize = tokenFactory(stream.current(), false, "string");
return state.tokenize(stream, state);
}
// Handle regex literals
if (stream.match(regexPrefixes)) {
if (stream.current() != "/" || stream.match(/^.*\//, false)) { // prevent highlight of division
- state.tokenize = tokenFactory(stream.current(), "string-2");
+ state.tokenize = tokenFactory(stream.current(), true, "string-2");
return state.tokenize(stream, state);
} else {
stream.backUp(1);
@@ -161,8 +174,7 @@ CodeMirror.defineMode("coffeescript", function(conf) {
return ERRORCLASS;
}
- function tokenFactory(delimiter, outclass) {
- var singleline = delimiter.length == 1;
+ function tokenFactory(delimiter, singleline, outclass) {
return function(stream, state) {
while (!stream.eol()) {
stream.eatWhile(/[^'"\/\\]/);
@@ -352,3 +364,5 @@ CodeMirror.defineMode("coffeescript", function(conf) {
});
CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
+
+});
« no previous file with comments | « Source/devtools/front_end/cm/codemirror.js ('k') | Source/devtools/front_end/cm/comment.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698