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/scheme
File: scheme.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
* Author: Koh Zi Han, based on implementation by Koh Zi Chun
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
(function(mod) {
[7] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[8] Fix | Delete
mod(require("../../lib/codemirror"));
[9] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[10] Fix | Delete
define(["../../lib/codemirror"], mod);
[11] Fix | Delete
else // Plain browser env
[12] Fix | Delete
mod(CodeMirror);
[13] Fix | Delete
})(function(CodeMirror) {
[14] Fix | Delete
"use strict";
[15] Fix | Delete
[16] Fix | Delete
CodeMirror.defineMode("scheme", function () {
[17] Fix | Delete
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
[18] Fix | Delete
ATOM = "atom", NUMBER = "number", BRACKET = "bracket";
[19] Fix | Delete
var INDENT_WORD_SKIP = 2;
[20] Fix | Delete
[21] Fix | Delete
function makeKeywords(str) {
[22] Fix | Delete
var obj = {}, words = str.split(" ");
[23] Fix | Delete
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
[24] Fix | Delete
return obj;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
[28] Fix | Delete
var indentKeys = makeKeywords("define let letrec let* lambda");
[29] Fix | Delete
[30] Fix | Delete
function stateStack(indent, type, prev) { // represents a state stack object
[31] Fix | Delete
this.indent = indent;
[32] Fix | Delete
this.type = type;
[33] Fix | Delete
this.prev = prev;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
function pushStack(state, indent, type) {
[37] Fix | Delete
state.indentStack = new stateStack(indent, type, state.indentStack);
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
function popStack(state) {
[41] Fix | Delete
state.indentStack = state.indentStack.prev;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i);
[45] Fix | Delete
var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i);
[46] Fix | Delete
var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i);
[47] Fix | Delete
var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i);
[48] Fix | Delete
[49] Fix | Delete
function isBinaryNumber (stream) {
[50] Fix | Delete
return stream.match(binaryMatcher);
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
function isOctalNumber (stream) {
[54] Fix | Delete
return stream.match(octalMatcher);
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
function isDecimalNumber (stream, backup) {
[58] Fix | Delete
if (backup === true) {
[59] Fix | Delete
stream.backUp(1);
[60] Fix | Delete
}
[61] Fix | Delete
return stream.match(decimalMatcher);
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
function isHexNumber (stream) {
[65] Fix | Delete
return stream.match(hexMatcher);
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
return {
[69] Fix | Delete
startState: function () {
[70] Fix | Delete
return {
[71] Fix | Delete
indentStack: null,
[72] Fix | Delete
indentation: 0,
[73] Fix | Delete
mode: false,
[74] Fix | Delete
sExprComment: false
[75] Fix | Delete
};
[76] Fix | Delete
},
[77] Fix | Delete
[78] Fix | Delete
token: function (stream, state) {
[79] Fix | Delete
if (state.indentStack == null && stream.sol()) {
[80] Fix | Delete
// update indentation, but only if indentStack is empty
[81] Fix | Delete
state.indentation = stream.indentation();
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
// skip spaces
[85] Fix | Delete
if (stream.eatSpace()) {
[86] Fix | Delete
return null;
[87] Fix | Delete
}
[88] Fix | Delete
var returnType = null;
[89] Fix | Delete
[90] Fix | Delete
switch(state.mode){
[91] Fix | Delete
case "string": // multi-line string parsing mode
[92] Fix | Delete
var next, escaped = false;
[93] Fix | Delete
while ((next = stream.next()) != null) {
[94] Fix | Delete
if (next == "\"" && !escaped) {
[95] Fix | Delete
[96] Fix | Delete
state.mode = false;
[97] Fix | Delete
break;
[98] Fix | Delete
}
[99] Fix | Delete
escaped = !escaped && next == "\\";
[100] Fix | Delete
}
[101] Fix | Delete
returnType = STRING; // continue on in scheme-string mode
[102] Fix | Delete
break;
[103] Fix | Delete
case "comment": // comment parsing mode
[104] Fix | Delete
var next, maybeEnd = false;
[105] Fix | Delete
while ((next = stream.next()) != null) {
[106] Fix | Delete
if (next == "#" && maybeEnd) {
[107] Fix | Delete
[108] Fix | Delete
state.mode = false;
[109] Fix | Delete
break;
[110] Fix | Delete
}
[111] Fix | Delete
maybeEnd = (next == "|");
[112] Fix | Delete
}
[113] Fix | Delete
returnType = COMMENT;
[114] Fix | Delete
break;
[115] Fix | Delete
case "s-expr-comment": // s-expr commenting mode
[116] Fix | Delete
state.mode = false;
[117] Fix | Delete
if(stream.peek() == "(" || stream.peek() == "["){
[118] Fix | Delete
// actually start scheme s-expr commenting mode
[119] Fix | Delete
state.sExprComment = 0;
[120] Fix | Delete
}else{
[121] Fix | Delete
// if not we just comment the entire of the next token
[122] Fix | Delete
stream.eatWhile(/[^/s]/); // eat non spaces
[123] Fix | Delete
returnType = COMMENT;
[124] Fix | Delete
break;
[125] Fix | Delete
}
[126] Fix | Delete
default: // default parsing mode
[127] Fix | Delete
var ch = stream.next();
[128] Fix | Delete
[129] Fix | Delete
if (ch == "\"") {
[130] Fix | Delete
state.mode = "string";
[131] Fix | Delete
returnType = STRING;
[132] Fix | Delete
[133] Fix | Delete
} else if (ch == "'") {
[134] Fix | Delete
returnType = ATOM;
[135] Fix | Delete
} else if (ch == '#') {
[136] Fix | Delete
if (stream.eat("|")) { // Multi-line comment
[137] Fix | Delete
state.mode = "comment"; // toggle to comment mode
[138] Fix | Delete
returnType = COMMENT;
[139] Fix | Delete
} else if (stream.eat(/[tf]/i)) { // #t/#f (atom)
[140] Fix | Delete
returnType = ATOM;
[141] Fix | Delete
} else if (stream.eat(';')) { // S-Expr comment
[142] Fix | Delete
state.mode = "s-expr-comment";
[143] Fix | Delete
returnType = COMMENT;
[144] Fix | Delete
} else {
[145] Fix | Delete
var numTest = null, hasExactness = false, hasRadix = true;
[146] Fix | Delete
if (stream.eat(/[ei]/i)) {
[147] Fix | Delete
hasExactness = true;
[148] Fix | Delete
} else {
[149] Fix | Delete
stream.backUp(1); // must be radix specifier
[150] Fix | Delete
}
[151] Fix | Delete
if (stream.match(/^#b/i)) {
[152] Fix | Delete
numTest = isBinaryNumber;
[153] Fix | Delete
} else if (stream.match(/^#o/i)) {
[154] Fix | Delete
numTest = isOctalNumber;
[155] Fix | Delete
} else if (stream.match(/^#x/i)) {
[156] Fix | Delete
numTest = isHexNumber;
[157] Fix | Delete
} else if (stream.match(/^#d/i)) {
[158] Fix | Delete
numTest = isDecimalNumber;
[159] Fix | Delete
} else if (stream.match(/^[-+0-9.]/, false)) {
[160] Fix | Delete
hasRadix = false;
[161] Fix | Delete
numTest = isDecimalNumber;
[162] Fix | Delete
// re-consume the intial # if all matches failed
[163] Fix | Delete
} else if (!hasExactness) {
[164] Fix | Delete
stream.eat('#');
[165] Fix | Delete
}
[166] Fix | Delete
if (numTest != null) {
[167] Fix | Delete
if (hasRadix && !hasExactness) {
[168] Fix | Delete
// consume optional exactness after radix
[169] Fix | Delete
stream.match(/^#[ei]/i);
[170] Fix | Delete
}
[171] Fix | Delete
if (numTest(stream))
[172] Fix | Delete
returnType = NUMBER;
[173] Fix | Delete
}
[174] Fix | Delete
}
[175] Fix | Delete
} else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal
[176] Fix | Delete
returnType = NUMBER;
[177] Fix | Delete
} else if (ch == ";") { // comment
[178] Fix | Delete
stream.skipToEnd(); // rest of the line is a comment
[179] Fix | Delete
returnType = COMMENT;
[180] Fix | Delete
} else if (ch == "(" || ch == "[") {
[181] Fix | Delete
var keyWord = ''; var indentTemp = stream.column(), letter;
[182] Fix | Delete
/**
[183] Fix | Delete
Either
[184] Fix | Delete
(indent-word ..
[185] Fix | Delete
(non-indent-word ..
[186] Fix | Delete
(;something else, bracket, etc.
[187] Fix | Delete
*/
[188] Fix | Delete
[189] Fix | Delete
while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
[190] Fix | Delete
keyWord += letter;
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
[194] Fix | Delete
[195] Fix | Delete
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
[196] Fix | Delete
} else { // non-indent word
[197] Fix | Delete
// we continue eating the spaces
[198] Fix | Delete
stream.eatSpace();
[199] Fix | Delete
if (stream.eol() || stream.peek() == ";") {
[200] Fix | Delete
// nothing significant after
[201] Fix | Delete
// we restart indentation 1 space after
[202] Fix | Delete
pushStack(state, indentTemp + 1, ch);
[203] Fix | Delete
} else {
[204] Fix | Delete
pushStack(state, indentTemp + stream.current().length, ch); // else we match
[205] Fix | Delete
}
[206] Fix | Delete
}
[207] Fix | Delete
stream.backUp(stream.current().length - 1); // undo all the eating
[208] Fix | Delete
[209] Fix | Delete
if(typeof state.sExprComment == "number") state.sExprComment++;
[210] Fix | Delete
[211] Fix | Delete
returnType = BRACKET;
[212] Fix | Delete
} else if (ch == ")" || ch == "]") {
[213] Fix | Delete
returnType = BRACKET;
[214] Fix | Delete
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
[215] Fix | Delete
popStack(state);
[216] Fix | Delete
[217] Fix | Delete
if(typeof state.sExprComment == "number"){
[218] Fix | Delete
if(--state.sExprComment == 0){
[219] Fix | Delete
returnType = COMMENT; // final closing bracket
[220] Fix | Delete
state.sExprComment = false; // turn off s-expr commenting mode
[221] Fix | Delete
}
[222] Fix | Delete
}
[223] Fix | Delete
}
[224] Fix | Delete
} else {
[225] Fix | Delete
stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/);
[226] Fix | Delete
[227] Fix | Delete
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
[228] Fix | Delete
returnType = BUILTIN;
[229] Fix | Delete
} else returnType = "variable";
[230] Fix | Delete
}
[231] Fix | Delete
}
[232] Fix | Delete
return (typeof state.sExprComment == "number") ? COMMENT : returnType;
[233] Fix | Delete
},
[234] Fix | Delete
[235] Fix | Delete
indent: function (state) {
[236] Fix | Delete
if (state.indentStack == null) return state.indentation;
[237] Fix | Delete
return state.indentStack.indent;
[238] Fix | Delete
},
[239] Fix | Delete
[240] Fix | Delete
closeBrackets: {pairs: "()[]{}\"\""},
[241] Fix | Delete
lineComment: ";;"
[242] Fix | Delete
};
[243] Fix | Delete
});
[244] Fix | Delete
[245] Fix | Delete
CodeMirror.defineMIME("text/x-scheme", "scheme");
[246] Fix | Delete
[247] Fix | Delete
});
[248] Fix | Delete
[249] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function