Browse files

Remove a ton of unused variables and functions

As spotted by the extended linter.
  • Loading branch information...
1 parent 262b7ae commit 9d1d38c347b89e084b2fa0ed241365c6dddab1ab @marijnh marijnh committed Nov 7, 2012
View
51 lib/codemirror.js
@@ -10,7 +10,6 @@ window.CodeMirror = (function() {
var ie = /MSIE \d/.test(navigator.userAgent);
var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
- var ie_lt10 = /MSIE [1-9]\b/.test(navigator.userAgent);
var webkit = /WebKit\//.test(navigator.userAgent);
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
var chrome = /Chrome\//.test(navigator.userAgent);
@@ -23,7 +22,6 @@ window.CodeMirror = (function() {
var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
var mac = ios || /Mac/.test(navigator.platform);
- var win = /Win/.test(navigator.platform);
// Optimize some code when these features are not used
var sawReadOnlySpans = false, sawCollapsedSpans = false;
@@ -519,7 +517,7 @@ window.CodeMirror = (function() {
// we still need widgets and markers intact to add back to the new content later
if (!intact.length && !ie) removeChildren(display.lineDiv);
var container = display.lineDiv, cur = container.firstChild;
- var nextIntact = intact.shift(), lineNo = from, lastHeight = container.offsetTop;
+ var nextIntact = intact.shift(), lineNo = from;
cm.view.doc.iter(from, to, function(line) {
if (nextIntact && nextIntact.to == lineNo) nextIntact = intact.shift();
if (lineIsHidden(line)) {
@@ -823,8 +821,7 @@ window.CodeMirror = (function() {
}
function measureChar(cm, line, ch, data) {
- var data = data || measureLine(cm, line);
- var dir = -1, len = line.text.length;
+ var data = data || measureLine(cm, line), dir = -1;
for (var pos = ch;; pos += dir) {
var r = data[pos];
if (r) break;
@@ -886,7 +883,7 @@ window.CodeMirror = (function() {
}
// Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page"
- function intoCoordSystem(cm, lineObj, pos, rect, context) {
+ function intoCoordSystem(cm, lineObj, rect, context) {
if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
var size = lineObj.widgets[i].node.offsetHeight;
rect.top += size; rect.bottom += size;
@@ -907,7 +904,7 @@ window.CodeMirror = (function() {
function charCoords(cm, pos, context, lineObj) {
if (!lineObj) lineObj = getLine(cm.view.doc, pos.line);
- return intoCoordSystem(cm, lineObj, pos, measureChar(cm, lineObj, pos.ch), context);
+ return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch), context);
}
function cursorCoords(cm, pos, context, lineObj, measurement) {
@@ -916,7 +913,7 @@ window.CodeMirror = (function() {
function get(ch, right) {
var m = measureChar(cm, lineObj, ch, measurement);
if (right) m.left = m.right; else m.right = m.left;
- return intoCoordSystem(cm, lineObj, pos, m, context);
+ return intoCoordSystem(cm, lineObj, m, context);
}
var order = getOrder(lineObj), ch = pos.ch;
if (!order) return get(ch);
@@ -968,7 +965,6 @@ window.CodeMirror = (function() {
}
function coordsCharInner(cm, lineObj, lineNo, x, y) {
- var doc = cm.view.doc;
var innerOff = y - heightAtLine(cm, lineObj);
var wrongLine = false, cWidth = cm.display.wrapper.clientWidth;
var measurement = measureLine(cm, lineObj);
@@ -1839,7 +1835,7 @@ window.CodeMirror = (function() {
if (from.ch == 0 && to.ch == 0 && hlText(lastHL) == "") {
// This is a whole-line replace. Treated specially to make
// sure line objects move the way they are supposed to.
- var added = [], prevLine = null;
+ var added = [];
for (var i = 0, e = lines.length - 1; i < e; ++i)
added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
updateLine(cm, lastLine, lastLine.text, hlSpans(lastHL));
@@ -2138,7 +2134,6 @@ window.CodeMirror = (function() {
else if (how == "add") indentation = curSpace + cm.options.indentUnit;
else if (how == "subtract") indentation = curSpace - cm.options.indentUnit;
indentation = Math.max(0, indentation);
- var diff = indentation - curSpace;
var indentString = "", pos = 0;
if (cm.options.indentWithTabs)
@@ -2249,14 +2244,8 @@ window.CodeMirror = (function() {
getMode: function() {return this.view.mode;},
- undo: operation(null, function() {
- var hist = this.view.history;
- unredoHelper(this, "undo");
- }),
- redo: operation(null, function() {
- var hist = this.view.history;
- unredoHelper(this, "redo");
- }),
+ undo: operation(null, function() {unredoHelper(this, "undo");}),
+ redo: operation(null, function() {unredoHelper(this, "redo");}),
indentLine: operation(null, function(n, dir) {
if (typeof dir != "string") {
@@ -2411,7 +2400,7 @@ window.CodeMirror = (function() {
});
}),
- addLineWidget: operation(null, function addLineWidget(handle, node, options) {
+ addLineWidget: operation(null, function(handle, node, options) {
var widget = options || {};
widget.node = node;
if (widget.noHScroll) this.display.alignWidgets = true;
@@ -2555,7 +2544,7 @@ window.CodeMirror = (function() {
moveV: operation(null, function(dir, unit) {
var view = this.view, doc = view.doc, display = this.display;
- var dist = 0, cur = selHead(view), pos = cursorCoords(this, cur, "div");
+ var cur = selHead(view), pos = cursorCoords(this, cur, "div");
var x = pos.left, y;
if (view.goalColumn != null) x = view.goalColumn;
if (unit == "page") {
@@ -2672,7 +2661,7 @@ window.CodeMirror = (function() {
option("electricChars", true);
option("autoClearEmptyLines", false);
- option("theme", "default", function(cm, val, old) {
+ option("theme", "default", function(cm) {
themeChanged(cm);
guttersChanged(cm);
}, true);
@@ -3350,7 +3339,7 @@ window.CodeMirror = (function() {
function attachMarkedSpans(line, spans) {
if (!spans) return;
for (var i = 0; i < spans.length; ++i)
- var marker = spans[i].marker.lines.push(line);
+ spans[i].marker.lines.push(line);
line.markedSpans = spans;
}
@@ -3744,11 +3733,6 @@ window.CodeMirror = (function() {
// LINE UTILITIES
- function lineDoc(line) {
- for (var d = line.parent; d && d.parent; d = d.parent) {}
- return d;
- }
-
function getLine(chunk, n) {
while (!chunk.lines) {
for (var i = 0;; ++i) {
@@ -3769,7 +3753,7 @@ window.CodeMirror = (function() {
if (line.parent == null) return null;
var cur = line.parent, no = indexOf(cur.lines, line);
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
- for (var i = 0, e = chunk.children.length; ; ++i) {
+ for (var i = 0;; ++i) {
if (chunk.children[i] == cur) break;
no += chunk.children[i].chunkSize();
}
@@ -4086,14 +4070,6 @@ window.CodeMirror = (function() {
return "draggable" in div || "dragDrop" in div;
}();
- // Feature-detect whether newlines in textareas are converted to \r\n
- var lineSep = function () {
- var te = elt("textarea");
- te.value = "foo\nbar";
- if (te.value.indexOf("\r") > -1) return "\r\n";
- return "\n";
- }();
-
// For a reason I have yet to figure out, some browsers disallow
// word wrapping between certain characters *only* if a new inline
// element is started between them. This makes it hard to reliably
@@ -4300,7 +4276,6 @@ window.CodeMirror = (function() {
// Character types for codepoints 0x600 to 0x6ff
var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";
function charType(code) {
- var type = "L";
if (code <= 0xff) return lowTypes.charAt(code);
else if (0x590 <= code && code <= 0x5f4) return "R";
else if (0x600 <= code && code <= 0x6ff) return arabicTypes.charAt(code - 0x600);
View
4 lib/util/foldcode.js
@@ -9,7 +9,7 @@ CodeMirror.tagRangeFinder = function(cm, start) {
var lineText = cm.getLine(start.line);
var found = false;
var tag = null;
- var pos = start.ch, startCh;
+ var pos = start.ch;
while (!found) {
pos = lineText.indexOf("<", pos);
if (-1 == pos) // no tag on line
@@ -139,7 +139,7 @@ CodeMirror.braceRangeFinder = function(cm, start) {
CodeMirror.indentRangeFinder = function(cm, start) {
var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
- var myIndent = CodeMirror.countColumn(firstLine, null, tabSize), last;
+ var myIndent = CodeMirror.countColumn(firstLine, null, tabSize);
for (var i = start.line + 1, end = cm.lineCount(); i < end; ++i) {
var curLine = cm.getLine(i);
if (CodeMirror.countColumn(curLine, null, tabSize) < myIndent)
View
2 lib/util/matchbrackets.js
@@ -4,7 +4,7 @@
var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
if (!match) return null;
- var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1;
+ var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
var style = cm.getTokenAt({line: cur.line, ch: pos + 1}).className;
var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
View
8 lib/util/pig-hint.js
@@ -16,7 +16,7 @@
return arr.indexOf(item) != -1;
}
- function scriptHint(editor, keywords, getToken) {
+ function scriptHint(editor, _keywords, getToken) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
// If it's not a 'word-style' token, ignore the token.
@@ -45,12 +45,6 @@
return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
};
- function toTitleCase(str) {
- return str.replace(/(?:^|\s)\w/g, function(match) {
- return match.toUpperCase();
- });
- }
-
var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
+ "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
+ "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
View
4 lib/util/search.js
@@ -81,7 +81,7 @@
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
if (typeof query != "string") {
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
- cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];}));
+ cursor.replace(text.replace(/\$(\d)/, function(_, i) {return match[i];}));
} else cursor.replace(text);
}
});
@@ -101,7 +101,7 @@
}
function doReplace(match) {
cursor.replace(typeof query == "string" ? text :
- text.replace(/\$(\d)/, function(w, i) {return match[i];}));
+ text.replace(/\$(\d)/, function(_, i) {return match[i];}));
advance();
}
advance();
View
4 lib/util/xml-hint.js
@@ -42,7 +42,7 @@
text = text.slice(0, text.length - typed.length);
- var path = getActiveElement(cm, text) + simbol;
+ var path = getActiveElement(text) + simbol;
var hints = CodeMirror.xmlHints[path];
if(typeof hints === 'undefined')
@@ -63,7 +63,7 @@
};
};
- var getActiveElement = function(codeMirror, text) {
+ var getActiveElement = function(text) {
var element = '';
View
4 mode/clike/clike.js
@@ -213,7 +213,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
blockKeywords: words("catch class do else finally for if switch try while"),
atoms: words("true false null"),
hooks: {
- "@": function(stream, state) {
+ "@": function(stream) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}
@@ -276,7 +276,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
atoms: words("true false null"),
hooks: {
- "@": function(stream, state) {
+ "@": function(stream) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}
View
8 mode/clojure/clojure.js
@@ -2,10 +2,10 @@
* Author: Hans Engel
* Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun)
*/
-CodeMirror.defineMode("clojure", function (config, mode) {
- var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", TAG = "tag",
+CodeMirror.defineMode("clojure", function () {
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword";
- var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
+ var INDENT_WORD_SKIP = 2;
function makeKeywords(str) {
var obj = {}, words = str.split(" ");
@@ -196,7 +196,7 @@ CodeMirror.defineMode("clojure", function (config, mode) {
return returnType;
},
- indent: function (state, textAfter) {
+ indent: function (state) {
if (state.indentStack == null) return state.indentation;
return state.indentStack.indent;
}
View
2 mode/coffeescript/coffeescript.js
@@ -331,7 +331,7 @@ CodeMirror.defineMode('coffeescript', function(conf) {
return style;
},
- indent: function(state, textAfter) {
+ indent: function(state) {
if (state.tokenize != tokenBase) {
return 0;
}
View
2 mode/commonlisp/commonlisp.js
@@ -91,7 +91,7 @@ CodeMirror.defineMode("commonlisp", function (config) {
return style;
},
- indent: function (state, textAfter) {
+ indent: function (state, _textAfter) {
var i = state.ctx.indentTo;
return typeof i == "number" ? i : state.ctx.start + 1;
}
View
11 mode/ecl/ecl.js
@@ -12,17 +12,6 @@ CodeMirror.defineMode("ecl", function(config) {
return "meta";
}
- function tokenAtString(stream, state) {
- var next;
- while ((next = stream.next()) != null) {
- if (next == '"' && !stream.eat('"')) {
- state.tokenize = null;
- break;
- }
- }
- return "string";
- }
-
var indentUnit = config.indentUnit;
var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode");
var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait");
View
2 mode/erlang/erlang.js
@@ -9,7 +9,7 @@
CodeMirror.defineMIME("text/x-erlang", "erlang");
-CodeMirror.defineMode("erlang", function(cmCfg, modeCfg) {
+CodeMirror.defineMode("erlang", function(cmCfg) {
function rval(state,stream,type) {
// distinguish between "." as terminator and record field operator
View
2 mode/gfm/gfm.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("gfm", function(config, parserConfig) {
+CodeMirror.defineMode("gfm", function(config) {
var codeDepth = 0;
function blankLine(state) {
state.code = false;
View
7 mode/go/go.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("go", function(config, parserConfig) {
+CodeMirror.defineMode("go", function(config) {
var indentUnit = config.indentUnit;
var keywords = {
@@ -20,11 +20,6 @@ CodeMirror.defineMode("go", function(config, parserConfig) {
"println":true, "real":true, "recover":true
};
- var blockKeywords = {
- "else":true, "for":true, "func":true, "if":true, "interface":true,
- "select":true, "struct":true, "switch":true
- };
-
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
var curPunc;
View
2 mode/groovy/groovy.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("groovy", function(config, parserConfig) {
+CodeMirror.defineMode("groovy", function(config) {
function words(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
View
2 mode/haskell/haskell.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
+CodeMirror.defineMode("haskell", function() {
function switchState(source, setState, f) {
setState(f);
View
26 mode/haxe/haxe.js
@@ -288,19 +288,19 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
}
- function maybeattribute(type, value) {
+ function maybeattribute(type) {
if (type == "attribute") return cont(maybeattribute);
if (type == "function") return cont(functiondef);
if (type == "var") return cont(vardef1);
}
- function metadef(type, value) {
+ function metadef(type) {
if(type == ":") return cont(metadef);
if(type == "variable") return cont(metadef);
if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement);
}
- function metaargs(type, value) {
- if(typ == "variable") return cont();
+ function metaargs(type) {
+ if(type == "variable") return cont();
}
function importdef (type, value) {
@@ -353,24 +353,24 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
}
return cont(pushlex(")"), pushcontext, forin, expression, poplex, statement, popcontext);
}
- function forin(type, value) {
+ function forin(_type, value) {
if (value == "in") return cont();
}
function functiondef(type, value) {
if (type == "variable") {register(value); return cont(functiondef);}
if (value == "new") return cont(functiondef);
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, typeuse, statement, popcontext);
}
- function typeuse(type, value) {
- if(type == ":") return cont(typestring);
+ function typeuse(type) {
+ if(type == ":") return cont(typestring);
}
- function typestring(type, value) {
- if(type == "type") return cont();
- if(type == "variable") return cont();
- if(type == "{") return cont(pushlex("}"), commasep(typeprop, "}"), poplex);
+ function typestring(type) {
+ if(type == "type") return cont();
+ if(type == "variable") return cont();
+ if(type == "{") return cont(pushlex("}"), commasep(typeprop, "}"), poplex);
}
- function typeprop(type, value) {
- if(type == "variable") return cont(typeuse);
+ function typeprop(type) {
+ if(type == "variable") return cont(typeuse);
}
function funarg(type, value) {
if (type == "variable") {register(value); return cont(typeuse);}
View
2 mode/javascript/javascript.js
@@ -334,7 +334,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "variable") return cont(formaybein);
return cont(forspec2);
}
- function formaybein(type, value) {
+ function formaybein(_type, value) {
if (value == "in") return cont(expression);
return cont(maybeoperator, forspec2);
}
View
2 mode/jinja2/jinja2.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("jinja2", function(config, parserConf) {
+CodeMirror.defineMode("jinja2", function() {
var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
"loop", "none", "self", "super", "if", "as", "not", "and",
"else", "import", "with", "without", "context"];
View
12 mode/markdown/markdown.js
@@ -169,17 +169,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
}
- function codeBlock(stream, state) {
- if(stream.match(codeBlockRE, true)){
- state.f = inlineNormal;
- state.block = blockNormal;
- switchInline(stream, state, state.inline);
- return code;
- }
- stream.skipToEnd();
- return code;
- }
-
// Inline
function getType(state) {
var styles = [];
@@ -284,7 +273,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
if (ch === '<' && stream.match(/^\w/, false)) {
- var md_inside = false;
if (stream.string.indexOf(">")!=-1) {
var atts = stream.string.substring(1,stream.string.indexOf(">"));
if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) {
View
4 mode/mysql/mysql.js
@@ -78,7 +78,7 @@ CodeMirror.defineMode("mysql", function(config) {
stream.eatWhile(/[\w\d_\-]/);
return "atom";
}
- var word = stream.current(), type;
+ var word = stream.current();
if (ops.test(word))
return null;
else if (keywords.test(word))
@@ -142,7 +142,7 @@ CodeMirror.defineMode("mysql", function(config) {
}
return {
- startState: function(base) {
+ startState: function() {
return {tokenize: tokenBase,
context: null,
indent: 0,
View
2 mode/ntriples/ntriples.js
@@ -87,8 +87,6 @@ CodeMirror.defineMode("ntriples", function() {
currState.location=ret;
}
- var untilSpace = function(c) { return c != ' '; };
- var untilEndURI = function(c) { return c != '>'; };
return {
startState: function() {
return {
View
3 mode/ocaml/ocaml.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode('ocaml', function(config) {
+CodeMirror.defineMode('ocaml', function() {
var words = {
'true': 'atom',
@@ -37,7 +37,6 @@ CodeMirror.defineMode('ocaml', function(config) {
};
function tokenBase(stream, state) {
- var sol = stream.sol();
var ch = stream.next();
if (ch === '"') {
View
4 mode/pascal/pascal.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("pascal", function(config) {
+CodeMirror.defineMode("pascal", function() {
function words(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
@@ -76,7 +76,7 @@ CodeMirror.defineMode("pascal", function(config) {
// Interface
return {
- startState: function(basecolumn) {
+ startState: function() {
return {tokenize: null};
},
View
2 mode/perl/perl.js
@@ -1,6 +1,6 @@
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
-CodeMirror.defineMode("perl",function(config,parserConfig){
+CodeMirror.defineMode("perl",function(){
// http://perldoc.perl.org
var PERL={ // null - magic touch
// 1 - keyword
View
6 mode/php/php.js
@@ -23,7 +23,7 @@
atoms: keywords("true false null TRUE FALSE NULL"),
multiLineStrings: true,
hooks: {
- "$": function(stream, state) {
+ "$": function(stream) {
stream.eatWhile(/[\w\$_]/);
return "variable-2";
},
@@ -35,11 +35,11 @@
}
return false;
},
- "#": function(stream, state) {
+ "#": function(stream) {
while (!stream.eol() && !stream.match("?>", false)) stream.next();
return "comment";
},
- "/": function(stream, state) {
+ "/": function(stream) {
if (stream.eat("/")) {
while (!stream.eol() && !stream.match("?>", false)) stream.next();
return "comment";
View
7 mode/pig/pig.js
@@ -4,9 +4,8 @@
* @link https://github.com/prasanthj/pig-codemirror-2
* This implementation is adapted from PL/SQL mode in CodeMirror 2.
*/
-CodeMirror.defineMode("pig", function(config, parserConfig) {
- var indentUnit = config.indentUnit,
- keywords = parserConfig.keywords,
+CodeMirror.defineMode("pig", function(_config, parserConfig) {
+ var keywords = parserConfig.keywords,
builtins = parserConfig.builtins,
types = parserConfig.types,
multiLineStrings = parserConfig.multiLineStrings;
@@ -119,7 +118,7 @@ CodeMirror.defineMode("pig", function(config, parserConfig) {
// Interface
return {
- startState: function(basecolumn) {
+ startState: function() {
return {
tokenize: tokenBase,
startOfLine: true
View
7 mode/plsql/plsql.js
@@ -1,6 +1,5 @@
-CodeMirror.defineMode("plsql", function(config, parserConfig) {
- var indentUnit = config.indentUnit,
- keywords = parserConfig.keywords,
+CodeMirror.defineMode("plsql", function(_config, parserConfig) {
+ var keywords = parserConfig.keywords,
functions = parserConfig.functions,
types = parserConfig.types,
sqlplus = parserConfig.sqlplus,
@@ -105,7 +104,7 @@ CodeMirror.defineMode("plsql", function(config, parserConfig) {
// Interface
return {
- startState: function(basecolumn) {
+ startState: function() {
return {
tokenize: tokenBase,
startOfLine: true
View
2 mode/python/python.js
@@ -323,7 +323,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
return style;
},
- indent: function(state, textAfter) {
+ indent: function(state) {
if (state.tokenize != tokenBase) {
return 0;
}
View
2 mode/r/r.js
@@ -95,7 +95,7 @@ CodeMirror.defineMode("r", function(config) {
}
return {
- startState: function(base) {
+ startState: function() {
return {tokenize: tokenBase,
ctx: {type: "top",
indent: -config.indentUnit,
View
2 mode/rpm/changes/changes.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("changes", function(config, modeConfig) {
+CodeMirror.defineMode("changes", function() {
var headerSeperator = /^-+$/;
var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
var simpleEmail = /^[\w+.-]+@[\w.-]+/;
View
2 mode/rpm/spec/spec.js
@@ -1,6 +1,6 @@
// Quick and dirty spec file highlighting
-CodeMirror.defineMode("spec", function(config, modeConfig) {
+CodeMirror.defineMode("spec", function() {
var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/;
View
2 mode/rst/rst.js
@@ -43,8 +43,6 @@ CodeMirror.defineMode('rst', function(config, options) {
var reVerbatimMarker = /^::\s*$/;
var rePreInline = /^[-\s"([{</:]/;
var rePostInline = /^[-\s`'")\]}>/:.,;!?\\_]/;
- var reEnumeratedList = /^\s*((\d+|[A-Za-z#])[.)]|\((\d+|[A-Z-a-z#])\))\s/;
- var reBulletedList = /^\s*[-\+\*]\s/;
var reExamples = /^\s+(>>>|In \[\d+\]:)\s/;
function normal(stream, state) {
View
2 mode/ruby/ruby.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("ruby", function(config, parserConfig) {
+CodeMirror.defineMode("ruby", function(config) {
function wordObj(words) {
var o = {};
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
View
6 mode/rust/rust.js
@@ -209,7 +209,7 @@ CodeMirror.defineMode("rust", function() {
if (type == "(" || type == "[") return matchBrackets(type, expression);
return pass();
}
- function maybeprop(type) {
+ function maybeprop() {
if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);}
return pass(expression);
}
@@ -304,7 +304,7 @@ CodeMirror.defineMode("rust", function() {
if (type == "{") return cont(pushlex("}"), block, poplex);
return pass();
}
- function typarams(type) {
+ function typarams() {
if (content == ">") return cont();
if (content == ",") return cont(typarams);
if (content == ":") return cont(rtype, typarams);
@@ -324,7 +324,7 @@ CodeMirror.defineMode("rust", function() {
if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex);
return matchBrackets(type, rtype);
}
- function rtypemaybeparam(type) {
+ function rtypemaybeparam() {
if (content == "<") return cont(typarams);
return pass();
}
View
8 mode/scheme/scheme.js
@@ -1,10 +1,10 @@
/**
* Author: Koh Zi Han, based on implementation by Koh Zi Chun
*/
-CodeMirror.defineMode("scheme", function (config, mode) {
+CodeMirror.defineMode("scheme", function () {
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
- ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
- var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
+ ATOM = "atom", NUMBER = "number", BRACKET = "bracket";
+ var INDENT_WORD_SKIP = 2;
function makeKeywords(str) {
var obj = {}, words = str.split(" ");
@@ -220,7 +220,7 @@ CodeMirror.defineMode("scheme", function (config, mode) {
return (typeof state.sExprComment == "number") ? COMMENT : returnType;
},
- indent: function (state, textAfter) {
+ indent: function (state) {
if (state.indentStack == null) return state.indentation;
return state.indentStack.indent;
}
View
2 mode/shell/shell.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode('shell', function(config) {
+CodeMirror.defineMode('shell', function() {
var words = {};
function define(style, string) {
View
2 mode/sieve/sieve.js
@@ -145,7 +145,7 @@ CodeMirror.defineMode("sieve", function(config) {
return (state.tokenize || tokenBase)(stream, state);;
},
- indent: function(state, textAfter) {
+ indent: function(state, _textAfter) {
return state.baseIndent + state._indent * indentUnit;
},
View
4 mode/smalltalk/smalltalk.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode('smalltalk', function(config, modeConfig) {
+CodeMirror.defineMode('smalltalk', function(config) {
var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/;
var keywords = /true|false|nil|self|super|thisContext/;
@@ -86,7 +86,7 @@ CodeMirror.defineMode('smalltalk', function(config, modeConfig) {
return new Token('string', stream.eat('\'') ? context.parent : context, false);
};
- var nextTemporaries = function(stream, context, state) {
+ var nextTemporaries = function(stream, context) {
var token = new Token(null, context, false);
var aChar = stream.next();
View
2 mode/smarty/smarty.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode("smarty", function(config, parserConfig) {
+CodeMirror.defineMode("smarty", function(config) {
var keyFuncs = ["debug", "extends", "function", "include", "literal"];
var last;
var regs = {
View
4 mode/sparql/sparql.js
@@ -49,7 +49,7 @@ CodeMirror.defineMode("sparql", function(config) {
stream.eatWhile(/[\w\d_\-]/);
return "atom";
}
- var word = stream.current(), type;
+ var word = stream.current();
if (ops.test(word))
return null;
else if (keywords.test(word))
@@ -82,7 +82,7 @@ CodeMirror.defineMode("sparql", function(config) {
}
return {
- startState: function(base) {
+ startState: function() {
return {tokenize: tokenBase,
context: null,
indent: 0,
View
19 mode/stex/stex.js
@@ -3,7 +3,7 @@
* Licence: MIT
*/
-CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
+CodeMirror.defineMode("stex", function()
{
function pushCommand(state, command) {
state.cmdState.push(command);
@@ -42,18 +42,17 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
this.styles = styles;
this.brackets = brackets;
- this.styleIdentifier = function(content) {
+ this.styleIdentifier = function() {
if (this.bracketNo<=this.styles.length)
return this.styles[this.bracketNo-1];
else
return null;
};
- this.openBracket = function(content) {
+ this.openBracket = function() {
this.bracketNo++;
return "bracket";
};
- this.closeBracket = function(content) {
- };
+ this.closeBracket = function() {};
};
}
@@ -69,12 +68,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
this.name="DEFAULT";
this.style="tag";
- this.styleIdentifier = function(content) {
- };
- this.openBracket = function(content) {
- };
- this.closeBracket = function(content) {
- };
+ this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
};
function setState(state, f) {
@@ -149,7 +143,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
var ch = source.peek();
if (ch == '{' || ch == '[') {
var lastPlug = peekCommand(state);
- var style = lastPlug.openBracket(ch);
+ lastPlug.openBracket(ch);
source.eat(ch);
setState(state, normal);
return "bracket";
@@ -172,7 +166,6 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
token: function(stream, state) {
var t = state.f(stream, state);
- var w = stream.current();
return t;
}
};
View
43 mode/tiddlywiki/tiddlywiki.js
@@ -14,19 +14,9 @@
CoreVersion parameter is needed for TiddlyWiki only!
***/
//{{{
-CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
- var indentUnit = config.indentUnit;
-
+CodeMirror.defineMode("tiddlywiki", function () {
// Tokenizer
- var textwords = function () {
- function kw(type) {
- return {
- type: type,
- style: "text"
- };
- }
- return {};
- }();
+ var textwords = {};
var keywords = function () {
function kw(type) {
@@ -60,25 +50,13 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start
reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop
- reCodeStart = /\{\{\{/, // {{{ code span start
reUntilCodeStop = /.*?\}\}\}/;
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
}
- // used for strings
- function nextUntilUnescaped(stream, end) {
- var escaped = false,
- next;
- while ((next = stream.next()) != null) {
- if (next == end && !escaped) return false;
- escaped = !escaped && next == "\\";
- }
- return escaped;
- }
-
// Used as scratch variables to communicate multiple values without
// consing up tons of objects.
var type, content;
@@ -90,8 +68,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
}
function jsTokenBase(stream, state) {
- var sol = stream.sol(),
- ch, tch;
+ var sol = stream.sol(), ch;
state.block = false; // indicates the start of a code block.
@@ -226,13 +203,6 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
} // jsTokenBase()
- function twTokenString(quote) {
- return function (stream, state) {
- if (!nextUntilUnescaped(stream, quote)) state.tokenize = jsTokenBase;
- return ret("string", "string");
- };
- }
-
// tw invisible comment
function twTokenComment(stream, state) {
var maybeEnd = false,
@@ -314,8 +284,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
// tw strike through text looks ugly
// change CSS if needed
function twTokenStrike(stream, state) {
- var maybeEnd = false,
- ch, nr;
+ var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "-" && maybeEnd) {
@@ -329,7 +298,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
// macro
function twTokenMacro(stream, state) {
- var ch, tmp, word, known;
+ var ch, word, known;
if (stream.current() == '<<') {
return ret('brace', 'macro');
@@ -362,7 +331,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
// Interface
return {
- startState: function (basecolumn) {
+ startState: function () {
return {
tokenize: jsTokenBase,
indented: 0,
View
6 mode/tiki/tiki.js
@@ -1,4 +1,4 @@
-CodeMirror.defineMode('tiki', function(config, parserConfig) {
+CodeMirror.defineMode('tiki', function(config) {
function inBlock(style, terminator, returnTokenizer) {
return function(stream, state) {
while (!stream.eol()) {
@@ -15,7 +15,7 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) {
};
}
- function inLine(style, terminator) {
+ function inLine(style) {
return function(stream, state) {
while(!stream.eol()) {
stream.next();
@@ -37,7 +37,7 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) {
//non start of line
switch (ch) { //switch is generally much faster than if, so it is used here
case "{": //plugin
- var type = stream.eat("/") ? "closeTag" : "openTag";
+ stream.eat("/");
stream.eatSpace();
var tagName = "";
var c;
View
6 mode/vb/vb.js
@@ -37,11 +37,11 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
- function indent(stream, state) {
+ function indent(_stream, state) {
state.currentIndent++;
}
- function dedent(stream, state) {
+ function dedent(_stream, state) {
state.currentIndent--;
}
// tokenizers
@@ -218,7 +218,7 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
var external = {
electricChars:"dDpPtTfFeE ",
- startState: function(basecolumn) {
+ startState: function() {
return {
tokenize: tokenBase,
lastToken: null,
View
6 mode/velocity/velocity.js
@@ -1,18 +1,16 @@
-CodeMirror.defineMode("velocity", function(config) {
+CodeMirror.defineMode("velocity", function() {
function parseWords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
- var indentUnit = config.indentUnit;
var keywords = parseWords("#end #else #break #stop #[[ #]] " +
"#{end} #{else} #{break} #{stop}");
var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " +
"#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}");
var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent $velocityCount");
var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
- var multiLineStrings =true;
function chain(stream, state, f) {
state.tokenize = f;
@@ -128,7 +126,7 @@ CodeMirror.defineMode("velocity", function(config) {
// Interface
return {
- startState: function(basecolumn) {
+ startState: function() {
return {
tokenize: tokenBase,
beforeParams: false,
View
14 mode/verilog/verilog.js
@@ -167,23 +167,11 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
"endgenerate endmodule endprimitive endspecify endtable endtask for forever function generate if ifnone " +
"macromodule module primitive repeat specify table task while";
- function metaHook(stream, state) {
+ function metaHook(stream) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}
- // C#-style strings where "" escapes a quote.
- function tokenAtString(stream, state) {
- var next;
- while ((next = stream.next()) != null) {
- if (next == '"' && !stream.eat('"')) {
- state.tokenize = null;
- break;
- }
- }
- return "string";
- }
-
CodeMirror.defineMIME("text/x-verilog", {
name: "verilog",
keywords: words(verilogKeywords),
View
7 mode/xquery/xquery.js
@@ -20,7 +20,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-CodeMirror.defineMode("xquery", function(config, parserConfig) {
+CodeMirror.defineMode("xquery", function() {
// The keywords object is set to the result of this self executing
// function. Each keyword is a property of the keywords object whose
@@ -401,7 +401,6 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) {
// functions to test the current context of the state
function isInXmlBlock(state) { return isIn(state, "tag"); }
function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); }
- function isInCodeBlock(state) { return isIn(state, "codeblock"); }
function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); }
function isInString(state) { return isIn(state, "string"); }
@@ -424,14 +423,14 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) {
}
function popStateStack(state) {
- var popped = state.stack.pop();
+ state.stack.pop();
var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize;
state.tokenize = reinstateTokenize || tokenBase;
}
// the interface for the mode API
return {
- startState: function(basecolumn) {
+ startState: function() {
return {
tokenize: tokenBase,
cc: [],

0 comments on commit 9d1d38c

Please sign in to comment.