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/vbscript
File: vbscript.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
/*
[3] Fix | Delete
For extra ASP classic objects, initialize CodeMirror instance with this option:
[4] Fix | Delete
isASP: true
[5] Fix | Delete
[6] Fix | Delete
E.G.:
[7] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
[8] Fix | Delete
lineNumbers: true,
[9] Fix | Delete
isASP: true
[10] Fix | Delete
});
[11] Fix | Delete
*/
[12] Fix | Delete
[13] Fix | Delete
(function(mod) {
[14] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[15] Fix | Delete
mod(require("../../lib/codemirror"));
[16] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[17] Fix | Delete
define(["../../lib/codemirror"], mod);
[18] Fix | Delete
else // Plain browser env
[19] Fix | Delete
mod(CodeMirror);
[20] Fix | Delete
})(function(CodeMirror) {
[21] Fix | Delete
"use strict";
[22] Fix | Delete
[23] Fix | Delete
CodeMirror.defineMode("vbscript", function(conf, parserConf) {
[24] Fix | Delete
var ERRORCLASS = 'error';
[25] Fix | Delete
[26] Fix | Delete
function wordRegexp(words) {
[27] Fix | Delete
return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]");
[31] Fix | Delete
var doubleOperators = new RegExp("^((<>)|(<=)|(>=))");
[32] Fix | Delete
var singleDelimiters = new RegExp('^[\\.,]');
[33] Fix | Delete
var brakets = new RegExp('^[\\(\\)]');
[34] Fix | Delete
var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*");
[35] Fix | Delete
[36] Fix | Delete
var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for'];
[37] Fix | Delete
var middleKeywords = ['else','elseif','case'];
[38] Fix | Delete
var endKeywords = ['next','loop','wend'];
[39] Fix | Delete
[40] Fix | Delete
var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']);
[41] Fix | Delete
var commonkeywords = ['dim', 'redim', 'then', 'until', 'randomize',
[42] Fix | Delete
'byval','byref','new','property', 'exit', 'in',
[43] Fix | Delete
'const','private', 'public',
[44] Fix | Delete
'get','set','let', 'stop', 'on error resume next', 'on error goto 0', 'option explicit', 'call', 'me'];
[45] Fix | Delete
[46] Fix | Delete
//This list was from: http://msdn.microsoft.com/en-us/library/f8tbc79x(v=vs.84).aspx
[47] Fix | Delete
var atomWords = ['true', 'false', 'nothing', 'empty', 'null'];
[48] Fix | Delete
//This list was from: http://msdn.microsoft.com/en-us/library/3ca8tfek(v=vs.84).aspx
[49] Fix | Delete
var builtinFuncsWords = ['abs', 'array', 'asc', 'atn', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'chr', 'cint', 'clng', 'cos', 'csng', 'cstr', 'date', 'dateadd', 'datediff', 'datepart',
[50] Fix | Delete
'dateserial', 'datevalue', 'day', 'escape', 'eval', 'execute', 'exp', 'filter', 'formatcurrency', 'formatdatetime', 'formatnumber', 'formatpercent', 'getlocale', 'getobject',
[51] Fix | Delete
'getref', 'hex', 'hour', 'inputbox', 'instr', 'instrrev', 'int', 'fix', 'isarray', 'isdate', 'isempty', 'isnull', 'isnumeric', 'isobject', 'join', 'lbound', 'lcase', 'left',
[52] Fix | Delete
'len', 'loadpicture', 'log', 'ltrim', 'rtrim', 'trim', 'maths', 'mid', 'minute', 'month', 'monthname', 'msgbox', 'now', 'oct', 'replace', 'rgb', 'right', 'rnd', 'round',
[53] Fix | Delete
'scriptengine', 'scriptenginebuildversion', 'scriptenginemajorversion', 'scriptengineminorversion', 'second', 'setlocale', 'sgn', 'sin', 'space', 'split', 'sqr', 'strcomp',
[54] Fix | Delete
'string', 'strreverse', 'tan', 'time', 'timer', 'timeserial', 'timevalue', 'typename', 'ubound', 'ucase', 'unescape', 'vartype', 'weekday', 'weekdayname', 'year'];
[55] Fix | Delete
[56] Fix | Delete
//This list was from: http://msdn.microsoft.com/en-us/library/ydz4cfk3(v=vs.84).aspx
[57] Fix | Delete
var builtinConsts = ['vbBlack', 'vbRed', 'vbGreen', 'vbYellow', 'vbBlue', 'vbMagenta', 'vbCyan', 'vbWhite', 'vbBinaryCompare', 'vbTextCompare',
[58] Fix | Delete
'vbSunday', 'vbMonday', 'vbTuesday', 'vbWednesday', 'vbThursday', 'vbFriday', 'vbSaturday', 'vbUseSystemDayOfWeek', 'vbFirstJan1', 'vbFirstFourDays', 'vbFirstFullWeek',
[59] Fix | Delete
'vbGeneralDate', 'vbLongDate', 'vbShortDate', 'vbLongTime', 'vbShortTime', 'vbObjectError',
[60] Fix | Delete
'vbOKOnly', 'vbOKCancel', 'vbAbortRetryIgnore', 'vbYesNoCancel', 'vbYesNo', 'vbRetryCancel', 'vbCritical', 'vbQuestion', 'vbExclamation', 'vbInformation', 'vbDefaultButton1', 'vbDefaultButton2',
[61] Fix | Delete
'vbDefaultButton3', 'vbDefaultButton4', 'vbApplicationModal', 'vbSystemModal', 'vbOK', 'vbCancel', 'vbAbort', 'vbRetry', 'vbIgnore', 'vbYes', 'vbNo',
[62] Fix | Delete
'vbCr', 'VbCrLf', 'vbFormFeed', 'vbLf', 'vbNewLine', 'vbNullChar', 'vbNullString', 'vbTab', 'vbVerticalTab', 'vbUseDefault', 'vbTrue', 'vbFalse',
[63] Fix | Delete
'vbEmpty', 'vbNull', 'vbInteger', 'vbLong', 'vbSingle', 'vbDouble', 'vbCurrency', 'vbDate', 'vbString', 'vbObject', 'vbError', 'vbBoolean', 'vbVariant', 'vbDataObject', 'vbDecimal', 'vbByte', 'vbArray'];
[64] Fix | Delete
//This list was from: http://msdn.microsoft.com/en-us/library/hkc375ea(v=vs.84).aspx
[65] Fix | Delete
var builtinObjsWords = ['WScript', 'err', 'debug', 'RegExp'];
[66] Fix | Delete
var knownProperties = ['description', 'firstindex', 'global', 'helpcontext', 'helpfile', 'ignorecase', 'length', 'number', 'pattern', 'source', 'value', 'count'];
[67] Fix | Delete
var knownMethods = ['clear', 'execute', 'raise', 'replace', 'test', 'write', 'writeline', 'close', 'open', 'state', 'eof', 'update', 'addnew', 'end', 'createobject', 'quit'];
[68] Fix | Delete
[69] Fix | Delete
var aspBuiltinObjsWords = ['server', 'response', 'request', 'session', 'application'];
[70] Fix | Delete
var aspKnownProperties = ['buffer', 'cachecontrol', 'charset', 'contenttype', 'expires', 'expiresabsolute', 'isclientconnected', 'pics', 'status', //response
[71] Fix | Delete
'clientcertificate', 'cookies', 'form', 'querystring', 'servervariables', 'totalbytes', //request
[72] Fix | Delete
'contents', 'staticobjects', //application
[73] Fix | Delete
'codepage', 'lcid', 'sessionid', 'timeout', //session
[74] Fix | Delete
'scripttimeout']; //server
[75] Fix | Delete
var aspKnownMethods = ['addheader', 'appendtolog', 'binarywrite', 'end', 'flush', 'redirect', //response
[76] Fix | Delete
'binaryread', //request
[77] Fix | Delete
'remove', 'removeall', 'lock', 'unlock', //application
[78] Fix | Delete
'abandon', //session
[79] Fix | Delete
'getlasterror', 'htmlencode', 'mappath', 'transfer', 'urlencode']; //server
[80] Fix | Delete
[81] Fix | Delete
var knownWords = knownMethods.concat(knownProperties);
[82] Fix | Delete
[83] Fix | Delete
builtinObjsWords = builtinObjsWords.concat(builtinConsts);
[84] Fix | Delete
[85] Fix | Delete
if (conf.isASP){
[86] Fix | Delete
builtinObjsWords = builtinObjsWords.concat(aspBuiltinObjsWords);
[87] Fix | Delete
knownWords = knownWords.concat(aspKnownMethods, aspKnownProperties);
[88] Fix | Delete
};
[89] Fix | Delete
[90] Fix | Delete
var keywords = wordRegexp(commonkeywords);
[91] Fix | Delete
var atoms = wordRegexp(atomWords);
[92] Fix | Delete
var builtinFuncs = wordRegexp(builtinFuncsWords);
[93] Fix | Delete
var builtinObjs = wordRegexp(builtinObjsWords);
[94] Fix | Delete
var known = wordRegexp(knownWords);
[95] Fix | Delete
var stringPrefixes = '"';
[96] Fix | Delete
[97] Fix | Delete
var opening = wordRegexp(openingKeywords);
[98] Fix | Delete
var middle = wordRegexp(middleKeywords);
[99] Fix | Delete
var closing = wordRegexp(endKeywords);
[100] Fix | Delete
var doubleClosing = wordRegexp(['end']);
[101] Fix | Delete
var doOpening = wordRegexp(['do']);
[102] Fix | Delete
var noIndentWords = wordRegexp(['on error resume next', 'exit']);
[103] Fix | Delete
var comment = wordRegexp(['rem']);
[104] Fix | Delete
[105] Fix | Delete
[106] Fix | Delete
function indent(_stream, state) {
[107] Fix | Delete
state.currentIndent++;
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
function dedent(_stream, state) {
[111] Fix | Delete
state.currentIndent--;
[112] Fix | Delete
}
[113] Fix | Delete
// tokenizers
[114] Fix | Delete
function tokenBase(stream, state) {
[115] Fix | Delete
if (stream.eatSpace()) {
[116] Fix | Delete
return 'space';
[117] Fix | Delete
//return null;
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
var ch = stream.peek();
[121] Fix | Delete
[122] Fix | Delete
// Handle Comments
[123] Fix | Delete
if (ch === "'") {
[124] Fix | Delete
stream.skipToEnd();
[125] Fix | Delete
return 'comment';
[126] Fix | Delete
}
[127] Fix | Delete
if (stream.match(comment)){
[128] Fix | Delete
stream.skipToEnd();
[129] Fix | Delete
return 'comment';
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
[133] Fix | Delete
// Handle Number Literals
[134] Fix | Delete
if (stream.match(/^((&H)|(&O))?[0-9\.]/i, false) && !stream.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i, false)) {
[135] Fix | Delete
var floatLiteral = false;
[136] Fix | Delete
// Floats
[137] Fix | Delete
if (stream.match(/^\d*\.\d+/i)) { floatLiteral = true; }
[138] Fix | Delete
else if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
[139] Fix | Delete
else if (stream.match(/^\.\d+/)) { floatLiteral = true; }
[140] Fix | Delete
[141] Fix | Delete
if (floatLiteral) {
[142] Fix | Delete
// Float literals may be "imaginary"
[143] Fix | Delete
stream.eat(/J/i);
[144] Fix | Delete
return 'number';
[145] Fix | Delete
}
[146] Fix | Delete
// Integers
[147] Fix | Delete
var intLiteral = false;
[148] Fix | Delete
// Hex
[149] Fix | Delete
if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
[150] Fix | Delete
// Octal
[151] Fix | Delete
else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
[152] Fix | Delete
// Decimal
[153] Fix | Delete
else if (stream.match(/^[1-9]\d*F?/)) {
[154] Fix | Delete
// Decimal literals may be "imaginary"
[155] Fix | Delete
stream.eat(/J/i);
[156] Fix | Delete
// TODO - Can you have imaginary longs?
[157] Fix | Delete
intLiteral = true;
[158] Fix | Delete
}
[159] Fix | Delete
// Zero by itself with no other piece of number.
[160] Fix | Delete
else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
[161] Fix | Delete
if (intLiteral) {
[162] Fix | Delete
// Integer literals may be "long"
[163] Fix | Delete
stream.eat(/L/i);
[164] Fix | Delete
return 'number';
[165] Fix | Delete
}
[166] Fix | Delete
}
[167] Fix | Delete
[168] Fix | Delete
// Handle Strings
[169] Fix | Delete
if (stream.match(stringPrefixes)) {
[170] Fix | Delete
state.tokenize = tokenStringFactory(stream.current());
[171] Fix | Delete
return state.tokenize(stream, state);
[172] Fix | Delete
}
[173] Fix | Delete
[174] Fix | Delete
// Handle operators and Delimiters
[175] Fix | Delete
if (stream.match(doubleOperators)
[176] Fix | Delete
|| stream.match(singleOperators)
[177] Fix | Delete
|| stream.match(wordOperators)) {
[178] Fix | Delete
return 'operator';
[179] Fix | Delete
}
[180] Fix | Delete
if (stream.match(singleDelimiters)) {
[181] Fix | Delete
return null;
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
if (stream.match(brakets)) {
[185] Fix | Delete
return "bracket";
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
if (stream.match(noIndentWords)) {
[189] Fix | Delete
state.doInCurrentLine = true;
[190] Fix | Delete
[191] Fix | Delete
return 'keyword';
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
if (stream.match(doOpening)) {
[195] Fix | Delete
indent(stream,state);
[196] Fix | Delete
state.doInCurrentLine = true;
[197] Fix | Delete
[198] Fix | Delete
return 'keyword';
[199] Fix | Delete
}
[200] Fix | Delete
if (stream.match(opening)) {
[201] Fix | Delete
if (! state.doInCurrentLine)
[202] Fix | Delete
indent(stream,state);
[203] Fix | Delete
else
[204] Fix | Delete
state.doInCurrentLine = false;
[205] Fix | Delete
[206] Fix | Delete
return 'keyword';
[207] Fix | Delete
}
[208] Fix | Delete
if (stream.match(middle)) {
[209] Fix | Delete
return 'keyword';
[210] Fix | Delete
}
[211] Fix | Delete
[212] Fix | Delete
[213] Fix | Delete
if (stream.match(doubleClosing)) {
[214] Fix | Delete
dedent(stream,state);
[215] Fix | Delete
dedent(stream,state);
[216] Fix | Delete
[217] Fix | Delete
return 'keyword';
[218] Fix | Delete
}
[219] Fix | Delete
if (stream.match(closing)) {
[220] Fix | Delete
if (! state.doInCurrentLine)
[221] Fix | Delete
dedent(stream,state);
[222] Fix | Delete
else
[223] Fix | Delete
state.doInCurrentLine = false;
[224] Fix | Delete
[225] Fix | Delete
return 'keyword';
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
if (stream.match(keywords)) {
[229] Fix | Delete
return 'keyword';
[230] Fix | Delete
}
[231] Fix | Delete
[232] Fix | Delete
if (stream.match(atoms)) {
[233] Fix | Delete
return 'atom';
[234] Fix | Delete
}
[235] Fix | Delete
[236] Fix | Delete
if (stream.match(known)) {
[237] Fix | Delete
return 'variable-2';
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
if (stream.match(builtinFuncs)) {
[241] Fix | Delete
return 'builtin';
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
if (stream.match(builtinObjs)){
[245] Fix | Delete
return 'variable-2';
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
if (stream.match(identifiers)) {
[249] Fix | Delete
return 'variable';
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
// Handle non-detected items
[253] Fix | Delete
stream.next();
[254] Fix | Delete
return ERRORCLASS;
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
function tokenStringFactory(delimiter) {
[258] Fix | Delete
var singleline = delimiter.length == 1;
[259] Fix | Delete
var OUTCLASS = 'string';
[260] Fix | Delete
[261] Fix | Delete
return function(stream, state) {
[262] Fix | Delete
while (!stream.eol()) {
[263] Fix | Delete
stream.eatWhile(/[^'"]/);
[264] Fix | Delete
if (stream.match(delimiter)) {
[265] Fix | Delete
state.tokenize = tokenBase;
[266] Fix | Delete
return OUTCLASS;
[267] Fix | Delete
} else {
[268] Fix | Delete
stream.eat(/['"]/);
[269] Fix | Delete
}
[270] Fix | Delete
}
[271] Fix | Delete
if (singleline) {
[272] Fix | Delete
if (parserConf.singleLineStringErrors) {
[273] Fix | Delete
return ERRORCLASS;
[274] Fix | Delete
} else {
[275] Fix | Delete
state.tokenize = tokenBase;
[276] Fix | Delete
}
[277] Fix | Delete
}
[278] Fix | Delete
return OUTCLASS;
[279] Fix | Delete
};
[280] Fix | Delete
}
[281] Fix | Delete
[282] Fix | Delete
[283] Fix | Delete
function tokenLexer(stream, state) {
[284] Fix | Delete
var style = state.tokenize(stream, state);
[285] Fix | Delete
var current = stream.current();
[286] Fix | Delete
[287] Fix | Delete
// Handle '.' connected identifiers
[288] Fix | Delete
if (current === '.') {
[289] Fix | Delete
style = state.tokenize(stream, state);
[290] Fix | Delete
[291] Fix | Delete
current = stream.current();
[292] Fix | Delete
if (style && (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword')){//|| knownWords.indexOf(current.substring(1)) > -1) {
[293] Fix | Delete
if (style === 'builtin' || style === 'keyword') style='variable';
[294] Fix | Delete
if (knownWords.indexOf(current.substr(1)) > -1) style='variable-2';
[295] Fix | Delete
[296] Fix | Delete
return style;
[297] Fix | Delete
} else {
[298] Fix | Delete
return ERRORCLASS;
[299] Fix | Delete
}
[300] Fix | Delete
}
[301] Fix | Delete
[302] Fix | Delete
return style;
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
var external = {
[306] Fix | Delete
electricChars:"dDpPtTfFeE ",
[307] Fix | Delete
startState: function() {
[308] Fix | Delete
return {
[309] Fix | Delete
tokenize: tokenBase,
[310] Fix | Delete
lastToken: null,
[311] Fix | Delete
currentIndent: 0,
[312] Fix | Delete
nextLineIndent: 0,
[313] Fix | Delete
doInCurrentLine: false,
[314] Fix | Delete
ignoreKeyword: false
[315] Fix | Delete
[316] Fix | Delete
[317] Fix | Delete
};
[318] Fix | Delete
},
[319] Fix | Delete
[320] Fix | Delete
token: function(stream, state) {
[321] Fix | Delete
if (stream.sol()) {
[322] Fix | Delete
state.currentIndent += state.nextLineIndent;
[323] Fix | Delete
state.nextLineIndent = 0;
[324] Fix | Delete
state.doInCurrentLine = 0;
[325] Fix | Delete
}
[326] Fix | Delete
var style = tokenLexer(stream, state);
[327] Fix | Delete
[328] Fix | Delete
state.lastToken = {style:style, content: stream.current()};
[329] Fix | Delete
[330] Fix | Delete
if (style==='space') style=null;
[331] Fix | Delete
[332] Fix | Delete
return style;
[333] Fix | Delete
},
[334] Fix | Delete
[335] Fix | Delete
indent: function(state, textAfter) {
[336] Fix | Delete
var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
[337] Fix | Delete
if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
[338] Fix | Delete
if(state.currentIndent < 0) return 0;
[339] Fix | Delete
return state.currentIndent * conf.indentUnit;
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
};
[343] Fix | Delete
return external;
[344] Fix | Delete
});
[345] Fix | Delete
[346] Fix | Delete
CodeMirror.defineMIME("text/vbscript", "vbscript");
[347] Fix | Delete
[348] Fix | Delete
});
[349] Fix | Delete
[350] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function