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/sass
File: sass.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("sass", function(config) {
[13] Fix | Delete
function tokenRegexp(words) {
[14] Fix | Delete
return new RegExp("^" + words.join("|"));
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
var keywords = ["true", "false", "null", "auto"];
[18] Fix | Delete
var keywordsRegexp = new RegExp("^" + keywords.join("|"));
[19] Fix | Delete
[20] Fix | Delete
var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-",
[21] Fix | Delete
"\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"];
[22] Fix | Delete
var opRegexp = tokenRegexp(operators);
[23] Fix | Delete
[24] Fix | Delete
var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/;
[25] Fix | Delete
[26] Fix | Delete
function urlTokens(stream, state) {
[27] Fix | Delete
var ch = stream.peek();
[28] Fix | Delete
[29] Fix | Delete
if (ch === ")") {
[30] Fix | Delete
stream.next();
[31] Fix | Delete
state.tokenizer = tokenBase;
[32] Fix | Delete
return "operator";
[33] Fix | Delete
} else if (ch === "(") {
[34] Fix | Delete
stream.next();
[35] Fix | Delete
stream.eatSpace();
[36] Fix | Delete
[37] Fix | Delete
return "operator";
[38] Fix | Delete
} else if (ch === "'" || ch === '"') {
[39] Fix | Delete
state.tokenizer = buildStringTokenizer(stream.next());
[40] Fix | Delete
return "string";
[41] Fix | Delete
} else {
[42] Fix | Delete
state.tokenizer = buildStringTokenizer(")", false);
[43] Fix | Delete
return "string";
[44] Fix | Delete
}
[45] Fix | Delete
}
[46] Fix | Delete
function comment(indentation, multiLine) {
[47] Fix | Delete
return function(stream, state) {
[48] Fix | Delete
if (stream.sol() && stream.indentation() <= indentation) {
[49] Fix | Delete
state.tokenizer = tokenBase;
[50] Fix | Delete
return tokenBase(stream, state);
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
if (multiLine && stream.skipTo("*/")) {
[54] Fix | Delete
stream.next();
[55] Fix | Delete
stream.next();
[56] Fix | Delete
state.tokenizer = tokenBase;
[57] Fix | Delete
} else {
[58] Fix | Delete
stream.skipToEnd();
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
return "comment";
[62] Fix | Delete
};
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
function buildStringTokenizer(quote, greedy) {
[66] Fix | Delete
if (greedy == null) { greedy = true; }
[67] Fix | Delete
[68] Fix | Delete
function stringTokenizer(stream, state) {
[69] Fix | Delete
var nextChar = stream.next();
[70] Fix | Delete
var peekChar = stream.peek();
[71] Fix | Delete
var previousChar = stream.string.charAt(stream.pos-2);
[72] Fix | Delete
[73] Fix | Delete
var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\"));
[74] Fix | Delete
[75] Fix | Delete
if (endingString) {
[76] Fix | Delete
if (nextChar !== quote && greedy) { stream.next(); }
[77] Fix | Delete
state.tokenizer = tokenBase;
[78] Fix | Delete
return "string";
[79] Fix | Delete
} else if (nextChar === "#" && peekChar === "{") {
[80] Fix | Delete
state.tokenizer = buildInterpolationTokenizer(stringTokenizer);
[81] Fix | Delete
stream.next();
[82] Fix | Delete
return "operator";
[83] Fix | Delete
} else {
[84] Fix | Delete
return "string";
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
return stringTokenizer;
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
function buildInterpolationTokenizer(currentTokenizer) {
[92] Fix | Delete
return function(stream, state) {
[93] Fix | Delete
if (stream.peek() === "}") {
[94] Fix | Delete
stream.next();
[95] Fix | Delete
state.tokenizer = currentTokenizer;
[96] Fix | Delete
return "operator";
[97] Fix | Delete
} else {
[98] Fix | Delete
return tokenBase(stream, state);
[99] Fix | Delete
}
[100] Fix | Delete
};
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
function indent(state) {
[104] Fix | Delete
if (state.indentCount == 0) {
[105] Fix | Delete
state.indentCount++;
[106] Fix | Delete
var lastScopeOffset = state.scopes[0].offset;
[107] Fix | Delete
var currentOffset = lastScopeOffset + config.indentUnit;
[108] Fix | Delete
state.scopes.unshift({ offset:currentOffset });
[109] Fix | Delete
}
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
function dedent(state) {
[113] Fix | Delete
if (state.scopes.length == 1) return;
[114] Fix | Delete
[115] Fix | Delete
state.scopes.shift();
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
function tokenBase(stream, state) {
[119] Fix | Delete
var ch = stream.peek();
[120] Fix | Delete
[121] Fix | Delete
// Comment
[122] Fix | Delete
if (stream.match("/*")) {
[123] Fix | Delete
state.tokenizer = comment(stream.indentation(), true);
[124] Fix | Delete
return state.tokenizer(stream, state);
[125] Fix | Delete
}
[126] Fix | Delete
if (stream.match("//")) {
[127] Fix | Delete
state.tokenizer = comment(stream.indentation(), false);
[128] Fix | Delete
return state.tokenizer(stream, state);
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
// Interpolation
[132] Fix | Delete
if (stream.match("#{")) {
[133] Fix | Delete
state.tokenizer = buildInterpolationTokenizer(tokenBase);
[134] Fix | Delete
return "operator";
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
// Strings
[138] Fix | Delete
if (ch === '"' || ch === "'") {
[139] Fix | Delete
stream.next();
[140] Fix | Delete
state.tokenizer = buildStringTokenizer(ch);
[141] Fix | Delete
return "string";
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
if(!state.cursorHalf){// state.cursorHalf === 0
[145] Fix | Delete
// first half i.e. before : for key-value pairs
[146] Fix | Delete
// including selectors
[147] Fix | Delete
[148] Fix | Delete
if (ch === ".") {
[149] Fix | Delete
stream.next();
[150] Fix | Delete
if (stream.match(/^[\w-]+/)) {
[151] Fix | Delete
indent(state);
[152] Fix | Delete
return "atom";
[153] Fix | Delete
} else if (stream.peek() === "#") {
[154] Fix | Delete
indent(state);
[155] Fix | Delete
return "atom";
[156] Fix | Delete
}
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
if (ch === "#") {
[160] Fix | Delete
stream.next();
[161] Fix | Delete
// ID selectors
[162] Fix | Delete
if (stream.match(/^[\w-]+/)) {
[163] Fix | Delete
indent(state);
[164] Fix | Delete
return "atom";
[165] Fix | Delete
}
[166] Fix | Delete
if (stream.peek() === "#") {
[167] Fix | Delete
indent(state);
[168] Fix | Delete
return "atom";
[169] Fix | Delete
}
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
// Variables
[173] Fix | Delete
if (ch === "$") {
[174] Fix | Delete
stream.next();
[175] Fix | Delete
stream.eatWhile(/[\w-]/);
[176] Fix | Delete
return "variable-2";
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
// Numbers
[180] Fix | Delete
if (stream.match(/^-?[0-9\.]+/))
[181] Fix | Delete
return "number";
[182] Fix | Delete
[183] Fix | Delete
// Units
[184] Fix | Delete
if (stream.match(/^(px|em|in)\b/))
[185] Fix | Delete
return "unit";
[186] Fix | Delete
[187] Fix | Delete
if (stream.match(keywordsRegexp))
[188] Fix | Delete
return "keyword";
[189] Fix | Delete
[190] Fix | Delete
if (stream.match(/^url/) && stream.peek() === "(") {
[191] Fix | Delete
state.tokenizer = urlTokens;
[192] Fix | Delete
return "atom";
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
if (ch === "=") {
[196] Fix | Delete
// Match shortcut mixin definition
[197] Fix | Delete
if (stream.match(/^=[\w-]+/)) {
[198] Fix | Delete
indent(state);
[199] Fix | Delete
return "meta";
[200] Fix | Delete
}
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
if (ch === "+") {
[204] Fix | Delete
// Match shortcut mixin definition
[205] Fix | Delete
if (stream.match(/^\+[\w-]+/)){
[206] Fix | Delete
return "variable-3";
[207] Fix | Delete
}
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
if(ch === "@"){
[211] Fix | Delete
if(stream.match(/@extend/)){
[212] Fix | Delete
if(!stream.match(/\s*[\w]/))
[213] Fix | Delete
dedent(state);
[214] Fix | Delete
}
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
[218] Fix | Delete
// Indent Directives
[219] Fix | Delete
if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) {
[220] Fix | Delete
indent(state);
[221] Fix | Delete
return "meta";
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
// Other Directives
[225] Fix | Delete
if (ch === "@") {
[226] Fix | Delete
stream.next();
[227] Fix | Delete
stream.eatWhile(/[\w-]/);
[228] Fix | Delete
return "meta";
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
if (stream.eatWhile(/[\w-]/)){
[232] Fix | Delete
if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){
[233] Fix | Delete
return "property";
[234] Fix | Delete
}
[235] Fix | Delete
else if(stream.match(/ *:/,false)){
[236] Fix | Delete
indent(state);
[237] Fix | Delete
state.cursorHalf = 1;
[238] Fix | Delete
return "atom";
[239] Fix | Delete
}
[240] Fix | Delete
else if(stream.match(/ *,/,false)){
[241] Fix | Delete
return "atom";
[242] Fix | Delete
}
[243] Fix | Delete
else{
[244] Fix | Delete
indent(state);
[245] Fix | Delete
return "atom";
[246] Fix | Delete
}
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
if(ch === ":"){
[250] Fix | Delete
if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element
[251] Fix | Delete
return "keyword";
[252] Fix | Delete
}
[253] Fix | Delete
stream.next();
[254] Fix | Delete
state.cursorHalf=1;
[255] Fix | Delete
return "operator";
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
} // cursorHalf===0 ends here
[259] Fix | Delete
else{
[260] Fix | Delete
[261] Fix | Delete
if (ch === "#") {
[262] Fix | Delete
stream.next();
[263] Fix | Delete
// Hex numbers
[264] Fix | Delete
if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){
[265] Fix | Delete
if(!stream.peek()){
[266] Fix | Delete
state.cursorHalf = 0;
[267] Fix | Delete
}
[268] Fix | Delete
return "number";
[269] Fix | Delete
}
[270] Fix | Delete
}
[271] Fix | Delete
[272] Fix | Delete
// Numbers
[273] Fix | Delete
if (stream.match(/^-?[0-9\.]+/)){
[274] Fix | Delete
if(!stream.peek()){
[275] Fix | Delete
state.cursorHalf = 0;
[276] Fix | Delete
}
[277] Fix | Delete
return "number";
[278] Fix | Delete
}
[279] Fix | Delete
[280] Fix | Delete
// Units
[281] Fix | Delete
if (stream.match(/^(px|em|in)\b/)){
[282] Fix | Delete
if(!stream.peek()){
[283] Fix | Delete
state.cursorHalf = 0;
[284] Fix | Delete
}
[285] Fix | Delete
return "unit";
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
if (stream.match(keywordsRegexp)){
[289] Fix | Delete
if(!stream.peek()){
[290] Fix | Delete
state.cursorHalf = 0;
[291] Fix | Delete
}
[292] Fix | Delete
return "keyword";
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
if (stream.match(/^url/) && stream.peek() === "(") {
[296] Fix | Delete
state.tokenizer = urlTokens;
[297] Fix | Delete
if(!stream.peek()){
[298] Fix | Delete
state.cursorHalf = 0;
[299] Fix | Delete
}
[300] Fix | Delete
return "atom";
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
// Variables
[304] Fix | Delete
if (ch === "$") {
[305] Fix | Delete
stream.next();
[306] Fix | Delete
stream.eatWhile(/[\w-]/);
[307] Fix | Delete
if(!stream.peek()){
[308] Fix | Delete
state.cursorHalf = 0;
[309] Fix | Delete
}
[310] Fix | Delete
return "variable-3";
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
// bang character for !important, !default, etc.
[314] Fix | Delete
if (ch === "!") {
[315] Fix | Delete
stream.next();
[316] Fix | Delete
if(!stream.peek()){
[317] Fix | Delete
state.cursorHalf = 0;
[318] Fix | Delete
}
[319] Fix | Delete
return stream.match(/^[\w]+/) ? "keyword": "operator";
[320] Fix | Delete
}
[321] Fix | Delete
[322] Fix | Delete
if (stream.match(opRegexp)){
[323] Fix | Delete
if(!stream.peek()){
[324] Fix | Delete
state.cursorHalf = 0;
[325] Fix | Delete
}
[326] Fix | Delete
return "operator";
[327] Fix | Delete
}
[328] Fix | Delete
[329] Fix | Delete
// attributes
[330] Fix | Delete
if (stream.eatWhile(/[\w-]/)) {
[331] Fix | Delete
if(!stream.peek()){
[332] Fix | Delete
state.cursorHalf = 0;
[333] Fix | Delete
}
[334] Fix | Delete
return "attribute";
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
//stream.eatSpace();
[338] Fix | Delete
if(!stream.peek()){
[339] Fix | Delete
state.cursorHalf = 0;
[340] Fix | Delete
return null;
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
} // else ends here
[344] Fix | Delete
[345] Fix | Delete
if (stream.match(opRegexp))
[346] Fix | Delete
return "operator";
[347] Fix | Delete
[348] Fix | Delete
// If we haven't returned by now, we move 1 character
[349] Fix | Delete
// and return an error
[350] Fix | Delete
stream.next();
[351] Fix | Delete
return null;
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
function tokenLexer(stream, state) {
[355] Fix | Delete
if (stream.sol()) state.indentCount = 0;
[356] Fix | Delete
var style = state.tokenizer(stream, state);
[357] Fix | Delete
var current = stream.current();
[358] Fix | Delete
[359] Fix | Delete
if (current === "@return" || current === "}"){
[360] Fix | Delete
dedent(state);
[361] Fix | Delete
}
[362] Fix | Delete
[363] Fix | Delete
if (style !== null) {
[364] Fix | Delete
var startOfToken = stream.pos - current.length;
[365] Fix | Delete
[366] Fix | Delete
var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount);
[367] Fix | Delete
[368] Fix | Delete
var newScopes = [];
[369] Fix | Delete
[370] Fix | Delete
for (var i = 0; i < state.scopes.length; i++) {
[371] Fix | Delete
var scope = state.scopes[i];
[372] Fix | Delete
[373] Fix | Delete
if (scope.offset <= withCurrentIndent)
[374] Fix | Delete
newScopes.push(scope);
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
state.scopes = newScopes;
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
[381] Fix | Delete
return style;
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
return {
[385] Fix | Delete
startState: function() {
[386] Fix | Delete
return {
[387] Fix | Delete
tokenizer: tokenBase,
[388] Fix | Delete
scopes: [{offset: 0, type: "sass"}],
[389] Fix | Delete
indentCount: 0,
[390] Fix | Delete
cursorHalf: 0, // cursor half tells us if cursor lies after (1)
[391] Fix | Delete
// or before (0) colon (well... more or less)
[392] Fix | Delete
definedVars: [],
[393] Fix | Delete
definedMixins: []
[394] Fix | Delete
};
[395] Fix | Delete
},
[396] Fix | Delete
token: function(stream, state) {
[397] Fix | Delete
var style = tokenLexer(stream, state);
[398] Fix | Delete
[399] Fix | Delete
state.lastToken = { style: style, content: stream.current() };
[400] Fix | Delete
[401] Fix | Delete
return style;
[402] Fix | Delete
},
[403] Fix | Delete
[404] Fix | Delete
indent: function(state) {
[405] Fix | Delete
return state.scopes[0].offset;
[406] Fix | Delete
}
[407] Fix | Delete
};
[408] Fix | Delete
});
[409] Fix | Delete
[410] Fix | Delete
CodeMirror.defineMIME("text/x-sass", "sass");
[411] Fix | Delete
[412] Fix | Delete
});
[413] Fix | Delete
[414] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function