From 01685c255fda6e13f1cd2980130d2e388d52125c Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sat, 4 Jul 2015 11:31:01 +0800 Subject: Updated codemirror to 5.4.0 --- public/vendor/codemirror/mode/dylan/dylan.js | 44 ++++++++++++---------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'public/vendor/codemirror/mode/dylan/dylan.js') diff --git a/public/vendor/codemirror/mode/dylan/dylan.js b/public/vendor/codemirror/mode/dylan/dylan.js index be2986ad..85f0166c 100755 --- a/public/vendor/codemirror/mode/dylan/dylan.js +++ b/public/vendor/codemirror/mode/dylan/dylan.js @@ -154,20 +154,12 @@ CodeMirror.defineMode("dylan", function(_config) { return f(stream, state); } - var type, content; - - function ret(_type, style, _content) { - type = _type; - content = _content; - return style; - } - function tokenBase(stream, state) { // String var ch = stream.peek(); if (ch == "'" || ch == '"') { stream.next(); - return chain(stream, state, tokenString(ch, "string", "string")); + return chain(stream, state, tokenString(ch, "string")); } // Comment else if (ch == "/") { @@ -176,16 +168,16 @@ CodeMirror.defineMode("dylan", function(_config) { return chain(stream, state, tokenComment); } else if (stream.eat("/")) { stream.skipToEnd(); - return ret("comment", "comment"); + return "comment"; } else { stream.skipTo(" "); - return ret("operator", "operator"); + return "operator"; } } // Decimal else if (/\d/.test(ch)) { stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/); - return ret("number", "number"); + return "number"; } // Hash else if (ch == "#") { @@ -194,33 +186,33 @@ CodeMirror.defineMode("dylan", function(_config) { ch = stream.peek(); if (ch == '"') { stream.next(); - return chain(stream, state, tokenString('"', "symbol", "string-2")); + return chain(stream, state, tokenString('"', "string-2")); } // Binary number else if (ch == "b") { stream.next(); stream.eatWhile(/[01]/); - return ret("number", "number"); + return "number"; } // Hex number else if (ch == "x") { stream.next(); stream.eatWhile(/[\da-f]/i); - return ret("number", "number"); + return "number"; } // Octal number else if (ch == "o") { stream.next(); stream.eatWhile(/[0-7]/); - return ret("number", "number"); + return "number"; } // Hash symbol else { stream.eatWhile(/[-a-zA-Z]/); - return ret("hash", "keyword"); + return "keyword"; } } else if (stream.match("end")) { - return ret("end", "keyword"); + return "keyword"; } for (var name in patterns) { if (patterns.hasOwnProperty(name)) { @@ -228,21 +220,21 @@ CodeMirror.defineMode("dylan", function(_config) { if ((pattern instanceof Array && pattern.some(function(p) { return stream.match(p); })) || stream.match(pattern)) - return ret(name, patternStyles[name], stream.current()); + return patternStyles[name]; } } if (stream.match("define")) { - return ret("definition", "def"); + return "def"; } else { stream.eatWhile(/[\w\-]/); // Keyword if (wordLookup[stream.current()]) { - return ret(wordLookup[stream.current()], styleLookup[stream.current()], stream.current()); + return styleLookup[stream.current()]; } else if (stream.current().match(symbol)) { - return ret("variable", "variable"); + return "variable"; } else { stream.next(); - return ret("other", "variable-2"); + return "variable-2"; } } } @@ -257,10 +249,10 @@ CodeMirror.defineMode("dylan", function(_config) { } maybeEnd = (ch == "*"); } - return ret("comment", "comment"); + return "comment"; } - function tokenString(quote, type, style) { + function tokenString(quote, style) { return function(stream, state) { var next, end = false; while ((next = stream.next()) != null) { @@ -271,7 +263,7 @@ CodeMirror.defineMode("dylan", function(_config) { } if (end) state.tokenize = tokenBase; - return ret(type, style); + return style; }; } -- cgit v1.2.3