Edit File by line
/home/barbar84/public_h.../wp-inclu.../js/codemirr...
File: csslint.js
/*!
[0] Fix | Delete
CSSLint v1.0.4
[1] Fix | Delete
Copyright (c) 2016 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
[2] Fix | Delete
[3] Fix | Delete
Permission is hereby granted, free of charge, to any person obtaining a copy
[4] Fix | Delete
of this software and associated documentation files (the 'Software'), to deal
[5] Fix | Delete
in the Software without restriction, including without limitation the rights
[6] Fix | Delete
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
[7] Fix | Delete
copies of the Software, and to permit persons to whom the Software is
[8] Fix | Delete
furnished to do so, subject to the following conditions:
[9] Fix | Delete
[10] Fix | Delete
The above copyright notice and this permission notice shall be included in
[11] Fix | Delete
all copies or substantial portions of the Software.
[12] Fix | Delete
[13] Fix | Delete
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
[14] Fix | Delete
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
[15] Fix | Delete
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
[16] Fix | Delete
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
[17] Fix | Delete
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
[18] Fix | Delete
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
[19] Fix | Delete
THE SOFTWARE.
[20] Fix | Delete
[21] Fix | Delete
*/
[22] Fix | Delete
[23] Fix | Delete
var CSSLint = (function(){
[24] Fix | Delete
var module = module || {},
[25] Fix | Delete
exports = exports || {};
[26] Fix | Delete
[27] Fix | Delete
/*!
[28] Fix | Delete
Parser-Lib
[29] Fix | Delete
Copyright (c) 2009-2016 Nicholas C. Zakas. All rights reserved.
[30] Fix | Delete
[31] Fix | Delete
Permission is hereby granted, free of charge, to any person obtaining a copy
[32] Fix | Delete
of this software and associated documentation files (the "Software"), to deal
[33] Fix | Delete
in the Software without restriction, including without limitation the rights
[34] Fix | Delete
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
[35] Fix | Delete
copies of the Software, and to permit persons to whom the Software is
[36] Fix | Delete
furnished to do so, subject to the following conditions:
[37] Fix | Delete
[38] Fix | Delete
The above copyright notice and this permission notice shall be included in
[39] Fix | Delete
all copies or substantial portions of the Software.
[40] Fix | Delete
[41] Fix | Delete
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
[42] Fix | Delete
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
[43] Fix | Delete
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
[44] Fix | Delete
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
[45] Fix | Delete
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
[46] Fix | Delete
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
[47] Fix | Delete
THE SOFTWARE.
[48] Fix | Delete
*/
[49] Fix | Delete
/* Version v1.1.0, Build time: 6-December-2016 10:31:29 */
[50] Fix | Delete
var parserlib = (function () {
[51] Fix | Delete
var require;
[52] Fix | Delete
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
[53] Fix | Delete
"use strict";
[54] Fix | Delete
[55] Fix | Delete
/* exported Colors */
[56] Fix | Delete
[57] Fix | Delete
var Colors = module.exports = {
[58] Fix | Delete
__proto__ :null,
[59] Fix | Delete
aliceblue :"#f0f8ff",
[60] Fix | Delete
antiquewhite :"#faebd7",
[61] Fix | Delete
aqua :"#00ffff",
[62] Fix | Delete
aquamarine :"#7fffd4",
[63] Fix | Delete
azure :"#f0ffff",
[64] Fix | Delete
beige :"#f5f5dc",
[65] Fix | Delete
bisque :"#ffe4c4",
[66] Fix | Delete
black :"#000000",
[67] Fix | Delete
blanchedalmond :"#ffebcd",
[68] Fix | Delete
blue :"#0000ff",
[69] Fix | Delete
blueviolet :"#8a2be2",
[70] Fix | Delete
brown :"#a52a2a",
[71] Fix | Delete
burlywood :"#deb887",
[72] Fix | Delete
cadetblue :"#5f9ea0",
[73] Fix | Delete
chartreuse :"#7fff00",
[74] Fix | Delete
chocolate :"#d2691e",
[75] Fix | Delete
coral :"#ff7f50",
[76] Fix | Delete
cornflowerblue :"#6495ed",
[77] Fix | Delete
cornsilk :"#fff8dc",
[78] Fix | Delete
crimson :"#dc143c",
[79] Fix | Delete
cyan :"#00ffff",
[80] Fix | Delete
darkblue :"#00008b",
[81] Fix | Delete
darkcyan :"#008b8b",
[82] Fix | Delete
darkgoldenrod :"#b8860b",
[83] Fix | Delete
darkgray :"#a9a9a9",
[84] Fix | Delete
darkgrey :"#a9a9a9",
[85] Fix | Delete
darkgreen :"#006400",
[86] Fix | Delete
darkkhaki :"#bdb76b",
[87] Fix | Delete
darkmagenta :"#8b008b",
[88] Fix | Delete
darkolivegreen :"#556b2f",
[89] Fix | Delete
darkorange :"#ff8c00",
[90] Fix | Delete
darkorchid :"#9932cc",
[91] Fix | Delete
darkred :"#8b0000",
[92] Fix | Delete
darksalmon :"#e9967a",
[93] Fix | Delete
darkseagreen :"#8fbc8f",
[94] Fix | Delete
darkslateblue :"#483d8b",
[95] Fix | Delete
darkslategray :"#2f4f4f",
[96] Fix | Delete
darkslategrey :"#2f4f4f",
[97] Fix | Delete
darkturquoise :"#00ced1",
[98] Fix | Delete
darkviolet :"#9400d3",
[99] Fix | Delete
deeppink :"#ff1493",
[100] Fix | Delete
deepskyblue :"#00bfff",
[101] Fix | Delete
dimgray :"#696969",
[102] Fix | Delete
dimgrey :"#696969",
[103] Fix | Delete
dodgerblue :"#1e90ff",
[104] Fix | Delete
firebrick :"#b22222",
[105] Fix | Delete
floralwhite :"#fffaf0",
[106] Fix | Delete
forestgreen :"#228b22",
[107] Fix | Delete
fuchsia :"#ff00ff",
[108] Fix | Delete
gainsboro :"#dcdcdc",
[109] Fix | Delete
ghostwhite :"#f8f8ff",
[110] Fix | Delete
gold :"#ffd700",
[111] Fix | Delete
goldenrod :"#daa520",
[112] Fix | Delete
gray :"#808080",
[113] Fix | Delete
grey :"#808080",
[114] Fix | Delete
green :"#008000",
[115] Fix | Delete
greenyellow :"#adff2f",
[116] Fix | Delete
honeydew :"#f0fff0",
[117] Fix | Delete
hotpink :"#ff69b4",
[118] Fix | Delete
indianred :"#cd5c5c",
[119] Fix | Delete
indigo :"#4b0082",
[120] Fix | Delete
ivory :"#fffff0",
[121] Fix | Delete
khaki :"#f0e68c",
[122] Fix | Delete
lavender :"#e6e6fa",
[123] Fix | Delete
lavenderblush :"#fff0f5",
[124] Fix | Delete
lawngreen :"#7cfc00",
[125] Fix | Delete
lemonchiffon :"#fffacd",
[126] Fix | Delete
lightblue :"#add8e6",
[127] Fix | Delete
lightcoral :"#f08080",
[128] Fix | Delete
lightcyan :"#e0ffff",
[129] Fix | Delete
lightgoldenrodyellow :"#fafad2",
[130] Fix | Delete
lightgray :"#d3d3d3",
[131] Fix | Delete
lightgrey :"#d3d3d3",
[132] Fix | Delete
lightgreen :"#90ee90",
[133] Fix | Delete
lightpink :"#ffb6c1",
[134] Fix | Delete
lightsalmon :"#ffa07a",
[135] Fix | Delete
lightseagreen :"#20b2aa",
[136] Fix | Delete
lightskyblue :"#87cefa",
[137] Fix | Delete
lightslategray :"#778899",
[138] Fix | Delete
lightslategrey :"#778899",
[139] Fix | Delete
lightsteelblue :"#b0c4de",
[140] Fix | Delete
lightyellow :"#ffffe0",
[141] Fix | Delete
lime :"#00ff00",
[142] Fix | Delete
limegreen :"#32cd32",
[143] Fix | Delete
linen :"#faf0e6",
[144] Fix | Delete
magenta :"#ff00ff",
[145] Fix | Delete
maroon :"#800000",
[146] Fix | Delete
mediumaquamarine:"#66cdaa",
[147] Fix | Delete
mediumblue :"#0000cd",
[148] Fix | Delete
mediumorchid :"#ba55d3",
[149] Fix | Delete
mediumpurple :"#9370d8",
[150] Fix | Delete
mediumseagreen :"#3cb371",
[151] Fix | Delete
mediumslateblue :"#7b68ee",
[152] Fix | Delete
mediumspringgreen :"#00fa9a",
[153] Fix | Delete
mediumturquoise :"#48d1cc",
[154] Fix | Delete
mediumvioletred :"#c71585",
[155] Fix | Delete
midnightblue :"#191970",
[156] Fix | Delete
mintcream :"#f5fffa",
[157] Fix | Delete
mistyrose :"#ffe4e1",
[158] Fix | Delete
moccasin :"#ffe4b5",
[159] Fix | Delete
navajowhite :"#ffdead",
[160] Fix | Delete
navy :"#000080",
[161] Fix | Delete
oldlace :"#fdf5e6",
[162] Fix | Delete
olive :"#808000",
[163] Fix | Delete
olivedrab :"#6b8e23",
[164] Fix | Delete
orange :"#ffa500",
[165] Fix | Delete
orangered :"#ff4500",
[166] Fix | Delete
orchid :"#da70d6",
[167] Fix | Delete
palegoldenrod :"#eee8aa",
[168] Fix | Delete
palegreen :"#98fb98",
[169] Fix | Delete
paleturquoise :"#afeeee",
[170] Fix | Delete
palevioletred :"#d87093",
[171] Fix | Delete
papayawhip :"#ffefd5",
[172] Fix | Delete
peachpuff :"#ffdab9",
[173] Fix | Delete
peru :"#cd853f",
[174] Fix | Delete
pink :"#ffc0cb",
[175] Fix | Delete
plum :"#dda0dd",
[176] Fix | Delete
powderblue :"#b0e0e6",
[177] Fix | Delete
purple :"#800080",
[178] Fix | Delete
red :"#ff0000",
[179] Fix | Delete
rosybrown :"#bc8f8f",
[180] Fix | Delete
royalblue :"#4169e1",
[181] Fix | Delete
saddlebrown :"#8b4513",
[182] Fix | Delete
salmon :"#fa8072",
[183] Fix | Delete
sandybrown :"#f4a460",
[184] Fix | Delete
seagreen :"#2e8b57",
[185] Fix | Delete
seashell :"#fff5ee",
[186] Fix | Delete
sienna :"#a0522d",
[187] Fix | Delete
silver :"#c0c0c0",
[188] Fix | Delete
skyblue :"#87ceeb",
[189] Fix | Delete
slateblue :"#6a5acd",
[190] Fix | Delete
slategray :"#708090",
[191] Fix | Delete
slategrey :"#708090",
[192] Fix | Delete
snow :"#fffafa",
[193] Fix | Delete
springgreen :"#00ff7f",
[194] Fix | Delete
steelblue :"#4682b4",
[195] Fix | Delete
tan :"#d2b48c",
[196] Fix | Delete
teal :"#008080",
[197] Fix | Delete
thistle :"#d8bfd8",
[198] Fix | Delete
tomato :"#ff6347",
[199] Fix | Delete
turquoise :"#40e0d0",
[200] Fix | Delete
violet :"#ee82ee",
[201] Fix | Delete
wheat :"#f5deb3",
[202] Fix | Delete
white :"#ffffff",
[203] Fix | Delete
whitesmoke :"#f5f5f5",
[204] Fix | Delete
yellow :"#ffff00",
[205] Fix | Delete
yellowgreen :"#9acd32",
[206] Fix | Delete
//'currentColor' color keyword https://www.w3.org/TR/css3-color/#currentcolor
[207] Fix | Delete
currentColor :"The value of the 'color' property.",
[208] Fix | Delete
//CSS2 system colors https://www.w3.org/TR/css3-color/#css2-system
[209] Fix | Delete
activeBorder :"Active window border.",
[210] Fix | Delete
activecaption :"Active window caption.",
[211] Fix | Delete
appworkspace :"Background color of multiple document interface.",
[212] Fix | Delete
background :"Desktop background.",
[213] Fix | Delete
buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
[214] Fix | Delete
buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
[215] Fix | Delete
buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
[216] Fix | Delete
buttontext :"Text on push buttons.",
[217] Fix | Delete
captiontext :"Text in caption, size box, and scrollbar arrow box.",
[218] Fix | Delete
graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
[219] Fix | Delete
greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.",
[220] Fix | Delete
highlight :"Item(s) selected in a control.",
[221] Fix | Delete
highlighttext :"Text of item(s) selected in a control.",
[222] Fix | Delete
inactiveborder :"Inactive window border.",
[223] Fix | Delete
inactivecaption :"Inactive window caption.",
[224] Fix | Delete
inactivecaptiontext :"Color of text in an inactive caption.",
[225] Fix | Delete
infobackground :"Background color for tooltip controls.",
[226] Fix | Delete
infotext :"Text color for tooltip controls.",
[227] Fix | Delete
menu :"Menu background.",
[228] Fix | Delete
menutext :"Text in menus.",
[229] Fix | Delete
scrollbar :"Scroll bar gray area.",
[230] Fix | Delete
threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
[231] Fix | Delete
threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
[232] Fix | Delete
threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
[233] Fix | Delete
threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
[234] Fix | Delete
threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
[235] Fix | Delete
window :"Window background.",
[236] Fix | Delete
windowframe :"Window frame.",
[237] Fix | Delete
windowtext :"Text in windows."
[238] Fix | Delete
};
[239] Fix | Delete
[240] Fix | Delete
},{}],2:[function(require,module,exports){
[241] Fix | Delete
"use strict";
[242] Fix | Delete
[243] Fix | Delete
module.exports = Combinator;
[244] Fix | Delete
[245] Fix | Delete
var SyntaxUnit = require("../util/SyntaxUnit");
[246] Fix | Delete
[247] Fix | Delete
var Parser = require("./Parser");
[248] Fix | Delete
[249] Fix | Delete
/**
[250] Fix | Delete
* Represents a selector combinator (whitespace, +, >).
[251] Fix | Delete
* @namespace parserlib.css
[252] Fix | Delete
* @class Combinator
[253] Fix | Delete
* @extends parserlib.util.SyntaxUnit
[254] Fix | Delete
* @constructor
[255] Fix | Delete
* @param {String} text The text representation of the unit.
[256] Fix | Delete
* @param {int} line The line of text on which the unit resides.
[257] Fix | Delete
* @param {int} col The column of text on which the unit resides.
[258] Fix | Delete
*/
[259] Fix | Delete
function Combinator(text, line, col) {
[260] Fix | Delete
[261] Fix | Delete
SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);
[262] Fix | Delete
[263] Fix | Delete
/**
[264] Fix | Delete
* The type of modifier.
[265] Fix | Delete
* @type String
[266] Fix | Delete
* @property type
[267] Fix | Delete
*/
[268] Fix | Delete
this.type = "unknown";
[269] Fix | Delete
[270] Fix | Delete
//pretty simple
[271] Fix | Delete
if (/^\s+$/.test(text)) {
[272] Fix | Delete
this.type = "descendant";
[273] Fix | Delete
} else if (text === ">") {
[274] Fix | Delete
this.type = "child";
[275] Fix | Delete
} else if (text === "+") {
[276] Fix | Delete
this.type = "adjacent-sibling";
[277] Fix | Delete
} else if (text === "~") {
[278] Fix | Delete
this.type = "sibling";
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
Combinator.prototype = new SyntaxUnit();
[284] Fix | Delete
Combinator.prototype.constructor = Combinator;
[285] Fix | Delete
[286] Fix | Delete
[287] Fix | Delete
},{"../util/SyntaxUnit":26,"./Parser":6}],3:[function(require,module,exports){
[288] Fix | Delete
"use strict";
[289] Fix | Delete
[290] Fix | Delete
module.exports = Matcher;
[291] Fix | Delete
[292] Fix | Delete
var StringReader = require("../util/StringReader");
[293] Fix | Delete
var SyntaxError = require("../util/SyntaxError");
[294] Fix | Delete
[295] Fix | Delete
/**
[296] Fix | Delete
* This class implements a combinator library for matcher functions.
[297] Fix | Delete
* The combinators are described at:
[298] Fix | Delete
* https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax#Component_value_combinators
[299] Fix | Delete
*/
[300] Fix | Delete
function Matcher(matchFunc, toString) {
[301] Fix | Delete
this.match = function(expression) {
[302] Fix | Delete
// Save/restore marks to ensure that failed matches always restore
[303] Fix | Delete
// the original location in the expression.
[304] Fix | Delete
var result;
[305] Fix | Delete
expression.mark();
[306] Fix | Delete
result = matchFunc(expression);
[307] Fix | Delete
if (result) {
[308] Fix | Delete
expression.drop();
[309] Fix | Delete
} else {
[310] Fix | Delete
expression.restore();
[311] Fix | Delete
}
[312] Fix | Delete
return result;
[313] Fix | Delete
};
[314] Fix | Delete
this.toString = typeof toString === "function" ? toString : function() {
[315] Fix | Delete
return toString;
[316] Fix | Delete
};
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
/** Precedence table of combinators. */
[320] Fix | Delete
Matcher.prec = {
[321] Fix | Delete
MOD: 5,
[322] Fix | Delete
SEQ: 4,
[323] Fix | Delete
ANDAND: 3,
[324] Fix | Delete
OROR: 2,
[325] Fix | Delete
ALT: 1
[326] Fix | Delete
};
[327] Fix | Delete
[328] Fix | Delete
/** Simple recursive-descent grammar to build matchers from strings. */
[329] Fix | Delete
Matcher.parse = function(str) {
[330] Fix | Delete
var reader, eat, expr, oror, andand, seq, mod, term, result;
[331] Fix | Delete
reader = new StringReader(str);
[332] Fix | Delete
eat = function(matcher) {
[333] Fix | Delete
var result = reader.readMatch(matcher);
[334] Fix | Delete
if (result === null) {
[335] Fix | Delete
throw new SyntaxError(
[336] Fix | Delete
"Expected "+matcher, reader.getLine(), reader.getCol());
[337] Fix | Delete
}
[338] Fix | Delete
return result;
[339] Fix | Delete
};
[340] Fix | Delete
expr = function() {
[341] Fix | Delete
// expr = oror (" | " oror)*
[342] Fix | Delete
var m = [ oror() ];
[343] Fix | Delete
while (reader.readMatch(" | ") !== null) {
[344] Fix | Delete
m.push(oror());
[345] Fix | Delete
}
[346] Fix | Delete
return m.length === 1 ? m[0] : Matcher.alt.apply(Matcher, m);
[347] Fix | Delete
};
[348] Fix | Delete
oror = function() {
[349] Fix | Delete
// oror = andand ( " || " andand)*
[350] Fix | Delete
var m = [ andand() ];
[351] Fix | Delete
while (reader.readMatch(" || ") !== null) {
[352] Fix | Delete
m.push(andand());
[353] Fix | Delete
}
[354] Fix | Delete
return m.length === 1 ? m[0] : Matcher.oror.apply(Matcher, m);
[355] Fix | Delete
};
[356] Fix | Delete
andand = function() {
[357] Fix | Delete
// andand = seq ( " && " seq)*
[358] Fix | Delete
var m = [ seq() ];
[359] Fix | Delete
while (reader.readMatch(" && ") !== null) {
[360] Fix | Delete
m.push(seq());
[361] Fix | Delete
}
[362] Fix | Delete
return m.length === 1 ? m[0] : Matcher.andand.apply(Matcher, m);
[363] Fix | Delete
};
[364] Fix | Delete
seq = function() {
[365] Fix | Delete
// seq = mod ( " " mod)*
[366] Fix | Delete
var m = [ mod() ];
[367] Fix | Delete
while (reader.readMatch(/^ (?![&|\]])/) !== null) {
[368] Fix | Delete
m.push(mod());
[369] Fix | Delete
}
[370] Fix | Delete
return m.length === 1 ? m[0] : Matcher.seq.apply(Matcher, m);
[371] Fix | Delete
};
[372] Fix | Delete
mod = function() {
[373] Fix | Delete
// mod = term ( "?" | "*" | "+" | "#" | "{<num>,<num>}" )?
[374] Fix | Delete
var m = term();
[375] Fix | Delete
if (reader.readMatch("?") !== null) {
[376] Fix | Delete
return m.question();
[377] Fix | Delete
} else if (reader.readMatch("*") !== null) {
[378] Fix | Delete
return m.star();
[379] Fix | Delete
} else if (reader.readMatch("+") !== null) {
[380] Fix | Delete
return m.plus();
[381] Fix | Delete
} else if (reader.readMatch("#") !== null) {
[382] Fix | Delete
return m.hash();
[383] Fix | Delete
} else if (reader.readMatch(/^\{\s*/) !== null) {
[384] Fix | Delete
var min = eat(/^\d+/);
[385] Fix | Delete
eat(/^\s*,\s*/);
[386] Fix | Delete
var max = eat(/^\d+/);
[387] Fix | Delete
eat(/^\s*\}/);
[388] Fix | Delete
return m.braces(+min, +max);
[389] Fix | Delete
}
[390] Fix | Delete
return m;
[391] Fix | Delete
};
[392] Fix | Delete
term = function() {
[393] Fix | Delete
// term = <nt> | literal | "[ " expression " ]"
[394] Fix | Delete
if (reader.readMatch("[ ") !== null) {
[395] Fix | Delete
var m = expr();
[396] Fix | Delete
eat(" ]");
[397] Fix | Delete
return m;
[398] Fix | Delete
}
[399] Fix | Delete
return Matcher.fromType(eat(/^[^ ?*+#{]+/));
[400] Fix | Delete
};
[401] Fix | Delete
result = expr();
[402] Fix | Delete
if (!reader.eof()) {
[403] Fix | Delete
throw new SyntaxError(
[404] Fix | Delete
"Expected end of string", reader.getLine(), reader.getCol());
[405] Fix | Delete
}
[406] Fix | Delete
return result;
[407] Fix | Delete
};
[408] Fix | Delete
[409] Fix | Delete
/**
[410] Fix | Delete
* Convert a string to a matcher (parsing simple alternations),
[411] Fix | Delete
* or do nothing if the argument is already a matcher.
[412] Fix | Delete
*/
[413] Fix | Delete
Matcher.cast = function(m) {
[414] Fix | Delete
if (m instanceof Matcher) {
[415] Fix | Delete
return m;
[416] Fix | Delete
}
[417] Fix | Delete
return Matcher.parse(m);
[418] Fix | Delete
};
[419] Fix | Delete
[420] Fix | Delete
/**
[421] Fix | Delete
* Create a matcher for a single type.
[422] Fix | Delete
*/
[423] Fix | Delete
Matcher.fromType = function(type) {
[424] Fix | Delete
// Late require of ValidationTypes to break a dependency cycle.
[425] Fix | Delete
var ValidationTypes = require("./ValidationTypes");
[426] Fix | Delete
return new Matcher(function(expression) {
[427] Fix | Delete
return expression.hasNext() && ValidationTypes.isType(expression, type);
[428] Fix | Delete
}, type);
[429] Fix | Delete
};
[430] Fix | Delete
[431] Fix | Delete
/**
[432] Fix | Delete
* Create a matcher for one or more juxtaposed words, which all must
[433] Fix | Delete
* occur, in the given order.
[434] Fix | Delete
*/
[435] Fix | Delete
Matcher.seq = function() {
[436] Fix | Delete
var ms = Array.prototype.slice.call(arguments).map(Matcher.cast);
[437] Fix | Delete
if (ms.length === 1) {
[438] Fix | Delete
return ms[0];
[439] Fix | Delete
}
[440] Fix | Delete
return new Matcher(function(expression) {
[441] Fix | Delete
var i, result = true;
[442] Fix | Delete
for (i = 0; result && i < ms.length; i++) {
[443] Fix | Delete
result = ms[i].match(expression);
[444] Fix | Delete
}
[445] Fix | Delete
return result;
[446] Fix | Delete
}, function(prec) {
[447] Fix | Delete
var p = Matcher.prec.SEQ;
[448] Fix | Delete
var s = ms.map(function(m) {
[449] Fix | Delete
return m.toString(p);
[450] Fix | Delete
}).join(" ");
[451] Fix | Delete
if (prec > p) {
[452] Fix | Delete
s = "[ " + s + " ]";
[453] Fix | Delete
}
[454] Fix | Delete
return s;
[455] Fix | Delete
});
[456] Fix | Delete
};
[457] Fix | Delete
[458] Fix | Delete
/**
[459] Fix | Delete
* Create a matcher for one or more alternatives, where exactly one
[460] Fix | Delete
* must occur.
[461] Fix | Delete
*/
[462] Fix | Delete
Matcher.alt = function() {
[463] Fix | Delete
var ms = Array.prototype.slice.call(arguments).map(Matcher.cast);
[464] Fix | Delete
if (ms.length === 1) {
[465] Fix | Delete
return ms[0];
[466] Fix | Delete
}
[467] Fix | Delete
return new Matcher(function(expression) {
[468] Fix | Delete
var i, result = false;
[469] Fix | Delete
for (i = 0; !result && i < ms.length; i++) {
[470] Fix | Delete
result = ms[i].match(expression);
[471] Fix | Delete
}
[472] Fix | Delete
return result;
[473] Fix | Delete
}, function(prec) {
[474] Fix | Delete
var p = Matcher.prec.ALT;
[475] Fix | Delete
var s = ms.map(function(m) {
[476] Fix | Delete
return m.toString(p);
[477] Fix | Delete
}).join(" | ");
[478] Fix | Delete
if (prec > p) {
[479] Fix | Delete
s = "[ " + s + " ]";
[480] Fix | Delete
}
[481] Fix | Delete
return s;
[482] Fix | Delete
});
[483] Fix | Delete
};
[484] Fix | Delete
[485] Fix | Delete
/**
[486] Fix | Delete
* Create a matcher for two or more options. This implements the
[487] Fix | Delete
* double bar (||) and double ampersand (&&) operators, as well as
[488] Fix | Delete
* variants of && where some of the alternatives are optional.
[489] Fix | Delete
* This will backtrack through even successful matches to try to
[490] Fix | Delete
* maximize the number of items matched.
[491] Fix | Delete
*/
[492] Fix | Delete
Matcher.many = function(required) {
[493] Fix | Delete
var ms = Array.prototype.slice.call(arguments, 1).reduce(function(acc, v) {
[494] Fix | Delete
if (v.expand) {
[495] Fix | Delete
// Insert all of the options for the given complex rule as
[496] Fix | Delete
// individual options.
[497] Fix | Delete
var ValidationTypes = require("./ValidationTypes");
[498] Fix | Delete
acc.push.apply(acc, ValidationTypes.complex[v.expand].options);
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function