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/vb
File: vb.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("vb", function(conf, parserConf) {
[13] Fix | Delete
var ERRORCLASS = 'error';
[14] Fix | Delete
[15] Fix | Delete
function wordRegexp(words) {
[16] Fix | Delete
return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]");
[20] Fix | Delete
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
[21] Fix | Delete
var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
[22] Fix | Delete
var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
[23] Fix | Delete
var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
[24] Fix | Delete
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
[25] Fix | Delete
[26] Fix | Delete
var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try'];
[27] Fix | Delete
var middleKeywords = ['else','elseif','case', 'catch'];
[28] Fix | Delete
var endKeywords = ['next','loop'];
[29] Fix | Delete
[30] Fix | Delete
var operatorKeywords = ['and', 'or', 'not', 'xor', 'in'];
[31] Fix | Delete
var wordOperators = wordRegexp(operatorKeywords);
[32] Fix | Delete
var commonKeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until',
[33] Fix | Delete
'goto', 'byval','byref','new','handles','property', 'return',
[34] Fix | Delete
'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false'];
[35] Fix | Delete
var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single'];
[36] Fix | Delete
[37] Fix | Delete
var keywords = wordRegexp(commonKeywords);
[38] Fix | Delete
var types = wordRegexp(commontypes);
[39] Fix | Delete
var stringPrefixes = '"';
[40] Fix | Delete
[41] Fix | Delete
var opening = wordRegexp(openingKeywords);
[42] Fix | Delete
var middle = wordRegexp(middleKeywords);
[43] Fix | Delete
var closing = wordRegexp(endKeywords);
[44] Fix | Delete
var doubleClosing = wordRegexp(['end']);
[45] Fix | Delete
var doOpening = wordRegexp(['do']);
[46] Fix | Delete
[47] Fix | Delete
var indentInfo = null;
[48] Fix | Delete
[49] Fix | Delete
CodeMirror.registerHelper("hintWords", "vb", openingKeywords.concat(middleKeywords).concat(endKeywords)
[50] Fix | Delete
.concat(operatorKeywords).concat(commonKeywords).concat(commontypes));
[51] Fix | Delete
[52] Fix | Delete
function indent(_stream, state) {
[53] Fix | Delete
state.currentIndent++;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
function dedent(_stream, state) {
[57] Fix | Delete
state.currentIndent--;
[58] Fix | Delete
}
[59] Fix | Delete
// tokenizers
[60] Fix | Delete
function tokenBase(stream, state) {
[61] Fix | Delete
if (stream.eatSpace()) {
[62] Fix | Delete
return null;
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
var ch = stream.peek();
[66] Fix | Delete
[67] Fix | Delete
// Handle Comments
[68] Fix | Delete
if (ch === "'") {
[69] Fix | Delete
stream.skipToEnd();
[70] Fix | Delete
return 'comment';
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
[74] Fix | Delete
// Handle Number Literals
[75] Fix | Delete
if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) {
[76] Fix | Delete
var floatLiteral = false;
[77] Fix | Delete
// Floats
[78] Fix | Delete
if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; }
[79] Fix | Delete
else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; }
[80] Fix | Delete
else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; }
[81] Fix | Delete
[82] Fix | Delete
if (floatLiteral) {
[83] Fix | Delete
// Float literals may be "imaginary"
[84] Fix | Delete
stream.eat(/J/i);
[85] Fix | Delete
return 'number';
[86] Fix | Delete
}
[87] Fix | Delete
// Integers
[88] Fix | Delete
var intLiteral = false;
[89] Fix | Delete
// Hex
[90] Fix | Delete
if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
[91] Fix | Delete
// Octal
[92] Fix | Delete
else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
[93] Fix | Delete
// Decimal
[94] Fix | Delete
else if (stream.match(/^[1-9]\d*F?/)) {
[95] Fix | Delete
// Decimal literals may be "imaginary"
[96] Fix | Delete
stream.eat(/J/i);
[97] Fix | Delete
// TODO - Can you have imaginary longs?
[98] Fix | Delete
intLiteral = true;
[99] Fix | Delete
}
[100] Fix | Delete
// Zero by itself with no other piece of number.
[101] Fix | Delete
else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
[102] Fix | Delete
if (intLiteral) {
[103] Fix | Delete
// Integer literals may be "long"
[104] Fix | Delete
stream.eat(/L/i);
[105] Fix | Delete
return 'number';
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
// Handle Strings
[110] Fix | Delete
if (stream.match(stringPrefixes)) {
[111] Fix | Delete
state.tokenize = tokenStringFactory(stream.current());
[112] Fix | Delete
return state.tokenize(stream, state);
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
// Handle operators and Delimiters
[116] Fix | Delete
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
[117] Fix | Delete
return null;
[118] Fix | Delete
}
[119] Fix | Delete
if (stream.match(doubleOperators)
[120] Fix | Delete
|| stream.match(singleOperators)
[121] Fix | Delete
|| stream.match(wordOperators)) {
[122] Fix | Delete
return 'operator';
[123] Fix | Delete
}
[124] Fix | Delete
if (stream.match(singleDelimiters)) {
[125] Fix | Delete
return null;
[126] Fix | Delete
}
[127] Fix | Delete
if (stream.match(doOpening)) {
[128] Fix | Delete
indent(stream,state);
[129] Fix | Delete
state.doInCurrentLine = true;
[130] Fix | Delete
return 'keyword';
[131] Fix | Delete
}
[132] Fix | Delete
if (stream.match(opening)) {
[133] Fix | Delete
if (! state.doInCurrentLine)
[134] Fix | Delete
indent(stream,state);
[135] Fix | Delete
else
[136] Fix | Delete
state.doInCurrentLine = false;
[137] Fix | Delete
return 'keyword';
[138] Fix | Delete
}
[139] Fix | Delete
if (stream.match(middle)) {
[140] Fix | Delete
return 'keyword';
[141] Fix | Delete
}
[142] Fix | Delete
[143] Fix | Delete
if (stream.match(doubleClosing)) {
[144] Fix | Delete
dedent(stream,state);
[145] Fix | Delete
dedent(stream,state);
[146] Fix | Delete
return 'keyword';
[147] Fix | Delete
}
[148] Fix | Delete
if (stream.match(closing)) {
[149] Fix | Delete
dedent(stream,state);
[150] Fix | Delete
return 'keyword';
[151] Fix | Delete
}
[152] Fix | Delete
[153] Fix | Delete
if (stream.match(types)) {
[154] Fix | Delete
return 'keyword';
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
if (stream.match(keywords)) {
[158] Fix | Delete
return 'keyword';
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
if (stream.match(identifiers)) {
[162] Fix | Delete
return 'variable';
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
// Handle non-detected items
[166] Fix | Delete
stream.next();
[167] Fix | Delete
return ERRORCLASS;
[168] Fix | Delete
}
[169] Fix | Delete
[170] Fix | Delete
function tokenStringFactory(delimiter) {
[171] Fix | Delete
var singleline = delimiter.length == 1;
[172] Fix | Delete
var OUTCLASS = 'string';
[173] Fix | Delete
[174] Fix | Delete
return function(stream, state) {
[175] Fix | Delete
while (!stream.eol()) {
[176] Fix | Delete
stream.eatWhile(/[^'"]/);
[177] Fix | Delete
if (stream.match(delimiter)) {
[178] Fix | Delete
state.tokenize = tokenBase;
[179] Fix | Delete
return OUTCLASS;
[180] Fix | Delete
} else {
[181] Fix | Delete
stream.eat(/['"]/);
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
if (singleline) {
[185] Fix | Delete
if (parserConf.singleLineStringErrors) {
[186] Fix | Delete
return ERRORCLASS;
[187] Fix | Delete
} else {
[188] Fix | Delete
state.tokenize = tokenBase;
[189] Fix | Delete
}
[190] Fix | Delete
}
[191] Fix | Delete
return OUTCLASS;
[192] Fix | Delete
};
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
[196] Fix | Delete
function tokenLexer(stream, state) {
[197] Fix | Delete
var style = state.tokenize(stream, state);
[198] Fix | Delete
var current = stream.current();
[199] Fix | Delete
[200] Fix | Delete
// Handle '.' connected identifiers
[201] Fix | Delete
if (current === '.') {
[202] Fix | Delete
style = state.tokenize(stream, state);
[203] Fix | Delete
current = stream.current();
[204] Fix | Delete
if (style === 'variable') {
[205] Fix | Delete
return 'variable';
[206] Fix | Delete
} else {
[207] Fix | Delete
return ERRORCLASS;
[208] Fix | Delete
}
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
[212] Fix | Delete
var delimiter_index = '[({'.indexOf(current);
[213] Fix | Delete
if (delimiter_index !== -1) {
[214] Fix | Delete
indent(stream, state );
[215] Fix | Delete
}
[216] Fix | Delete
if (indentInfo === 'dedent') {
[217] Fix | Delete
if (dedent(stream, state)) {
[218] Fix | Delete
return ERRORCLASS;
[219] Fix | Delete
}
[220] Fix | Delete
}
[221] Fix | Delete
delimiter_index = '])}'.indexOf(current);
[222] Fix | Delete
if (delimiter_index !== -1) {
[223] Fix | Delete
if (dedent(stream, state)) {
[224] Fix | Delete
return ERRORCLASS;
[225] Fix | Delete
}
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
return style;
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
var external = {
[232] Fix | Delete
electricChars:"dDpPtTfFeE ",
[233] Fix | Delete
startState: function() {
[234] Fix | Delete
return {
[235] Fix | Delete
tokenize: tokenBase,
[236] Fix | Delete
lastToken: null,
[237] Fix | Delete
currentIndent: 0,
[238] Fix | Delete
nextLineIndent: 0,
[239] Fix | Delete
doInCurrentLine: false
[240] Fix | Delete
[241] Fix | Delete
[242] Fix | Delete
};
[243] Fix | Delete
},
[244] Fix | Delete
[245] Fix | Delete
token: function(stream, state) {
[246] Fix | Delete
if (stream.sol()) {
[247] Fix | Delete
state.currentIndent += state.nextLineIndent;
[248] Fix | Delete
state.nextLineIndent = 0;
[249] Fix | Delete
state.doInCurrentLine = 0;
[250] Fix | Delete
}
[251] Fix | Delete
var style = tokenLexer(stream, state);
[252] Fix | Delete
[253] Fix | Delete
state.lastToken = {style:style, content: stream.current()};
[254] Fix | Delete
[255] Fix | Delete
[256] Fix | Delete
[257] Fix | Delete
return style;
[258] Fix | Delete
},
[259] Fix | Delete
[260] Fix | Delete
indent: function(state, textAfter) {
[261] Fix | Delete
var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
[262] Fix | Delete
if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
[263] Fix | Delete
if(state.currentIndent < 0) return 0;
[264] Fix | Delete
return state.currentIndent * conf.indentUnit;
[265] Fix | Delete
},
[266] Fix | Delete
[267] Fix | Delete
lineComment: "'"
[268] Fix | Delete
};
[269] Fix | Delete
return external;
[270] Fix | Delete
});
[271] Fix | Delete
[272] Fix | Delete
CodeMirror.defineMIME("text/x-vb", "vb");
[273] Fix | Delete
[274] Fix | Delete
});
[275] Fix | Delete
[276] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function