Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/ecl
File: ecl.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
(function(mod) {
[3] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[4] Fix | Delete
mod(require("../../lib/codemirror"));
[5] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[6] Fix | Delete
define(["../../lib/codemirror"], mod);
[7] Fix | Delete
else // Plain browser env
[8] Fix | Delete
mod(CodeMirror);
[9] Fix | Delete
})(function(CodeMirror) {
[10] Fix | Delete
"use strict";
[11] Fix | Delete
[12] Fix | Delete
CodeMirror.defineMode("ecl", function(config) {
[13] Fix | Delete
[14] Fix | Delete
function words(str) {
[15] Fix | Delete
var obj = {}, words = str.split(" ");
[16] Fix | Delete
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
[17] Fix | Delete
return obj;
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
function metaHook(stream, state) {
[21] Fix | Delete
if (!state.startOfLine) return false;
[22] Fix | Delete
stream.skipToEnd();
[23] Fix | Delete
return "meta";
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
var indentUnit = config.indentUnit;
[27] Fix | Delete
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");
[28] Fix | Delete
var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait");
[29] Fix | Delete
var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath");
[30] Fix | Delete
var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode");
[31] Fix | Delete
var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when");
[32] Fix | Delete
var blockKeywords = words("catch class do else finally for if switch try while");
[33] Fix | Delete
var atoms = words("true false null");
[34] Fix | Delete
var hooks = {"#": metaHook};
[35] Fix | Delete
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
[36] Fix | Delete
[37] Fix | Delete
var curPunc;
[38] Fix | Delete
[39] Fix | Delete
function tokenBase(stream, state) {
[40] Fix | Delete
var ch = stream.next();
[41] Fix | Delete
if (hooks[ch]) {
[42] Fix | Delete
var result = hooks[ch](stream, state);
[43] Fix | Delete
if (result !== false) return result;
[44] Fix | Delete
}
[45] Fix | Delete
if (ch == '"' || ch == "'") {
[46] Fix | Delete
state.tokenize = tokenString(ch);
[47] Fix | Delete
return state.tokenize(stream, state);
[48] Fix | Delete
}
[49] Fix | Delete
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
[50] Fix | Delete
curPunc = ch;
[51] Fix | Delete
return null;
[52] Fix | Delete
}
[53] Fix | Delete
if (/\d/.test(ch)) {
[54] Fix | Delete
stream.eatWhile(/[\w\.]/);
[55] Fix | Delete
return "number";
[56] Fix | Delete
}
[57] Fix | Delete
if (ch == "/") {
[58] Fix | Delete
if (stream.eat("*")) {
[59] Fix | Delete
state.tokenize = tokenComment;
[60] Fix | Delete
return tokenComment(stream, state);
[61] Fix | Delete
}
[62] Fix | Delete
if (stream.eat("/")) {
[63] Fix | Delete
stream.skipToEnd();
[64] Fix | Delete
return "comment";
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
if (isOperatorChar.test(ch)) {
[68] Fix | Delete
stream.eatWhile(isOperatorChar);
[69] Fix | Delete
return "operator";
[70] Fix | Delete
}
[71] Fix | Delete
stream.eatWhile(/[\w\$_]/);
[72] Fix | Delete
var cur = stream.current().toLowerCase();
[73] Fix | Delete
if (keyword.propertyIsEnumerable(cur)) {
[74] Fix | Delete
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
[75] Fix | Delete
return "keyword";
[76] Fix | Delete
} else if (variable.propertyIsEnumerable(cur)) {
[77] Fix | Delete
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
[78] Fix | Delete
return "variable";
[79] Fix | Delete
} else if (variable_2.propertyIsEnumerable(cur)) {
[80] Fix | Delete
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
[81] Fix | Delete
return "variable-2";
[82] Fix | Delete
} else if (variable_3.propertyIsEnumerable(cur)) {
[83] Fix | Delete
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
[84] Fix | Delete
return "variable-3";
[85] Fix | Delete
} else if (builtin.propertyIsEnumerable(cur)) {
[86] Fix | Delete
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
[87] Fix | Delete
return "builtin";
[88] Fix | Delete
} else { //Data types are of from KEYWORD##
[89] Fix | Delete
var i = cur.length - 1;
[90] Fix | Delete
while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_'))
[91] Fix | Delete
--i;
[92] Fix | Delete
[93] Fix | Delete
if (i > 0) {
[94] Fix | Delete
var cur2 = cur.substr(0, i + 1);
[95] Fix | Delete
if (variable_3.propertyIsEnumerable(cur2)) {
[96] Fix | Delete
if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement";
[97] Fix | Delete
return "variable-3";
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
}
[101] Fix | Delete
if (atoms.propertyIsEnumerable(cur)) return "atom";
[102] Fix | Delete
return null;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
function tokenString(quote) {
[106] Fix | Delete
return function(stream, state) {
[107] Fix | Delete
var escaped = false, next, end = false;
[108] Fix | Delete
while ((next = stream.next()) != null) {
[109] Fix | Delete
if (next == quote && !escaped) {end = true; break;}
[110] Fix | Delete
escaped = !escaped && next == "\\";
[111] Fix | Delete
}
[112] Fix | Delete
if (end || !escaped)
[113] Fix | Delete
state.tokenize = tokenBase;
[114] Fix | Delete
return "string";
[115] Fix | Delete
};
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
function tokenComment(stream, state) {
[119] Fix | Delete
var maybeEnd = false, ch;
[120] Fix | Delete
while (ch = stream.next()) {
[121] Fix | Delete
if (ch == "/" && maybeEnd) {
[122] Fix | Delete
state.tokenize = tokenBase;
[123] Fix | Delete
break;
[124] Fix | Delete
}
[125] Fix | Delete
maybeEnd = (ch == "*");
[126] Fix | Delete
}
[127] Fix | Delete
return "comment";
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
function Context(indented, column, type, align, prev) {
[131] Fix | Delete
this.indented = indented;
[132] Fix | Delete
this.column = column;
[133] Fix | Delete
this.type = type;
[134] Fix | Delete
this.align = align;
[135] Fix | Delete
this.prev = prev;
[136] Fix | Delete
}
[137] Fix | Delete
function pushContext(state, col, type) {
[138] Fix | Delete
return state.context = new Context(state.indented, col, type, null, state.context);
[139] Fix | Delete
}
[140] Fix | Delete
function popContext(state) {
[141] Fix | Delete
var t = state.context.type;
[142] Fix | Delete
if (t == ")" || t == "]" || t == "}")
[143] Fix | Delete
state.indented = state.context.indented;
[144] Fix | Delete
return state.context = state.context.prev;
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
// Interface
[148] Fix | Delete
[149] Fix | Delete
return {
[150] Fix | Delete
startState: function(basecolumn) {
[151] Fix | Delete
return {
[152] Fix | Delete
tokenize: null,
[153] Fix | Delete
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
[154] Fix | Delete
indented: 0,
[155] Fix | Delete
startOfLine: true
[156] Fix | Delete
};
[157] Fix | Delete
},
[158] Fix | Delete
[159] Fix | Delete
token: function(stream, state) {
[160] Fix | Delete
var ctx = state.context;
[161] Fix | Delete
if (stream.sol()) {
[162] Fix | Delete
if (ctx.align == null) ctx.align = false;
[163] Fix | Delete
state.indented = stream.indentation();
[164] Fix | Delete
state.startOfLine = true;
[165] Fix | Delete
}
[166] Fix | Delete
if (stream.eatSpace()) return null;
[167] Fix | Delete
curPunc = null;
[168] Fix | Delete
var style = (state.tokenize || tokenBase)(stream, state);
[169] Fix | Delete
if (style == "comment" || style == "meta") return style;
[170] Fix | Delete
if (ctx.align == null) ctx.align = true;
[171] Fix | Delete
[172] Fix | Delete
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
[173] Fix | Delete
else if (curPunc == "{") pushContext(state, stream.column(), "}");
[174] Fix | Delete
else if (curPunc == "[") pushContext(state, stream.column(), "]");
[175] Fix | Delete
else if (curPunc == "(") pushContext(state, stream.column(), ")");
[176] Fix | Delete
else if (curPunc == "}") {
[177] Fix | Delete
while (ctx.type == "statement") ctx = popContext(state);
[178] Fix | Delete
if (ctx.type == "}") ctx = popContext(state);
[179] Fix | Delete
while (ctx.type == "statement") ctx = popContext(state);
[180] Fix | Delete
}
[181] Fix | Delete
else if (curPunc == ctx.type) popContext(state);
[182] Fix | Delete
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
[183] Fix | Delete
pushContext(state, stream.column(), "statement");
[184] Fix | Delete
state.startOfLine = false;
[185] Fix | Delete
return style;
[186] Fix | Delete
},
[187] Fix | Delete
[188] Fix | Delete
indent: function(state, textAfter) {
[189] Fix | Delete
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
[190] Fix | Delete
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
[191] Fix | Delete
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
[192] Fix | Delete
var closing = firstChar == ctx.type;
[193] Fix | Delete
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
[194] Fix | Delete
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
[195] Fix | Delete
else return ctx.indented + (closing ? 0 : indentUnit);
[196] Fix | Delete
},
[197] Fix | Delete
[198] Fix | Delete
electricChars: "{}"
[199] Fix | Delete
};
[200] Fix | Delete
});
[201] Fix | Delete
[202] Fix | Delete
CodeMirror.defineMIME("text/x-ecl", "ecl");
[203] Fix | Delete
[204] Fix | Delete
});
[205] Fix | Delete
[206] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function