Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/cypher
File: cypher.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
[0] Fix | Delete
// Distributed under an MIT license: http://codemirror.net/LICENSE
[1] Fix | Delete
[2] Fix | Delete
// By the Neo4j Team and contributors.
[3] Fix | Delete
// https://github.com/neo4j-contrib/CodeMirror
[4] Fix | Delete
[5] Fix | Delete
(function(mod) {
[6] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[7] Fix | Delete
mod(require("../../lib/codemirror"));
[8] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[9] Fix | Delete
define(["../../lib/codemirror"], mod);
[10] Fix | Delete
else // Plain browser env
[11] Fix | Delete
mod(CodeMirror);
[12] Fix | Delete
})(function(CodeMirror) {
[13] Fix | Delete
"use strict";
[14] Fix | Delete
var wordRegexp = function(words) {
[15] Fix | Delete
return new RegExp("^(?:" + words.join("|") + ")$", "i");
[16] Fix | Delete
};
[17] Fix | Delete
[18] Fix | Delete
CodeMirror.defineMode("cypher", function(config) {
[19] Fix | Delete
var tokenBase = function(stream/*, state*/) {
[20] Fix | Delete
var ch = stream.next();
[21] Fix | Delete
if (ch === "\"" || ch === "'") {
[22] Fix | Delete
stream.match(/.+?["']/);
[23] Fix | Delete
return "string";
[24] Fix | Delete
}
[25] Fix | Delete
if (/[{}\(\),\.;\[\]]/.test(ch)) {
[26] Fix | Delete
curPunc = ch;
[27] Fix | Delete
return "node";
[28] Fix | Delete
} else if (ch === "/" && stream.eat("/")) {
[29] Fix | Delete
stream.skipToEnd();
[30] Fix | Delete
return "comment";
[31] Fix | Delete
} else if (operatorChars.test(ch)) {
[32] Fix | Delete
stream.eatWhile(operatorChars);
[33] Fix | Delete
return null;
[34] Fix | Delete
} else {
[35] Fix | Delete
stream.eatWhile(/[_\w\d]/);
[36] Fix | Delete
if (stream.eat(":")) {
[37] Fix | Delete
stream.eatWhile(/[\w\d_\-]/);
[38] Fix | Delete
return "atom";
[39] Fix | Delete
}
[40] Fix | Delete
var word = stream.current();
[41] Fix | Delete
if (funcs.test(word)) return "builtin";
[42] Fix | Delete
if (preds.test(word)) return "def";
[43] Fix | Delete
if (keywords.test(word)) return "keyword";
[44] Fix | Delete
return "variable";
[45] Fix | Delete
}
[46] Fix | Delete
};
[47] Fix | Delete
var pushContext = function(state, type, col) {
[48] Fix | Delete
return state.context = {
[49] Fix | Delete
prev: state.context,
[50] Fix | Delete
indent: state.indent,
[51] Fix | Delete
col: col,
[52] Fix | Delete
type: type
[53] Fix | Delete
};
[54] Fix | Delete
};
[55] Fix | Delete
var popContext = function(state) {
[56] Fix | Delete
state.indent = state.context.indent;
[57] Fix | Delete
return state.context = state.context.prev;
[58] Fix | Delete
};
[59] Fix | Delete
var indentUnit = config.indentUnit;
[60] Fix | Delete
var curPunc;
[61] Fix | Delete
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
[62] Fix | Delete
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
[63] Fix | Delete
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with"]);
[64] Fix | Delete
var operatorChars = /[*+\-<>=&|~%^]/;
[65] Fix | Delete
[66] Fix | Delete
return {
[67] Fix | Delete
startState: function(/*base*/) {
[68] Fix | Delete
return {
[69] Fix | Delete
tokenize: tokenBase,
[70] Fix | Delete
context: null,
[71] Fix | Delete
indent: 0,
[72] Fix | Delete
col: 0
[73] Fix | Delete
};
[74] Fix | Delete
},
[75] Fix | Delete
token: function(stream, state) {
[76] Fix | Delete
if (stream.sol()) {
[77] Fix | Delete
if (state.context && (state.context.align == null)) {
[78] Fix | Delete
state.context.align = false;
[79] Fix | Delete
}
[80] Fix | Delete
state.indent = stream.indentation();
[81] Fix | Delete
}
[82] Fix | Delete
if (stream.eatSpace()) {
[83] Fix | Delete
return null;
[84] Fix | Delete
}
[85] Fix | Delete
var style = state.tokenize(stream, state);
[86] Fix | Delete
if (style !== "comment" && state.context && (state.context.align == null) && state.context.type !== "pattern") {
[87] Fix | Delete
state.context.align = true;
[88] Fix | Delete
}
[89] Fix | Delete
if (curPunc === "(") {
[90] Fix | Delete
pushContext(state, ")", stream.column());
[91] Fix | Delete
} else if (curPunc === "[") {
[92] Fix | Delete
pushContext(state, "]", stream.column());
[93] Fix | Delete
} else if (curPunc === "{") {
[94] Fix | Delete
pushContext(state, "}", stream.column());
[95] Fix | Delete
} else if (/[\]\}\)]/.test(curPunc)) {
[96] Fix | Delete
while (state.context && state.context.type === "pattern") {
[97] Fix | Delete
popContext(state);
[98] Fix | Delete
}
[99] Fix | Delete
if (state.context && curPunc === state.context.type) {
[100] Fix | Delete
popContext(state);
[101] Fix | Delete
}
[102] Fix | Delete
} else if (curPunc === "." && state.context && state.context.type === "pattern") {
[103] Fix | Delete
popContext(state);
[104] Fix | Delete
} else if (/atom|string|variable/.test(style) && state.context) {
[105] Fix | Delete
if (/[\}\]]/.test(state.context.type)) {
[106] Fix | Delete
pushContext(state, "pattern", stream.column());
[107] Fix | Delete
} else if (state.context.type === "pattern" && !state.context.align) {
[108] Fix | Delete
state.context.align = true;
[109] Fix | Delete
state.context.col = stream.column();
[110] Fix | Delete
}
[111] Fix | Delete
}
[112] Fix | Delete
return style;
[113] Fix | Delete
},
[114] Fix | Delete
indent: function(state, textAfter) {
[115] Fix | Delete
var firstChar = textAfter && textAfter.charAt(0);
[116] Fix | Delete
var context = state.context;
[117] Fix | Delete
if (/[\]\}]/.test(firstChar)) {
[118] Fix | Delete
while (context && context.type === "pattern") {
[119] Fix | Delete
context = context.prev;
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
var closing = context && firstChar === context.type;
[123] Fix | Delete
if (!context) return 0;
[124] Fix | Delete
if (context.type === "keywords") return CodeMirror.commands.newlineAndIndent;
[125] Fix | Delete
if (context.align) return context.col + (closing ? 0 : 1);
[126] Fix | Delete
return context.indent + (closing ? 0 : indentUnit);
[127] Fix | Delete
}
[128] Fix | Delete
};
[129] Fix | Delete
});
[130] Fix | Delete
[131] Fix | Delete
CodeMirror.modeExtensions["cypher"] = {
[132] Fix | Delete
autoFormatLineBreaks: function(text) {
[133] Fix | Delete
var i, lines, reProcessedPortion;
[134] Fix | Delete
var lines = text.split("\n");
[135] Fix | Delete
var reProcessedPortion = /\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g;
[136] Fix | Delete
for (var i = 0; i < lines.length; i++)
[137] Fix | Delete
lines[i] = lines[i].replace(reProcessedPortion, " \n$1 ").trim();
[138] Fix | Delete
return lines.join("\n");
[139] Fix | Delete
}
[140] Fix | Delete
};
[141] Fix | Delete
[142] Fix | Delete
CodeMirror.defineMIME("application/x-cypher-query", "cypher");
[143] Fix | Delete
[144] Fix | Delete
});
[145] Fix | Delete
[146] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function