Commit 23ed8324 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov

delete

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68060 954022d7-b5bf-4e40-9824-e11837661b57
parent 063721c5
@ECHO OFF
set YUI_COMPRESSOR=com.yahoo.platform.yui.compressor.Bootstrap
SET XREGEXP_SRC_FOLDER=.\src
SET XREGEXP_INPUT_FILES=^
%XREGEXP_SRC_FOLDER%\xregexp.js ^
%XREGEXP_SRC_FOLDER%\addons\prototypes.js ^
%XREGEXP_SRC_FOLDER%\addons\matchrecursive.js ^
%XREGEXP_SRC_FOLDER%\addons\unicode\unicode-base.js ^
%XREGEXP_SRC_FOLDER%\addons\unicode\unicode-categories.js
SET XREGEXP_OUTPUT_FILE=".\xregexp-all-min.js"
if exist %XREGEXP_OUTPUT_FILE% (
DEL %XREGEXP_OUTPUT_FILE% /Q || exit /b 1
)
for %%i in (%XREGEXP_INPUT_FILES%) do (
java %YUI_COMPRESSOR% "%%~i" >> "%XREGEXP_OUTPUT_FILE%"
if errorlevel 1 (
echo CSS compression failed^^!
exit /b 1
)
)
ECHO Script finished successfuly!
pause
/*!
* XRegExp.build 3.0.0-pre
* <http://xregexp.com/>
* Steven Levithan 2012 MIT License
* Inspired by Lea Verou's RegExp.create <http://lea.verou.me/>
*/
(function(XRegExp) {
'use strict';
var REGEX_DATA = 'xregexp',
subParts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g,
parts = XRegExp.union([/\({{([\w$]+)}}\)|{{([\w$]+)}}/, subParts], 'g');
/**
* Strips a leading `^` and trailing unescaped `$`, if both are present.
* @private
* @param {String} pattern Pattern to process.
* @returns {String} Pattern with edge anchors removed.
*/
function deanchor(pattern) {
var startAnchor = /^(?:\(\?:\))*\^/, // Leading `^` or `(?:)^` (handles token cruft)
endAnchor = /\$(?:\(\?:\))*$/; // Trailing `$` or `$(?:)` (handles token cruft)
// Ensure that the trailing `$` isn't escaped
if (startAnchor.test(pattern) && endAnchor.test(pattern.replace(/\\[\s\S]/g, ''))) {
return pattern.replace(startAnchor, '').replace(endAnchor, '');
}
return pattern;
}
/**
* Converts the provided value to an XRegExp. Native RegExp flags are not preserved.
* @private
* @param {String|RegExp} value Value to convert.
* @returns {RegExp} XRegExp object with XRegExp syntax applied.
*/
function asXRegExp(value) {
return XRegExp.isRegExp(value) ?
(value[REGEX_DATA] && !value[REGEX_DATA].isNative ?
value : // No need to recompile
XRegExp(value.source) // Recompile native RegExp as XRegExp
) :
XRegExp(value); // Compile string as XRegExp
}
/**
* Builds regexes using named subpatterns, for readability and pattern reuse. Backreferences in the
* outer pattern and provided subpatterns are automatically renumbered to work correctly. Native
* flags used by provided subpatterns are ignored in favor of the `flags` argument.
* @memberOf XRegExp
* @param {String} pattern XRegExp pattern using `{{name}}` for embedded subpatterns. Allows
* `({{name}})` as shorthand for `(?<name>{{name}})`. Patterns cannot be embedded within
* character classes.
* @param {Object} subs Lookup object for named subpatterns. Values can be strings or regexes. A
* leading `^` and trailing unescaped `$` are stripped from subpatterns, if both are present.
* @param {String} [flags] Any combination of XRegExp flags.
* @returns {RegExp} Regex with interpolated subpatterns.
* @example
*
* var time = XRegExp.build('(?x)^ {{hours}} ({{minutes}}) $', {
* hours: XRegExp.build('{{h12}} : | {{h24}}', {
* h12: /1[0-2]|0?[1-9]/,
* h24: /2[0-3]|[01][0-9]/
* }, 'x'),
* minutes: /^[0-5][0-9]$/
* });
* time.test('10:59'); // -> true
* XRegExp.exec('10:59', time).minutes; // -> '59'
*/
XRegExp.build = function(pattern, subs, flags) {
var inlineFlags = /^\(\?([\w$]+)\)/.exec(pattern),
data = {},
numCaps = 0, // 'Caps' is short for captures
numPriorCaps,
numOuterCaps = 0,
outerCapsMap = [0],
outerCapNames,
sub,
p;
// Add flags within a leading mode modifier to the overall pattern's flags
if (inlineFlags) {
flags = flags || '';
inlineFlags[1].replace(/./g, function(flag) {
// Don't add duplicates
flags += (flags.indexOf(flag) > -1 ? '' : flag);
});
}
for (p in subs) {
if (subs.hasOwnProperty(p)) {
// Passing to XRegExp enables extended syntax and ensures independent validity,
// lest an unescaped `(`, `)`, `[`, or trailing `\` breaks the `(?:)` wrapper. For
// subpatterns provided as native regexes, it dies on octals and adds the property
// used to hold extended regex instance data, for simplicity
sub = asXRegExp(subs[p]);
data[p] = {
// Deanchoring allows embedding independently useful anchored regexes. If you
// really need to keep your anchors, double them (i.e., `^^...$$`)
pattern: deanchor(sub.source),
names: sub[REGEX_DATA].captureNames || []
};
}
}
// Passing to XRegExp dies on octals and ensures the outer pattern is independently valid;
// helps keep this simple. Named captures will be put back
pattern = asXRegExp(pattern);
outerCapNames = pattern[REGEX_DATA].captureNames || [];
pattern = pattern.source.replace(parts, function($0, $1, $2, $3, $4) {
var subName = $1 || $2, capName, intro;
// Named subpattern
if (subName) {
if (!data.hasOwnProperty(subName)) {
throw new ReferenceError('Undefined property ' + $0);
}
// Named subpattern was wrapped in a capturing group
if ($1) {
capName = outerCapNames[numOuterCaps];
outerCapsMap[++numOuterCaps] = ++numCaps;
// If it's a named group, preserve the name. Otherwise, use the subpattern name
// as the capture name
intro = '(?<' + (capName || subName) + '>';
} else {
intro = '(?:';
}
numPriorCaps = numCaps;
return intro + data[subName].pattern.replace(subParts, function(match, paren, backref) {
// Capturing group
if (paren) {
capName = data[subName].names[numCaps - numPriorCaps];
++numCaps;
// If the current capture has a name, preserve the name
if (capName) {
return '(?<' + capName + '>';
}
// Backreference
} else if (backref) {
// Rewrite the backreference
return '\\' + (+backref + numPriorCaps);
}
return match;
}) + ')';
}
// Capturing group
if ($3) {
capName = outerCapNames[numOuterCaps];
outerCapsMap[++numOuterCaps] = ++numCaps;
// If the current capture has a name, preserve the name
if (capName) {
return '(?<' + capName + '>';
}
// Backreference
} else if ($4) {
// Rewrite the backreference
return '\\' + outerCapsMap[+$4];
}
return $0;
});
return XRegExp(pattern, flags);
};
}(XRegExp));
/*!
* XRegExp.matchRecursive 3.0.0-pre
* <http://xregexp.com/>
* Steven Levithan 2009-2012 MIT License
*/
(function(XRegExp) {
'use strict';
/**
* Returns a match detail object composed of the provided values.
* @private
*/
function row(name, value, start, end) {
return {
name: name,
value: value,
start: start,
end: end
};
}
/**
* Returns an array of match strings between outermost left and right delimiters, or an array of
* objects with detailed match parts and position data. An error is thrown if delimiters are
* unbalanced within the data.
* @memberOf XRegExp
* @param {String} str String to search.
* @param {String} left Left delimiter as an XRegExp pattern.
* @param {String} right Right delimiter as an XRegExp pattern.
* @param {String} [flags] Any native or XRegExp flags, used for the left and right delimiters.
* @param {Object} [options] Lets you specify `valueNames` and `escapeChar` options.
* @returns {Array} Array of matches, or an empty array.
* @example
*
* // Basic usage
* var str = '(t((e))s)t()(ing)';
* XRegExp.matchRecursive(str, '\\(', '\\)', 'g');
* // -> ['t((e))s', '', 'ing']
*
* // Extended information mode with valueNames
* str = 'Here is <div> <div>an</div></div> example';
* XRegExp.matchRecursive(str, '<div\\s*>', '</div>', 'gi', {
* valueNames: ['between', 'left', 'match', 'right']
* });
* // -> [
* // {name: 'between', value: 'Here is ', start: 0, end: 8},
* // {name: 'left', value: '<div>', start: 8, end: 13},
* // {name: 'match', value: ' <div>an</div>', start: 13, end: 27},
* // {name: 'right', value: '</div>', start: 27, end: 33},
* // {name: 'between', value: ' example', start: 33, end: 41}
* // ]
*
* // Omitting unneeded parts with null valueNames, and using escapeChar
* str = '...{1}\\{{function(x,y){return y+x;}}';
* XRegExp.matchRecursive(str, '{', '}', 'g', {
* valueNames: ['literal', null, 'value', null],
* escapeChar: '\\'
* });
* // -> [
* // {name: 'literal', value: '...', start: 0, end: 3},
* // {name: 'value', value: '1', start: 4, end: 5},
* // {name: 'literal', value: '\\{', start: 6, end: 8},
* // {name: 'value', value: 'function(x,y){return y+x;}', start: 9, end: 35}
* // ]
*
* // Sticky mode via flag y
* str = '<1><<<2>>><3>4<5>';
* XRegExp.matchRecursive(str, '<', '>', 'gy');
* // -> ['1', '<<2>>', '3']
*/
XRegExp.matchRecursive = function(str, left, right, flags, options) {
flags = flags || '';
options = options || {};
var global = flags.indexOf('g') > -1,
sticky = flags.indexOf('y') > -1,
// Flag `y` is controlled internally
basicFlags = flags.replace(/y/g, ''),
escapeChar = options.escapeChar,
vN = options.valueNames,
output = [],
openTokens = 0,
delimStart = 0,
delimEnd = 0,
lastOuterEnd = 0,
outerStart,
innerStart,
leftMatch,
rightMatch,
esc;
left = XRegExp(left, basicFlags);
right = XRegExp(right, basicFlags);
if (escapeChar) {
if (escapeChar.length > 1) {
throw new Error('Cannot use more than one escape character');
}
escapeChar = XRegExp.escape(escapeChar);
// Using `XRegExp.union` safely rewrites backreferences in `left` and `right`
esc = new RegExp(
'(?:' + escapeChar + '[\\S\\s]|(?:(?!' +
XRegExp.union([left, right]).source +
')[^' + escapeChar + '])+)+',
// Flags `gy` not needed here
flags.replace(/[^im]+/g, '')
);
}
while (true) {
// If using an escape character, advance to the delimiter's next starting position,
// skipping any escaped characters in between
if (escapeChar) {
delimEnd += (XRegExp.exec(str, esc, delimEnd, 'sticky') || [''])[0].length;
}
leftMatch = XRegExp.exec(str, left, delimEnd);
rightMatch = XRegExp.exec(str, right, delimEnd);
// Keep the leftmost match only
if (leftMatch && rightMatch) {
if (leftMatch.index <= rightMatch.index) {
rightMatch = null;
} else {
leftMatch = null;
}
}
/* Paths (LM: leftMatch, RM: rightMatch, OT: openTokens):
* LM | RM | OT | Result
* 1 | 0 | 1 | loop
* 1 | 0 | 0 | loop
* 0 | 1 | 1 | loop
* 0 | 1 | 0 | throw
* 0 | 0 | 1 | throw
* 0 | 0 | 0 | break
* Doesn't include the sticky mode special case. The loop ends after the first
* completed match if not `global`.
*/
if (leftMatch || rightMatch) {
delimStart = (leftMatch || rightMatch).index;
delimEnd = delimStart + (leftMatch || rightMatch)[0].length;
} else if (!openTokens) {
break;
}
if (sticky && !openTokens && delimStart > lastOuterEnd) {
break;
}
if (leftMatch) {
if (!openTokens) {
outerStart = delimStart;
innerStart = delimEnd;
}
++openTokens;
} else if (rightMatch && openTokens) {
if (!--openTokens) {
if (vN) {
if (vN[0] && outerStart > lastOuterEnd) {
output.push(row(vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart));
}
if (vN[1]) {
output.push(row(vN[1], str.slice(outerStart, innerStart), outerStart, innerStart));
}
if (vN[2]) {
output.push(row(vN[2], str.slice(innerStart, delimStart), innerStart, delimStart));
}
if (vN[3]) {
output.push(row(vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd));
}
} else {
output.push(str.slice(innerStart, delimStart));
}
lastOuterEnd = delimEnd;
if (!global) {
break;
}
}
} else {
throw new Error('Unbalanced delimiter found in string');
}
// If the delimiter matched an empty string, avoid an infinite loop
if (delimStart === delimEnd) {
++delimEnd;
}
}
if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd) {
output.push(row(vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length));
}
return output;
};
}(XRegExp));
/*!
* XRegExp Prototypes 3.0.0-pre
* <http://xregexp.com/>
* Steven Levithan 2012 MIT License
*/
/**
* Adds a collection of methods to `XRegExp.prototype`. RegExp objects copied by XRegExp are also
* augmented with any `XRegExp.prototype` methods. Hence, the following work equivalently:
*
* XRegExp('[a-z]', 'ig').xexec('abc');
* XRegExp(/[a-z]/ig).xexec('abc');
* XRegExp.globalize(/[a-z]/i).xexec('abc');
*/
(function(XRegExp) {
'use strict';
// Shortcut
var proto = XRegExp.prototype;
/**
* Implicitly calls the regex's `test` method with the first value in the provided `args` array.
* @memberOf XRegExp.prototype
* @param {*} context Ignored. Accepted only for congruity with `Function.prototype.apply`.
* @param {Array} args Array with the string to search as its first value.
* @returns {Boolean} Whether the regex matched the provided value.
* @example
*
* XRegExp('[a-z]').apply(null, ['abc']); // -> true
*/
proto.apply = function(context, args) {
return this.test(args[0]);
};
/**
* Implicitly calls the regex's `test` method with the provided string.
* @memberOf XRegExp.prototype
* @param {*} context Ignored. Accepted only for congruity with `Function.prototype.call`.
* @param {String} str String to search.
* @returns {Boolean} Whether the regex matched the provided value.
* @example
*
* XRegExp('[a-z]').call(null, 'abc'); // -> true
*/
proto.call = function(context, str) {
return this.test(str);
};
/**
* Implicitly calls {@link #XRegExp.forEach}.
* @memberOf XRegExp.prototype
* @example
*
* XRegExp('\\d').forEach('1a2345', function(match, i) {
* if (i % 2) this.push(+match[0]);
* }, []);
* // -> [2, 4]
*/
proto.forEach = function(str, callback, context) {
return XRegExp.forEach(str, this, callback, context);
};
/**
* Implicitly calls {@link #XRegExp.globalize}.
* @memberOf XRegExp.prototype
* @example
*
* var globalCopy = XRegExp('regex').globalize();
* globalCopy.global; // -> true
*/
proto.globalize = function() {
return XRegExp.globalize(this);
};
/**
* Implicitly calls {@link #XRegExp.match}.
* @memberOf XRegExp.prototype
* @example
*
* XRegExp('\\d').match('1a23', 'all');
* // -> ['1', '2', '3']
*/
proto.match = function(str, scope) {
return XRegExp.match(str, this, scope);
};
/**
* Implicitly calls {@link #XRegExp.exec}.
* @memberOf XRegExp.prototype
* @example
*
* var match = XRegExp('U\\+(?<hex>[0-9A-F]{4})').xexec('U+2620');
* match.hex; // -> '2620'
*/
proto.xexec = function(str, pos, sticky) {
return XRegExp.exec(str, this, pos, sticky);
};
/**
* Implicitly calls {@link #XRegExp.test}.
* @memberOf XRegExp.prototype
* @example
*
* XRegExp('c').xtest('abc'); // -> true
*/
proto.xtest = function(str, pos, sticky) {
return XRegExp.test(str, this, pos, sticky);
};
}(XRegExp));
/*!
* XRegExp BackCompat 3.0.0-pre
* <http://xregexp.com/>
* Steven Levithan 2012 MIT License
*/
/**
* Provides backward compatibility with XRegExp 1.x-2.x.
*/
(function(XRegExp) {
'use strict';
var REGEX_DATA = 'xregexp',
install = XRegExp.install,
uninstall = XRegExp.uninstall;
/**
* XRegExp 3.0.0 removed the 'all' shortcut.
*/
XRegExp.install = function(options) {
install(options === 'all' ? 'natives' : options);
};
/**
* XRegExp 3.0.0 removed the 'all' shortcut.
*/
XRegExp.uninstall = function(options) {
uninstall(options === 'all' ? 'natives' : options);
};
/**
* XRegExp 2.0.0 stopped overriding native methods by default.
*/
XRegExp.install('natives');
/**
* @deprecated As of XRegExp 2.0.0. Replaced by {@link #XRegExp.globalize}.
*/
XRegExp.copyAsGlobal = XRegExp.globalize;
/**
* @deprecated As of XRegExp 2.0.0. Replaced by {@link #XRegExp.exec}.
*/
XRegExp.execAt = XRegExp.exec;
/**
* @deprecated As of XRegExp 2.0.0. Replaced by {@link #XRegExp.forEach}.
*/
XRegExp.iterate = XRegExp.forEach;
/**
* @deprecated As of XRegExp 2.0.0. No replacement.
*/
XRegExp.freezeTokens = function() {
XRegExp.addToken = function() {
throw new Error('Cannot run addToken after freezeTokens');
};
};
/**
* @deprecated As of XRegExp 2.0.0. Replaced by {@link #XRegExp.prototype.apply} in addon.
*/
RegExp.prototype.apply = function(context, args) {
return this.test(args[0]);
};
/**
* @deprecated As of XRegExp 2.0.0. Replaced by {@link #XRegExp.prototype.call} in addon.
*/
RegExp.prototype.call = function(context, str) {
return this.test(str);
};
/**
* @deprecated As of XRegExp 1.5.0. Replaced by {@link #XRegExp.matchChain}.
*/
XRegExp.matchWithinChain = XRegExp.matchChain;
/**
* @deprecated As of XRegExp 1.5.0. No replacement.
*/
RegExp.prototype.addFlags = function(flags) {
var regex = XRegExp(
this.source,
/\/([a-z]*)$/i.exec(String(this))[1] + (flags || '')
),
captureNames = this[REGEX_DATA] ? this[REGEX_DATA].captureNames : null;
regex[REGEX_DATA] = {
captureNames: captureNames ? captureNames.slice(0) : null,
isNative: false // Always passed through `XRegExp`
};
return regex;
};
/**
* @deprecated As of XRegExp 1.5.0. No replacement.
*/
RegExp.prototype.forEachExec = function(str, callback, context) {
XRegExp.forEach(str, this, callback, context);
};
/**
* @deprecated As of XRegExp 1.5.0. No replacement.
*/
RegExp.prototype.validate = function(str) {
var regex = new RegExp(
'^(?:' + this.source + ')$(?!\\s)',
/\/([a-z]*)$/i.exec(String(this))[1]
);
if (this.global) {
this.lastIndex = 0;
}
return str.search(regex) === 0;
};
/**
* @deprecated As of XRegExp 1.2.0. No replacement.
*/
RegExp.prototype.execAll = function(str) {
return XRegExp.forEach(str, this, function(match) {
this.push(match);
}, []);
};
}(XRegExp));
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment