Edit File by line
/home/barbar84/www/wp-inclu.../js/codemirr...
File: csslint.js
}
[6500] Fix | Delete
}
[6501] Fix | Delete
};
[6502] Fix | Delete
[6503] Fix | Delete
},{}],24:[function(require,module,exports){
[6504] Fix | Delete
"use strict";
[6505] Fix | Delete
[6506] Fix | Delete
module.exports = StringReader;
[6507] Fix | Delete
[6508] Fix | Delete
/**
[6509] Fix | Delete
* Convenient way to read through strings.
[6510] Fix | Delete
* @namespace parserlib.util
[6511] Fix | Delete
* @class StringReader
[6512] Fix | Delete
* @constructor
[6513] Fix | Delete
* @param {String} text The text to read.
[6514] Fix | Delete
*/
[6515] Fix | Delete
function StringReader(text) {
[6516] Fix | Delete
[6517] Fix | Delete
/**
[6518] Fix | Delete
* The input text with line endings normalized.
[6519] Fix | Delete
* @property _input
[6520] Fix | Delete
* @type String
[6521] Fix | Delete
* @private
[6522] Fix | Delete
*/
[6523] Fix | Delete
this._input = text.replace(/(\r\n?|\n)/g, "\n");
[6524] Fix | Delete
[6525] Fix | Delete
[6526] Fix | Delete
/**
[6527] Fix | Delete
* The row for the character to be read next.
[6528] Fix | Delete
* @property _line
[6529] Fix | Delete
* @type int
[6530] Fix | Delete
* @private
[6531] Fix | Delete
*/
[6532] Fix | Delete
this._line = 1;
[6533] Fix | Delete
[6534] Fix | Delete
[6535] Fix | Delete
/**
[6536] Fix | Delete
* The column for the character to be read next.
[6537] Fix | Delete
* @property _col
[6538] Fix | Delete
* @type int
[6539] Fix | Delete
* @private
[6540] Fix | Delete
*/
[6541] Fix | Delete
this._col = 1;
[6542] Fix | Delete
[6543] Fix | Delete
/**
[6544] Fix | Delete
* The index of the character in the input to be read next.
[6545] Fix | Delete
* @property _cursor
[6546] Fix | Delete
* @type int
[6547] Fix | Delete
* @private
[6548] Fix | Delete
*/
[6549] Fix | Delete
this._cursor = 0;
[6550] Fix | Delete
}
[6551] Fix | Delete
[6552] Fix | Delete
StringReader.prototype = {
[6553] Fix | Delete
[6554] Fix | Delete
// restore constructor
[6555] Fix | Delete
constructor: StringReader,
[6556] Fix | Delete
[6557] Fix | Delete
//-------------------------------------------------------------------------
[6558] Fix | Delete
// Position info
[6559] Fix | Delete
//-------------------------------------------------------------------------
[6560] Fix | Delete
[6561] Fix | Delete
/**
[6562] Fix | Delete
* Returns the column of the character to be read next.
[6563] Fix | Delete
* @return {int} The column of the character to be read next.
[6564] Fix | Delete
* @method getCol
[6565] Fix | Delete
*/
[6566] Fix | Delete
getCol: function() {
[6567] Fix | Delete
return this._col;
[6568] Fix | Delete
},
[6569] Fix | Delete
[6570] Fix | Delete
/**
[6571] Fix | Delete
* Returns the row of the character to be read next.
[6572] Fix | Delete
* @return {int} The row of the character to be read next.
[6573] Fix | Delete
* @method getLine
[6574] Fix | Delete
*/
[6575] Fix | Delete
getLine: function() {
[6576] Fix | Delete
return this._line;
[6577] Fix | Delete
},
[6578] Fix | Delete
[6579] Fix | Delete
/**
[6580] Fix | Delete
* Determines if you're at the end of the input.
[6581] Fix | Delete
* @return {Boolean} True if there's no more input, false otherwise.
[6582] Fix | Delete
* @method eof
[6583] Fix | Delete
*/
[6584] Fix | Delete
eof: function() {
[6585] Fix | Delete
return this._cursor === this._input.length;
[6586] Fix | Delete
},
[6587] Fix | Delete
[6588] Fix | Delete
//-------------------------------------------------------------------------
[6589] Fix | Delete
// Basic reading
[6590] Fix | Delete
//-------------------------------------------------------------------------
[6591] Fix | Delete
[6592] Fix | Delete
/**
[6593] Fix | Delete
* Reads the next character without advancing the cursor.
[6594] Fix | Delete
* @param {int} count How many characters to look ahead (default is 1).
[6595] Fix | Delete
* @return {String} The next character or null if there is no next character.
[6596] Fix | Delete
* @method peek
[6597] Fix | Delete
*/
[6598] Fix | Delete
peek: function(count) {
[6599] Fix | Delete
var c = null;
[6600] Fix | Delete
count = typeof count === "undefined" ? 1 : count;
[6601] Fix | Delete
[6602] Fix | Delete
// if we're not at the end of the input...
[6603] Fix | Delete
if (this._cursor < this._input.length) {
[6604] Fix | Delete
[6605] Fix | Delete
// get character and increment cursor and column
[6606] Fix | Delete
c = this._input.charAt(this._cursor + count - 1);
[6607] Fix | Delete
}
[6608] Fix | Delete
[6609] Fix | Delete
return c;
[6610] Fix | Delete
},
[6611] Fix | Delete
[6612] Fix | Delete
/**
[6613] Fix | Delete
* Reads the next character from the input and adjusts the row and column
[6614] Fix | Delete
* accordingly.
[6615] Fix | Delete
* @return {String} The next character or null if there is no next character.
[6616] Fix | Delete
* @method read
[6617] Fix | Delete
*/
[6618] Fix | Delete
read: function() {
[6619] Fix | Delete
var c = null;
[6620] Fix | Delete
[6621] Fix | Delete
// if we're not at the end of the input...
[6622] Fix | Delete
if (this._cursor < this._input.length) {
[6623] Fix | Delete
[6624] Fix | Delete
// if the last character was a newline, increment row count
[6625] Fix | Delete
// and reset column count
[6626] Fix | Delete
if (this._input.charAt(this._cursor) === "\n") {
[6627] Fix | Delete
this._line++;
[6628] Fix | Delete
this._col=1;
[6629] Fix | Delete
} else {
[6630] Fix | Delete
this._col++;
[6631] Fix | Delete
}
[6632] Fix | Delete
[6633] Fix | Delete
// get character and increment cursor and column
[6634] Fix | Delete
c = this._input.charAt(this._cursor++);
[6635] Fix | Delete
}
[6636] Fix | Delete
[6637] Fix | Delete
return c;
[6638] Fix | Delete
},
[6639] Fix | Delete
[6640] Fix | Delete
//-------------------------------------------------------------------------
[6641] Fix | Delete
// Misc
[6642] Fix | Delete
//-------------------------------------------------------------------------
[6643] Fix | Delete
[6644] Fix | Delete
/**
[6645] Fix | Delete
* Saves the current location so it can be returned to later.
[6646] Fix | Delete
* @method mark
[6647] Fix | Delete
* @return {void}
[6648] Fix | Delete
*/
[6649] Fix | Delete
mark: function() {
[6650] Fix | Delete
this._bookmark = {
[6651] Fix | Delete
cursor: this._cursor,
[6652] Fix | Delete
line: this._line,
[6653] Fix | Delete
col: this._col
[6654] Fix | Delete
};
[6655] Fix | Delete
},
[6656] Fix | Delete
[6657] Fix | Delete
reset: function() {
[6658] Fix | Delete
if (this._bookmark) {
[6659] Fix | Delete
this._cursor = this._bookmark.cursor;
[6660] Fix | Delete
this._line = this._bookmark.line;
[6661] Fix | Delete
this._col = this._bookmark.col;
[6662] Fix | Delete
delete this._bookmark;
[6663] Fix | Delete
}
[6664] Fix | Delete
},
[6665] Fix | Delete
[6666] Fix | Delete
//-------------------------------------------------------------------------
[6667] Fix | Delete
// Advanced reading
[6668] Fix | Delete
//-------------------------------------------------------------------------
[6669] Fix | Delete
[6670] Fix | Delete
/**
[6671] Fix | Delete
* Reads up to and including the given string. Throws an error if that
[6672] Fix | Delete
* string is not found.
[6673] Fix | Delete
* @param {String} pattern The string to read.
[6674] Fix | Delete
* @return {String} The string when it is found.
[6675] Fix | Delete
* @throws Error when the string pattern is not found.
[6676] Fix | Delete
* @method readTo
[6677] Fix | Delete
*/
[6678] Fix | Delete
readTo: function(pattern) {
[6679] Fix | Delete
[6680] Fix | Delete
var buffer = "",
[6681] Fix | Delete
c;
[6682] Fix | Delete
[6683] Fix | Delete
/*
[6684] Fix | Delete
* First, buffer must be the same length as the pattern.
[6685] Fix | Delete
* Then, buffer must end with the pattern or else reach the
[6686] Fix | Delete
* end of the input.
[6687] Fix | Delete
*/
[6688] Fix | Delete
while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length) {
[6689] Fix | Delete
c = this.read();
[6690] Fix | Delete
if (c) {
[6691] Fix | Delete
buffer += c;
[6692] Fix | Delete
} else {
[6693] Fix | Delete
throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + ".");
[6694] Fix | Delete
}
[6695] Fix | Delete
}
[6696] Fix | Delete
[6697] Fix | Delete
return buffer;
[6698] Fix | Delete
[6699] Fix | Delete
},
[6700] Fix | Delete
[6701] Fix | Delete
/**
[6702] Fix | Delete
* Reads characters while each character causes the given
[6703] Fix | Delete
* filter function to return true. The function is passed
[6704] Fix | Delete
* in each character and either returns true to continue
[6705] Fix | Delete
* reading or false to stop.
[6706] Fix | Delete
* @param {Function} filter The function to read on each character.
[6707] Fix | Delete
* @return {String} The string made up of all characters that passed the
[6708] Fix | Delete
* filter check.
[6709] Fix | Delete
* @method readWhile
[6710] Fix | Delete
*/
[6711] Fix | Delete
readWhile: function(filter) {
[6712] Fix | Delete
[6713] Fix | Delete
var buffer = "",
[6714] Fix | Delete
c = this.peek();
[6715] Fix | Delete
[6716] Fix | Delete
while (c !== null && filter(c)) {
[6717] Fix | Delete
buffer += this.read();
[6718] Fix | Delete
c = this.peek();
[6719] Fix | Delete
}
[6720] Fix | Delete
[6721] Fix | Delete
return buffer;
[6722] Fix | Delete
[6723] Fix | Delete
},
[6724] Fix | Delete
[6725] Fix | Delete
/**
[6726] Fix | Delete
* Reads characters that match either text or a regular expression and
[6727] Fix | Delete
* returns those characters. If a match is found, the row and column
[6728] Fix | Delete
* are adjusted; if no match is found, the reader's state is unchanged.
[6729] Fix | Delete
* reading or false to stop.
[6730] Fix | Delete
* @param {String|RegExp} matcher If a string, then the literal string
[6731] Fix | Delete
* value is searched for. If a regular expression, then any string
[6732] Fix | Delete
* matching the pattern is search for.
[6733] Fix | Delete
* @return {String} The string made up of all characters that matched or
[6734] Fix | Delete
* null if there was no match.
[6735] Fix | Delete
* @method readMatch
[6736] Fix | Delete
*/
[6737] Fix | Delete
readMatch: function(matcher) {
[6738] Fix | Delete
[6739] Fix | Delete
var source = this._input.substring(this._cursor),
[6740] Fix | Delete
value = null;
[6741] Fix | Delete
[6742] Fix | Delete
// if it's a string, just do a straight match
[6743] Fix | Delete
if (typeof matcher === "string") {
[6744] Fix | Delete
if (source.slice(0, matcher.length) === matcher) {
[6745] Fix | Delete
value = this.readCount(matcher.length);
[6746] Fix | Delete
}
[6747] Fix | Delete
} else if (matcher instanceof RegExp) {
[6748] Fix | Delete
if (matcher.test(source)) {
[6749] Fix | Delete
value = this.readCount(RegExp.lastMatch.length);
[6750] Fix | Delete
}
[6751] Fix | Delete
}
[6752] Fix | Delete
[6753] Fix | Delete
return value;
[6754] Fix | Delete
},
[6755] Fix | Delete
[6756] Fix | Delete
[6757] Fix | Delete
/**
[6758] Fix | Delete
* Reads a given number of characters. If the end of the input is reached,
[6759] Fix | Delete
* it reads only the remaining characters and does not throw an error.
[6760] Fix | Delete
* @param {int} count The number of characters to read.
[6761] Fix | Delete
* @return {String} The string made up the read characters.
[6762] Fix | Delete
* @method readCount
[6763] Fix | Delete
*/
[6764] Fix | Delete
readCount: function(count) {
[6765] Fix | Delete
var buffer = "";
[6766] Fix | Delete
[6767] Fix | Delete
while (count--) {
[6768] Fix | Delete
buffer += this.read();
[6769] Fix | Delete
}
[6770] Fix | Delete
[6771] Fix | Delete
return buffer;
[6772] Fix | Delete
}
[6773] Fix | Delete
[6774] Fix | Delete
};
[6775] Fix | Delete
[6776] Fix | Delete
},{}],25:[function(require,module,exports){
[6777] Fix | Delete
"use strict";
[6778] Fix | Delete
[6779] Fix | Delete
module.exports = SyntaxError;
[6780] Fix | Delete
[6781] Fix | Delete
/**
[6782] Fix | Delete
* Type to use when a syntax error occurs.
[6783] Fix | Delete
* @class SyntaxError
[6784] Fix | Delete
* @namespace parserlib.util
[6785] Fix | Delete
* @constructor
[6786] Fix | Delete
* @param {String} message The error message.
[6787] Fix | Delete
* @param {int} line The line at which the error occurred.
[6788] Fix | Delete
* @param {int} col The column at which the error occurred.
[6789] Fix | Delete
*/
[6790] Fix | Delete
function SyntaxError(message, line, col) {
[6791] Fix | Delete
Error.call(this);
[6792] Fix | Delete
this.name = this.constructor.name;
[6793] Fix | Delete
[6794] Fix | Delete
/**
[6795] Fix | Delete
* The column at which the error occurred.
[6796] Fix | Delete
* @type int
[6797] Fix | Delete
* @property col
[6798] Fix | Delete
*/
[6799] Fix | Delete
this.col = col;
[6800] Fix | Delete
[6801] Fix | Delete
/**
[6802] Fix | Delete
* The line at which the error occurred.
[6803] Fix | Delete
* @type int
[6804] Fix | Delete
* @property line
[6805] Fix | Delete
*/
[6806] Fix | Delete
this.line = line;
[6807] Fix | Delete
[6808] Fix | Delete
/**
[6809] Fix | Delete
* The text representation of the unit.
[6810] Fix | Delete
* @type String
[6811] Fix | Delete
* @property text
[6812] Fix | Delete
*/
[6813] Fix | Delete
this.message = message;
[6814] Fix | Delete
[6815] Fix | Delete
}
[6816] Fix | Delete
[6817] Fix | Delete
//inherit from Error
[6818] Fix | Delete
SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line
[6819] Fix | Delete
SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line
[6820] Fix | Delete
[6821] Fix | Delete
},{}],26:[function(require,module,exports){
[6822] Fix | Delete
"use strict";
[6823] Fix | Delete
[6824] Fix | Delete
module.exports = SyntaxUnit;
[6825] Fix | Delete
[6826] Fix | Delete
/**
[6827] Fix | Delete
* Base type to represent a single syntactic unit.
[6828] Fix | Delete
* @class SyntaxUnit
[6829] Fix | Delete
* @namespace parserlib.util
[6830] Fix | Delete
* @constructor
[6831] Fix | Delete
* @param {String} text The text of the unit.
[6832] Fix | Delete
* @param {int} line The line of text on which the unit resides.
[6833] Fix | Delete
* @param {int} col The column of text on which the unit resides.
[6834] Fix | Delete
*/
[6835] Fix | Delete
function SyntaxUnit(text, line, col, type) {
[6836] Fix | Delete
[6837] Fix | Delete
[6838] Fix | Delete
/**
[6839] Fix | Delete
* The column of text on which the unit resides.
[6840] Fix | Delete
* @type int
[6841] Fix | Delete
* @property col
[6842] Fix | Delete
*/
[6843] Fix | Delete
this.col = col;
[6844] Fix | Delete
[6845] Fix | Delete
/**
[6846] Fix | Delete
* The line of text on which the unit resides.
[6847] Fix | Delete
* @type int
[6848] Fix | Delete
* @property line
[6849] Fix | Delete
*/
[6850] Fix | Delete
this.line = line;
[6851] Fix | Delete
[6852] Fix | Delete
/**
[6853] Fix | Delete
* The text representation of the unit.
[6854] Fix | Delete
* @type String
[6855] Fix | Delete
* @property text
[6856] Fix | Delete
*/
[6857] Fix | Delete
this.text = text;
[6858] Fix | Delete
[6859] Fix | Delete
/**
[6860] Fix | Delete
* The type of syntax unit.
[6861] Fix | Delete
* @type int
[6862] Fix | Delete
* @property type
[6863] Fix | Delete
*/
[6864] Fix | Delete
this.type = type;
[6865] Fix | Delete
}
[6866] Fix | Delete
[6867] Fix | Delete
/**
[6868] Fix | Delete
* Create a new syntax unit based solely on the given token.
[6869] Fix | Delete
* Convenience method for creating a new syntax unit when
[6870] Fix | Delete
* it represents a single token instead of multiple.
[6871] Fix | Delete
* @param {Object} token The token object to represent.
[6872] Fix | Delete
* @return {parserlib.util.SyntaxUnit} The object representing the token.
[6873] Fix | Delete
* @static
[6874] Fix | Delete
* @method fromToken
[6875] Fix | Delete
*/
[6876] Fix | Delete
SyntaxUnit.fromToken = function(token) {
[6877] Fix | Delete
return new SyntaxUnit(token.value, token.startLine, token.startCol);
[6878] Fix | Delete
};
[6879] Fix | Delete
[6880] Fix | Delete
SyntaxUnit.prototype = {
[6881] Fix | Delete
[6882] Fix | Delete
//restore constructor
[6883] Fix | Delete
constructor: SyntaxUnit,
[6884] Fix | Delete
[6885] Fix | Delete
/**
[6886] Fix | Delete
* Returns the text representation of the unit.
[6887] Fix | Delete
* @return {String} The text representation of the unit.
[6888] Fix | Delete
* @method valueOf
[6889] Fix | Delete
*/
[6890] Fix | Delete
valueOf: function() {
[6891] Fix | Delete
return this.toString();
[6892] Fix | Delete
},
[6893] Fix | Delete
[6894] Fix | Delete
/**
[6895] Fix | Delete
* Returns the text representation of the unit.
[6896] Fix | Delete
* @return {String} The text representation of the unit.
[6897] Fix | Delete
* @method toString
[6898] Fix | Delete
*/
[6899] Fix | Delete
toString: function() {
[6900] Fix | Delete
return this.text;
[6901] Fix | Delete
}
[6902] Fix | Delete
[6903] Fix | Delete
};
[6904] Fix | Delete
[6905] Fix | Delete
},{}],27:[function(require,module,exports){
[6906] Fix | Delete
"use strict";
[6907] Fix | Delete
[6908] Fix | Delete
module.exports = TokenStreamBase;
[6909] Fix | Delete
[6910] Fix | Delete
var StringReader = require("./StringReader");
[6911] Fix | Delete
var SyntaxError = require("./SyntaxError");
[6912] Fix | Delete
[6913] Fix | Delete
/**
[6914] Fix | Delete
* Generic TokenStream providing base functionality.
[6915] Fix | Delete
* @class TokenStreamBase
[6916] Fix | Delete
* @namespace parserlib.util
[6917] Fix | Delete
* @constructor
[6918] Fix | Delete
* @param {String|StringReader} input The text to tokenize or a reader from
[6919] Fix | Delete
* which to read the input.
[6920] Fix | Delete
*/
[6921] Fix | Delete
function TokenStreamBase(input, tokenData) {
[6922] Fix | Delete
[6923] Fix | Delete
/**
[6924] Fix | Delete
* The string reader for easy access to the text.
[6925] Fix | Delete
* @type StringReader
[6926] Fix | Delete
* @property _reader
[6927] Fix | Delete
* @private
[6928] Fix | Delete
*/
[6929] Fix | Delete
this._reader = new StringReader(input ? input.toString() : "");
[6930] Fix | Delete
[6931] Fix | Delete
/**
[6932] Fix | Delete
* Token object for the last consumed token.
[6933] Fix | Delete
* @type Token
[6934] Fix | Delete
* @property _token
[6935] Fix | Delete
* @private
[6936] Fix | Delete
*/
[6937] Fix | Delete
this._token = null;
[6938] Fix | Delete
[6939] Fix | Delete
/**
[6940] Fix | Delete
* The array of token information.
[6941] Fix | Delete
* @type Array
[6942] Fix | Delete
* @property _tokenData
[6943] Fix | Delete
* @private
[6944] Fix | Delete
*/
[6945] Fix | Delete
this._tokenData = tokenData;
[6946] Fix | Delete
[6947] Fix | Delete
/**
[6948] Fix | Delete
* Lookahead token buffer.
[6949] Fix | Delete
* @type Array
[6950] Fix | Delete
* @property _lt
[6951] Fix | Delete
* @private
[6952] Fix | Delete
*/
[6953] Fix | Delete
this._lt = [];
[6954] Fix | Delete
[6955] Fix | Delete
/**
[6956] Fix | Delete
* Lookahead token buffer index.
[6957] Fix | Delete
* @type int
[6958] Fix | Delete
* @property _ltIndex
[6959] Fix | Delete
* @private
[6960] Fix | Delete
*/
[6961] Fix | Delete
this._ltIndex = 0;
[6962] Fix | Delete
[6963] Fix | Delete
this._ltIndexCache = [];
[6964] Fix | Delete
}
[6965] Fix | Delete
[6966] Fix | Delete
/**
[6967] Fix | Delete
* Accepts an array of token information and outputs
[6968] Fix | Delete
* an array of token data containing key-value mappings
[6969] Fix | Delete
* and matching functions that the TokenStream needs.
[6970] Fix | Delete
* @param {Array} tokens An array of token descriptors.
[6971] Fix | Delete
* @return {Array} An array of processed token data.
[6972] Fix | Delete
* @method createTokenData
[6973] Fix | Delete
* @static
[6974] Fix | Delete
*/
[6975] Fix | Delete
TokenStreamBase.createTokenData = function(tokens) {
[6976] Fix | Delete
[6977] Fix | Delete
var nameMap = [],
[6978] Fix | Delete
typeMap = Object.create(null),
[6979] Fix | Delete
tokenData = tokens.concat([]),
[6980] Fix | Delete
i = 0,
[6981] Fix | Delete
len = tokenData.length+1;
[6982] Fix | Delete
[6983] Fix | Delete
tokenData.UNKNOWN = -1;
[6984] Fix | Delete
tokenData.unshift({ name:"EOF" });
[6985] Fix | Delete
[6986] Fix | Delete
for (; i < len; i++) {
[6987] Fix | Delete
nameMap.push(tokenData[i].name);
[6988] Fix | Delete
tokenData[tokenData[i].name] = i;
[6989] Fix | Delete
if (tokenData[i].text) {
[6990] Fix | Delete
typeMap[tokenData[i].text] = i;
[6991] Fix | Delete
}
[6992] Fix | Delete
}
[6993] Fix | Delete
[6994] Fix | Delete
tokenData.name = function(tt) {
[6995] Fix | Delete
return nameMap[tt];
[6996] Fix | Delete
};
[6997] Fix | Delete
[6998] Fix | Delete
tokenData.type = function(c) {
[6999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function