update worker dependencies
This commit is contained in:
parent
5c0c33f470
commit
ec524419ce
9 changed files with 2703 additions and 1820 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
/**
|
||||
* Copyright (c) 2009-2012 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
@ -24,9 +24,9 @@
|
|||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
// Generated by CoffeeScript 1.2.1-pre
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
|
||||
var extend, flatten;
|
||||
var extend, flatten, _ref;
|
||||
|
||||
exports.starts = function(string, literal, start) {
|
||||
return literal === string.substr(start, literal.length);
|
||||
|
|
@ -43,7 +43,9 @@ define(function(require, exports, module) {
|
|||
_results = [];
|
||||
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
||||
item = array[_i];
|
||||
if (item) _results.push(item);
|
||||
if (item) {
|
||||
_results.push(item);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
|
@ -51,7 +53,9 @@ define(function(require, exports, module) {
|
|||
exports.count = function(string, substr) {
|
||||
var num, pos;
|
||||
num = pos = 0;
|
||||
if (!substr.length) return 1 / 0;
|
||||
if (!substr.length) {
|
||||
return 1 / 0;
|
||||
}
|
||||
while (pos = 1 + string.indexOf(substr, pos)) {
|
||||
num++;
|
||||
}
|
||||
|
|
@ -96,5 +100,16 @@ define(function(require, exports, module) {
|
|||
return array[array.length - (back || 0) - 1];
|
||||
};
|
||||
|
||||
exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
|
||||
var e, _i, _len;
|
||||
for (_i = 0, _len = this.length; _i < _len; _i++) {
|
||||
e = this[_i];
|
||||
if (fn(e)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
/**
|
||||
* Copyright (c) 2009-2012 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
// Generated by CoffeeScript 1.2.1-pre
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
|
||||
var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1,
|
||||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
|
@ -35,14 +35,16 @@ define(function(require, exports, module) {
|
|||
|
||||
exports.Lexer = Lexer = (function() {
|
||||
|
||||
Lexer.name = 'Lexer';
|
||||
|
||||
function Lexer() {}
|
||||
|
||||
Lexer.prototype.tokenize = function(code, opts) {
|
||||
var i, tag;
|
||||
if (opts == null) opts = {};
|
||||
if (WHITESPACE.test(code)) code = "\n" + code;
|
||||
if (opts == null) {
|
||||
opts = {};
|
||||
}
|
||||
if (WHITESPACE.test(code)) {
|
||||
code = "\n" + code;
|
||||
}
|
||||
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
|
||||
this.code = code;
|
||||
this.line = opts.line || 0;
|
||||
|
|
@ -57,14 +59,20 @@ define(function(require, exports, module) {
|
|||
i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
|
||||
}
|
||||
this.closeIndentation();
|
||||
if (tag = this.ends.pop()) this.error("missing " + tag);
|
||||
if (opts.rewrite === false) return this.tokens;
|
||||
if (tag = this.ends.pop()) {
|
||||
this.error("missing " + tag);
|
||||
}
|
||||
if (opts.rewrite === false) {
|
||||
return this.tokens;
|
||||
}
|
||||
return (new Rewriter).rewrite(this.tokens);
|
||||
};
|
||||
|
||||
Lexer.prototype.identifierToken = function() {
|
||||
var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3;
|
||||
if (!(match = IDENTIFIER.exec(this.chunk))) return 0;
|
||||
if (!(match = IDENTIFIER.exec(this.chunk))) {
|
||||
return 0;
|
||||
}
|
||||
input = match[0], id = match[1], colon = match[2];
|
||||
if (id === 'own' && this.tag() === 'FOR') {
|
||||
this.token('OWN', id);
|
||||
|
|
@ -105,7 +113,9 @@ define(function(require, exports, module) {
|
|||
}
|
||||
}
|
||||
if (!forcedIdentifier) {
|
||||
if (__indexOf.call(COFFEE_ALIASES, id) >= 0) id = COFFEE_ALIAS_MAP[id];
|
||||
if (__indexOf.call(COFFEE_ALIASES, id) >= 0) {
|
||||
id = COFFEE_ALIAS_MAP[id];
|
||||
}
|
||||
tag = (function() {
|
||||
switch (id) {
|
||||
case '!':
|
||||
|
|
@ -118,8 +128,6 @@ define(function(require, exports, module) {
|
|||
return 'LOGIC';
|
||||
case 'true':
|
||||
case 'false':
|
||||
case 'null':
|
||||
case 'undefined':
|
||||
return 'BOOL';
|
||||
case 'break':
|
||||
case 'continue':
|
||||
|
|
@ -130,29 +138,33 @@ define(function(require, exports, module) {
|
|||
})();
|
||||
}
|
||||
this.token(tag, id);
|
||||
if (colon) this.token(':', ':');
|
||||
if (colon) {
|
||||
this.token(':', ':');
|
||||
}
|
||||
return input.length;
|
||||
};
|
||||
|
||||
Lexer.prototype.numberToken = function() {
|
||||
var binaryLiteral, lexedLength, match, number, octalLiteral;
|
||||
if (!(match = NUMBER.exec(this.chunk))) return 0;
|
||||
if (!(match = NUMBER.exec(this.chunk))) {
|
||||
return 0;
|
||||
}
|
||||
number = match[0];
|
||||
if (/E/.test(number)) {
|
||||
this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
|
||||
} else if (/[BOX]/.test(number)) {
|
||||
if (/^0[BOX]/.test(number)) {
|
||||
this.error("radix prefix '" + number + "' must be lowercase");
|
||||
} else if (/^0[89]/.test(number)) {
|
||||
} else if (/E/.test(number) && !/^0x/.test(number)) {
|
||||
this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
|
||||
} else if (/^0\d*[89]/.test(number)) {
|
||||
this.error("decimal literal '" + number + "' must not be prefixed with '0'");
|
||||
} else if (/^0[0-7]/.test(number)) {
|
||||
} else if (/^0\d+/.test(number)) {
|
||||
this.error("octal literal '" + number + "' must be prefixed with '0o'");
|
||||
}
|
||||
lexedLength = number.length;
|
||||
if (octalLiteral = /0o([0-7]+)/.exec(number)) {
|
||||
number = (parseInt(octalLiteral[1], 8)).toString();
|
||||
if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
|
||||
number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16);
|
||||
}
|
||||
if (binaryLiteral = /0b([01]+)/.exec(number)) {
|
||||
number = (parseInt(binaryLiteral[1], 2)).toString();
|
||||
if (binaryLiteral = /^0b([01]+)/.exec(number)) {
|
||||
number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16);
|
||||
}
|
||||
this.token('NUMBER', number);
|
||||
return lexedLength;
|
||||
|
|
@ -162,11 +174,15 @@ define(function(require, exports, module) {
|
|||
var match, octalEsc, string;
|
||||
switch (this.chunk.charAt(0)) {
|
||||
case "'":
|
||||
if (!(match = SIMPLESTR.exec(this.chunk))) return 0;
|
||||
if (!(match = SIMPLESTR.exec(this.chunk))) {
|
||||
return 0;
|
||||
}
|
||||
this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n'));
|
||||
break;
|
||||
case '"':
|
||||
if (!(string = this.balancedString(this.chunk, '"'))) return 0;
|
||||
if (!(string = this.balancedString(this.chunk, '"'))) {
|
||||
return 0;
|
||||
}
|
||||
if (0 < string.indexOf('#{', 1)) {
|
||||
this.interpolateString(string.slice(1, -1));
|
||||
} else {
|
||||
|
|
@ -176,7 +192,7 @@ define(function(require, exports, module) {
|
|||
default:
|
||||
return 0;
|
||||
}
|
||||
if (octalEsc = /^(?:\\.|[^\\])*\\[0-7]/.test(string)) {
|
||||
if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) {
|
||||
this.error("octal escape sequences " + string + " are not allowed");
|
||||
}
|
||||
this.line += count(string, '\n');
|
||||
|
|
@ -185,7 +201,9 @@ define(function(require, exports, module) {
|
|||
|
||||
Lexer.prototype.heredocToken = function() {
|
||||
var doc, heredoc, match, quote;
|
||||
if (!(match = HEREDOC.exec(this.chunk))) return 0;
|
||||
if (!(match = HEREDOC.exec(this.chunk))) {
|
||||
return 0;
|
||||
}
|
||||
heredoc = match[0];
|
||||
quote = heredoc.charAt(0);
|
||||
doc = this.sanitizeHeredoc(match[2], {
|
||||
|
|
@ -205,7 +223,9 @@ define(function(require, exports, module) {
|
|||
|
||||
Lexer.prototype.commentToken = function() {
|
||||
var comment, here, match;
|
||||
if (!(match = this.chunk.match(COMMENT))) return 0;
|
||||
if (!(match = this.chunk.match(COMMENT))) {
|
||||
return 0;
|
||||
}
|
||||
comment = match[0], here = match[1];
|
||||
if (here) {
|
||||
this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
|
||||
|
|
@ -223,12 +243,15 @@ define(function(require, exports, module) {
|
|||
return 0;
|
||||
}
|
||||
this.token('JS', (script = match[0]).slice(1, -1));
|
||||
this.line += count(script, '\n');
|
||||
return script.length;
|
||||
};
|
||||
|
||||
Lexer.prototype.regexToken = function() {
|
||||
var flags, length, match, prev, regex, _ref2, _ref3;
|
||||
if (this.chunk.charAt(0) !== '/') return 0;
|
||||
if (this.chunk.charAt(0) !== '/') {
|
||||
return 0;
|
||||
}
|
||||
if (match = HEREGEX.exec(this.chunk)) {
|
||||
length = this.heregexToken(match);
|
||||
this.line += count(match[0], '\n');
|
||||
|
|
@ -238,12 +261,16 @@ define(function(require, exports, module) {
|
|||
if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) {
|
||||
return 0;
|
||||
}
|
||||
if (!(match = REGEX.exec(this.chunk))) return 0;
|
||||
if (!(match = REGEX.exec(this.chunk))) {
|
||||
return 0;
|
||||
}
|
||||
_ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2];
|
||||
if (regex.slice(0, 2) === '/*') {
|
||||
this.error('regular expressions cannot begin with `*`');
|
||||
}
|
||||
if (regex === '//') regex = '/(?:)/';
|
||||
if (regex === '//') {
|
||||
regex = '/(?:)/';
|
||||
}
|
||||
this.token('REGEX', "" + regex + flags);
|
||||
return match.length;
|
||||
};
|
||||
|
|
@ -270,7 +297,9 @@ define(function(require, exports, module) {
|
|||
if (tag === 'TOKENS') {
|
||||
tokens.push.apply(tokens, value);
|
||||
} else {
|
||||
if (!(value = value.replace(HEREGEX_OMIT, ''))) continue;
|
||||
if (!(value = value.replace(HEREGEX_OMIT, ''))) {
|
||||
continue;
|
||||
}
|
||||
value = value.replace(/\\/g, '\\\\');
|
||||
tokens.push(['STRING', this.makeString(value, '"', true)]);
|
||||
}
|
||||
|
|
@ -281,18 +310,21 @@ define(function(require, exports, module) {
|
|||
this.tokens.push(['STRING', '""'], ['+', '+']);
|
||||
}
|
||||
(_ref5 = this.tokens).push.apply(_ref5, tokens);
|
||||
if (flags) this.tokens.push([',', ','], ['STRING', '"' + flags + '"']);
|
||||
if (flags) {
|
||||
this.tokens.push([',', ','], ['STRING', '"' + flags + '"']);
|
||||
}
|
||||
this.token(')', ')');
|
||||
return heregex.length;
|
||||
};
|
||||
|
||||
Lexer.prototype.lineToken = function() {
|
||||
var diff, indent, match, noNewlines, prev, size;
|
||||
if (!(match = MULTI_DENT.exec(this.chunk))) return 0;
|
||||
var diff, indent, match, noNewlines, size;
|
||||
if (!(match = MULTI_DENT.exec(this.chunk))) {
|
||||
return 0;
|
||||
}
|
||||
indent = match[0];
|
||||
this.line += count(indent, '\n');
|
||||
this.seenFor = false;
|
||||
prev = last(this.tokens, 1);
|
||||
size = indent.length - 1 - indent.lastIndexOf('\n');
|
||||
noNewlines = this.unfinished();
|
||||
if (size - this.indebt === this.indent) {
|
||||
|
|
@ -342,7 +374,9 @@ define(function(require, exports, module) {
|
|||
this.token('OUTDENT', dent);
|
||||
}
|
||||
}
|
||||
if (dent) this.outdebt -= moveOut;
|
||||
if (dent) {
|
||||
this.outdebt -= moveOut;
|
||||
}
|
||||
while (this.value() === ';') {
|
||||
this.tokens.pop();
|
||||
}
|
||||
|
|
@ -358,7 +392,9 @@ define(function(require, exports, module) {
|
|||
return 0;
|
||||
}
|
||||
prev = last(this.tokens);
|
||||
if (prev) prev[match ? 'spaced' : 'newLine'] = true;
|
||||
if (prev) {
|
||||
prev[match ? 'spaced' : 'newLine'] = true;
|
||||
}
|
||||
if (match) {
|
||||
return match[0].length;
|
||||
} else {
|
||||
|
|
@ -370,12 +406,16 @@ define(function(require, exports, module) {
|
|||
while (this.value() === ';') {
|
||||
this.tokens.pop();
|
||||
}
|
||||
if (this.tag() !== 'TERMINATOR') this.token('TERMINATOR', '\n');
|
||||
if (this.tag() !== 'TERMINATOR') {
|
||||
this.token('TERMINATOR', '\n');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Lexer.prototype.suppressNewlines = function() {
|
||||
if (this.value() === '\\') this.tokens.pop();
|
||||
if (this.value() === '\\') {
|
||||
this.tokens.pop();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
|
|
@ -383,7 +423,9 @@ define(function(require, exports, module) {
|
|||
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
|
||||
if (match = OPERATOR.exec(this.chunk)) {
|
||||
value = match[0];
|
||||
if (CODE.test(value)) this.tagParameters();
|
||||
if (CODE.test(value)) {
|
||||
this.tagParameters();
|
||||
}
|
||||
} else {
|
||||
value = this.chunk.charAt(0);
|
||||
}
|
||||
|
|
@ -416,7 +458,9 @@ define(function(require, exports, module) {
|
|||
tag = 'LOGIC';
|
||||
} else if (prev && !prev.spaced) {
|
||||
if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) {
|
||||
if (prev[0] === '?') prev[0] = 'FUNC_EXIST';
|
||||
if (prev[0] === '?') {
|
||||
prev[0] = 'FUNC_EXIST';
|
||||
}
|
||||
tag = 'CALL_START';
|
||||
} else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) {
|
||||
tag = 'INDEX_START';
|
||||
|
|
@ -448,7 +492,9 @@ define(function(require, exports, module) {
|
|||
if (HEREDOC_ILLEGAL.test(doc)) {
|
||||
this.error("block comment cannot contain \"*/\", starting");
|
||||
}
|
||||
if (doc.indexOf('\n') <= 0) return doc;
|
||||
if (doc.indexOf('\n') <= 0) {
|
||||
return doc;
|
||||
}
|
||||
} else {
|
||||
while (match = HEREDOC_INDENT.exec(doc)) {
|
||||
attempt = match[1];
|
||||
|
|
@ -457,14 +503,20 @@ define(function(require, exports, module) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (indent) doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
|
||||
if (!herecomment) doc = doc.replace(/^\n/, '');
|
||||
if (indent) {
|
||||
doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
|
||||
}
|
||||
if (!herecomment) {
|
||||
doc = doc.replace(/^\n/, '');
|
||||
}
|
||||
return doc;
|
||||
};
|
||||
|
||||
Lexer.prototype.tagParameters = function() {
|
||||
var i, stack, tok, tokens;
|
||||
if (this.tag() !== ')') return this;
|
||||
if (this.tag() !== ')') {
|
||||
return this;
|
||||
}
|
||||
stack = [];
|
||||
tokens = this.tokens;
|
||||
i = tokens.length;
|
||||
|
|
@ -508,7 +560,9 @@ define(function(require, exports, module) {
|
|||
continue;
|
||||
case end:
|
||||
stack.pop();
|
||||
if (!stack.length) return str.slice(0, i + 1 || 9e9);
|
||||
if (!stack.length) {
|
||||
return str.slice(0, +i + 1 || 9e9);
|
||||
}
|
||||
end = stack[stack.length - 1];
|
||||
continue;
|
||||
}
|
||||
|
|
@ -528,7 +582,9 @@ define(function(require, exports, module) {
|
|||
|
||||
Lexer.prototype.interpolateString = function(str, options) {
|
||||
var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4;
|
||||
if (options == null) options = {};
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
heredoc = options.heredoc, regex = options.regex;
|
||||
tokens = [];
|
||||
pi = 0;
|
||||
|
|
@ -541,7 +597,9 @@ define(function(require, exports, module) {
|
|||
if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) {
|
||||
continue;
|
||||
}
|
||||
if (pi < i) tokens.push(['NEOSTRING', str.slice(pi, i)]);
|
||||
if (pi < i) {
|
||||
tokens.push(['NEOSTRING', str.slice(pi, i)]);
|
||||
}
|
||||
inner = expr.slice(1, -1);
|
||||
if (inner.length) {
|
||||
nested = new Lexer().tokenize(inner, {
|
||||
|
|
@ -563,28 +621,44 @@ define(function(require, exports, module) {
|
|||
i += expr.length;
|
||||
pi = i + 1;
|
||||
}
|
||||
if ((i > pi && pi < str.length)) tokens.push(['NEOSTRING', str.slice(pi)]);
|
||||
if (regex) return tokens;
|
||||
if (!tokens.length) return this.token('STRING', '""');
|
||||
if (tokens[0][0] !== 'NEOSTRING') tokens.unshift(['', '']);
|
||||
if (interpolated = tokens.length > 1) this.token('(', '(');
|
||||
if ((i > pi && pi < str.length)) {
|
||||
tokens.push(['NEOSTRING', str.slice(pi)]);
|
||||
}
|
||||
if (regex) {
|
||||
return tokens;
|
||||
}
|
||||
if (!tokens.length) {
|
||||
return this.token('STRING', '""');
|
||||
}
|
||||
if (tokens[0][0] !== 'NEOSTRING') {
|
||||
tokens.unshift(['', '']);
|
||||
}
|
||||
if (interpolated = tokens.length > 1) {
|
||||
this.token('(', '(');
|
||||
}
|
||||
for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) {
|
||||
_ref3 = tokens[i], tag = _ref3[0], value = _ref3[1];
|
||||
if (i) this.token('+', '+');
|
||||
if (i) {
|
||||
this.token('+', '+');
|
||||
}
|
||||
if (tag === 'TOKENS') {
|
||||
(_ref4 = this.tokens).push.apply(_ref4, value);
|
||||
} else {
|
||||
this.token('STRING', this.makeString(value, '"', heredoc));
|
||||
}
|
||||
}
|
||||
if (interpolated) this.token(')', ')');
|
||||
if (interpolated) {
|
||||
this.token(')', ')');
|
||||
}
|
||||
return tokens;
|
||||
};
|
||||
|
||||
Lexer.prototype.pair = function(tag) {
|
||||
var size, wanted;
|
||||
if (tag !== (wanted = last(this.ends))) {
|
||||
if ('OUTDENT' !== wanted) this.error("unmatched " + tag);
|
||||
if ('OUTDENT' !== wanted) {
|
||||
this.error("unmatched " + tag);
|
||||
}
|
||||
this.indent -= size = last(this.indents);
|
||||
this.outdentToken(size, true);
|
||||
return this.pair(tag);
|
||||
|
|
@ -616,7 +690,9 @@ define(function(require, exports, module) {
|
|||
};
|
||||
|
||||
Lexer.prototype.makeString = function(body, quote, heredoc) {
|
||||
if (!body) return quote + quote;
|
||||
if (!body) {
|
||||
return quote + quote;
|
||||
}
|
||||
body = body.replace(/\\([\s\S])/g, function(match, contents) {
|
||||
if (contents === '\n' || contents === quote) {
|
||||
return contents;
|
||||
|
|
@ -663,7 +739,7 @@ define(function(require, exports, module) {
|
|||
|
||||
COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES);
|
||||
|
||||
RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield'];
|
||||
RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield'];
|
||||
|
||||
STRICT_PROSCRIBED = ['arguments', 'eval'];
|
||||
|
||||
|
|
@ -723,17 +799,17 @@ define(function(require, exports, module) {
|
|||
|
||||
RELATION = ['IN', 'OF', 'INSTANCEOF'];
|
||||
|
||||
BOOL = ['TRUE', 'FALSE', 'NULL', 'UNDEFINED'];
|
||||
BOOL = ['TRUE', 'FALSE'];
|
||||
|
||||
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', '++', '--', ']'];
|
||||
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']'];
|
||||
|
||||
NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING');
|
||||
|
||||
CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
|
||||
|
||||
INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL');
|
||||
INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED');
|
||||
|
||||
LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR'];
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
/**
|
||||
* Copyright (c) 2009-2012 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
// Generated by CoffeeScript 1.2.1-pre
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
|
||||
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref,
|
||||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
||||
|
|
@ -32,8 +32,6 @@ define(function(require, exports, module) {
|
|||
|
||||
exports.Rewriter = (function() {
|
||||
|
||||
Rewriter.name = 'Rewriter';
|
||||
|
||||
function Rewriter() {}
|
||||
|
||||
Rewriter.prototype.rewrite = function(tokens) {
|
||||
|
|
@ -67,7 +65,9 @@ define(function(require, exports, module) {
|
|||
if (levels === 0 && condition.call(this, token, i)) {
|
||||
return action.call(this, token, i);
|
||||
}
|
||||
if (!token || levels < 0) return action.call(this, token, i - 1);
|
||||
if (!token || levels < 0) {
|
||||
return action.call(this, token, i - 1);
|
||||
}
|
||||
if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
|
||||
levels += 1;
|
||||
} else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) {
|
||||
|
|
@ -83,9 +83,13 @@ define(function(require, exports, module) {
|
|||
_ref = this.tokens;
|
||||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
||||
tag = _ref[i][0];
|
||||
if (tag !== 'TERMINATOR') break;
|
||||
if (tag !== 'TERMINATOR') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i) {
|
||||
return this.tokens.splice(0, i);
|
||||
}
|
||||
if (i) return this.tokens.splice(0, i);
|
||||
};
|
||||
|
||||
Rewriter.prototype.removeMidExpressionNewlines = function() {
|
||||
|
|
@ -109,7 +113,9 @@ define(function(require, exports, module) {
|
|||
return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
|
||||
};
|
||||
return this.scanTokens(function(token, i) {
|
||||
if (token[0] === 'CALL_START') this.detectEnd(i + 1, condition, action);
|
||||
if (token[0] === 'CALL_START') {
|
||||
this.detectEnd(i + 1, condition, action);
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
};
|
||||
|
|
@ -124,25 +130,32 @@ define(function(require, exports, module) {
|
|||
return token[0] = 'INDEX_END';
|
||||
};
|
||||
return this.scanTokens(function(token, i) {
|
||||
if (token[0] === 'INDEX_START') this.detectEnd(i + 1, condition, action);
|
||||
if (token[0] === 'INDEX_START') {
|
||||
this.detectEnd(i + 1, condition, action);
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
};
|
||||
|
||||
Rewriter.prototype.addImplicitBraces = function() {
|
||||
var action, condition, sameLine, stack, start, startIndent, startsLine;
|
||||
var action, condition, sameLine, stack, start, startIndent, startIndex, startsLine;
|
||||
stack = [];
|
||||
start = null;
|
||||
startsLine = null;
|
||||
sameLine = true;
|
||||
startIndent = 0;
|
||||
startIndex = 0;
|
||||
condition = function(token, i) {
|
||||
var one, tag, three, two, _ref, _ref1;
|
||||
_ref = this.tokens.slice(i + 1, (i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
|
||||
if ('HERECOMMENT' === (one != null ? one[0] : void 0)) return false;
|
||||
_ref = this.tokens.slice(i + 1, +(i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
|
||||
if ('HERECOMMENT' === (one != null ? one[0] : void 0)) {
|
||||
return false;
|
||||
}
|
||||
tag = token[0];
|
||||
if (__indexOf.call(LINEBREAKS, tag) >= 0) sameLine = false;
|
||||
return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine)) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT'));
|
||||
if (__indexOf.call(LINEBREAKS, tag) >= 0) {
|
||||
sameLine = false;
|
||||
}
|
||||
return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine && !(i - startIndex === 1))) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT'));
|
||||
};
|
||||
action = function(token, i) {
|
||||
var tok;
|
||||
|
|
@ -163,6 +176,7 @@ define(function(require, exports, module) {
|
|||
return 1;
|
||||
}
|
||||
sameLine = true;
|
||||
startIndex = i + 1;
|
||||
stack.push(['{']);
|
||||
idx = ago === '@' ? i - 2 : i - 1;
|
||||
while (this.tag(idx - 2) === 'HERECOMMENT') {
|
||||
|
|
@ -185,7 +199,9 @@ define(function(require, exports, module) {
|
|||
condition = function(token, i) {
|
||||
var post, tag, _ref, _ref1;
|
||||
tag = token[0];
|
||||
if (!seenSingle && token.fromThen) return true;
|
||||
if (!seenSingle && token.fromThen) {
|
||||
return true;
|
||||
}
|
||||
if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') {
|
||||
seenSingle = true;
|
||||
}
|
||||
|
|
@ -206,19 +222,27 @@ define(function(require, exports, module) {
|
|||
if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') {
|
||||
noCall = true;
|
||||
}
|
||||
_ref = tokens.slice(i - 1, (i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
|
||||
_ref = tokens.slice(i - 1, +(i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
|
||||
callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0);
|
||||
seenSingle = false;
|
||||
seenControl = false;
|
||||
if (__indexOf.call(LINEBREAKS, tag) >= 0) noCall = false;
|
||||
if (prev && !prev.spaced && tag === '?') token.call = true;
|
||||
if (token.fromThen) return 1;
|
||||
if (__indexOf.call(LINEBREAKS, tag) >= 0) {
|
||||
noCall = false;
|
||||
}
|
||||
if (prev && !prev.spaced && tag === '?') {
|
||||
token.call = true;
|
||||
}
|
||||
if (token.fromThen) {
|
||||
return 1;
|
||||
}
|
||||
if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) {
|
||||
return 1;
|
||||
}
|
||||
tokens.splice(i, 0, this.generate('CALL_START', '(', token[2]));
|
||||
this.detectEnd(i + 1, condition, action);
|
||||
if (prev[0] === '?') prev[0] = 'FUNC_EXIST';
|
||||
if (prev[0] === '?') {
|
||||
prev[0] = 'FUNC_EXIST';
|
||||
}
|
||||
return 2;
|
||||
});
|
||||
};
|
||||
|
|
@ -251,10 +275,14 @@ define(function(require, exports, module) {
|
|||
if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
|
||||
starter = tag;
|
||||
_ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1];
|
||||
if (starter === 'THEN') indent.fromThen = true;
|
||||
if (starter === 'THEN') {
|
||||
indent.fromThen = true;
|
||||
}
|
||||
tokens.splice(i + 1, 0, indent);
|
||||
this.detectEnd(i + 2, condition, action);
|
||||
if (tag === 'THEN') tokens.splice(i, 1);
|
||||
if (tag === 'THEN') {
|
||||
tokens.splice(i, 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -274,7 +302,9 @@ define(function(require, exports, module) {
|
|||
}
|
||||
};
|
||||
return this.scanTokens(function(token, i) {
|
||||
if (token[0] !== 'IF') return 1;
|
||||
if (token[0] !== 'IF') {
|
||||
return 1;
|
||||
}
|
||||
original = token;
|
||||
this.detectEnd(i + 1, condition, action);
|
||||
return 1;
|
||||
|
|
@ -283,10 +313,14 @@ define(function(require, exports, module) {
|
|||
|
||||
Rewriter.prototype.indentation = function(token, implicit) {
|
||||
var indent, outdent;
|
||||
if (implicit == null) implicit = false;
|
||||
if (implicit == null) {
|
||||
implicit = false;
|
||||
}
|
||||
indent = ['INDENT', 2, token[2]];
|
||||
outdent = ['OUTDENT', 2, token[2]];
|
||||
if (implicit) indent.generated = outdent.generated = true;
|
||||
if (implicit) {
|
||||
indent.generated = outdent.generated = true;
|
||||
}
|
||||
return [indent, outdent];
|
||||
};
|
||||
|
||||
|
|
@ -324,7 +358,7 @@ define(function(require, exports, module) {
|
|||
|
||||
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
|
||||
|
||||
IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++'];
|
||||
IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++'];
|
||||
|
||||
IMPLICIT_UNSPACED_CALL = ['+', '-'];
|
||||
|
||||
|
|
@ -339,4 +373,4 @@ define(function(require, exports, module) {
|
|||
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Jeremy Ashkenas
|
||||
/**
|
||||
* Copyright (c) 2009-2012 Jeremy Ashkenas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
// Generated by CoffeeScript 1.2.1-pre
|
||||
// Generated by CoffeeScript 1.3.3
|
||||
|
||||
var Scope, extend, last, _ref;
|
||||
|
||||
|
|
@ -32,8 +32,6 @@ define(function(require, exports, module) {
|
|||
|
||||
exports.Scope = Scope = (function() {
|
||||
|
||||
Scope.name = 'Scope';
|
||||
|
||||
Scope.root = null;
|
||||
|
||||
function Scope(parent, expressions, method) {
|
||||
|
|
@ -47,11 +45,15 @@ define(function(require, exports, module) {
|
|||
}
|
||||
];
|
||||
this.positions = {};
|
||||
if (!this.parent) Scope.root = this;
|
||||
if (!this.parent) {
|
||||
Scope.root = this;
|
||||
}
|
||||
}
|
||||
|
||||
Scope.prototype.add = function(name, type, immediate) {
|
||||
if (this.shared && !immediate) return this.parent.add(name, type, immediate);
|
||||
if (this.shared && !immediate) {
|
||||
return this.parent.add(name, type, immediate);
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
|
||||
return this.variables[this.positions[name]].type = type;
|
||||
} else {
|
||||
|
|
@ -62,22 +64,31 @@ define(function(require, exports, module) {
|
|||
}
|
||||
};
|
||||
|
||||
Scope.prototype.find = function(name, options) {
|
||||
if (this.check(name, options)) return true;
|
||||
Scope.prototype.namedMethod = function() {
|
||||
if (this.method.name || !this.parent) {
|
||||
return this.method;
|
||||
}
|
||||
return this.parent.namedMethod();
|
||||
};
|
||||
|
||||
Scope.prototype.find = function(name) {
|
||||
if (this.check(name)) {
|
||||
return true;
|
||||
}
|
||||
this.add(name, 'var');
|
||||
return false;
|
||||
};
|
||||
|
||||
Scope.prototype.parameter = function(name) {
|
||||
if (this.shared && this.parent.check(name, true)) return;
|
||||
if (this.shared && this.parent.check(name, true)) {
|
||||
return;
|
||||
}
|
||||
return this.add(name, 'param');
|
||||
};
|
||||
|
||||
Scope.prototype.check = function(name, immediate) {
|
||||
var found, _ref1;
|
||||
found = !!this.type(name);
|
||||
if (found || immediate) return found;
|
||||
return !!((_ref1 = this.parent) != null ? _ref1.check(name) : void 0);
|
||||
Scope.prototype.check = function(name) {
|
||||
var _ref1;
|
||||
return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0));
|
||||
};
|
||||
|
||||
Scope.prototype.temporary = function(name, index) {
|
||||
|
|
@ -93,19 +104,25 @@ define(function(require, exports, module) {
|
|||
_ref1 = this.variables;
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
v = _ref1[_i];
|
||||
if (v.name === name) return v.type;
|
||||
if (v.name === name) {
|
||||
return v.type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Scope.prototype.freeVariable = function(name, reserve) {
|
||||
var index, temp;
|
||||
if (reserve == null) reserve = true;
|
||||
if (reserve == null) {
|
||||
reserve = true;
|
||||
}
|
||||
index = 0;
|
||||
while (this.check((temp = this.temporary(name, index)))) {
|
||||
index++;
|
||||
}
|
||||
if (reserve) this.add(temp, 'var', true);
|
||||
if (reserve) {
|
||||
this.add(temp, 'var', true);
|
||||
}
|
||||
return temp;
|
||||
};
|
||||
|
||||
|
|
@ -141,7 +158,9 @@ define(function(require, exports, module) {
|
|||
_results = [];
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
v = _ref1[_i];
|
||||
if (v.type.assigned) _results.push("" + v.name + " = " + v.type.value);
|
||||
if (v.type.assigned) {
|
||||
_results.push("" + v.name + " = " + v.type.value);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
|
@ -151,4 +170,4 @@ define(function(require, exports, module) {
|
|||
})();
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
/* Build time: 2-March-2012 02:47:11 */
|
||||
/* Build time: 14-May-2012 10:24:48 */
|
||||
|
||||
/*!
|
||||
Parser-Lib
|
||||
|
|
@ -47,7 +47,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
|
||||
/* Version v0.1.7, Build time: 4-May-2012 03:57:04 */
|
||||
var parserlib = {};
|
||||
(function(){
|
||||
|
||||
|
|
@ -957,7 +957,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
|
||||
/* Version v0.1.7, Build time: 4-May-2012 03:57:04 */
|
||||
(function(){
|
||||
var EventTarget = parserlib.util.EventTarget,
|
||||
TokenStreamBase = parserlib.util.TokenStreamBase,
|
||||
|
|
@ -2666,7 +2666,8 @@ Parser.prototype = function(){
|
|||
expr = null,
|
||||
prio = null,
|
||||
error = null,
|
||||
invalid = null;
|
||||
invalid = null,
|
||||
propertyName= "";
|
||||
|
||||
property = this._property();
|
||||
if (property !== null){
|
||||
|
|
@ -2683,8 +2684,20 @@ Parser.prototype = function(){
|
|||
|
||||
prio = this._prio();
|
||||
|
||||
/*
|
||||
* If hacks should be allowed, then only check the root
|
||||
* property. If hacks should not be allowed, treat
|
||||
* _property or *property as invalid properties.
|
||||
*/
|
||||
propertyName = property.toString();
|
||||
if (this.options.starHack && property.hack == "*" ||
|
||||
this.options.underscoreHack && property.hack == "_") {
|
||||
|
||||
propertyName = property.text;
|
||||
}
|
||||
|
||||
try {
|
||||
this._validateProperty(property, expr);
|
||||
this._validateProperty(propertyName, expr);
|
||||
} catch (ex) {
|
||||
invalid = ex;
|
||||
}
|
||||
|
|
@ -3525,6 +3538,7 @@ var Properties = {
|
|||
"background-repeat" : { multi: "<repeat-style>" },
|
||||
"background-size" : { multi: "<bg-size>", comma: true },
|
||||
"baseline-shift" : "baseline | sub | super | <percentage> | <length>",
|
||||
"behavior" : 1,
|
||||
"binding" : 1,
|
||||
"bleed" : "<length>",
|
||||
"bookmark-label" : "<content> | <attr> | <string>",
|
||||
|
|
@ -3871,6 +3885,7 @@ var Properties = {
|
|||
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
|
||||
"text-outline" : 1,
|
||||
"text-overflow" : 1,
|
||||
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
|
||||
"text-shadow" : 1,
|
||||
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
|
||||
"text-wrap" : "normal | none | avoid",
|
||||
|
|
@ -5950,7 +5965,7 @@ var ValidationTypes = {
|
|||
i, len, found = false;
|
||||
|
||||
for (i=0,len=args.length; i < len && !found; i++){
|
||||
if (text == args[i]){
|
||||
if (text == args[i].toLowerCase()){
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -6042,7 +6057,7 @@ var ValidationTypes = {
|
|||
},
|
||||
|
||||
"<gradient>": function(part) {
|
||||
return part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial|linear)\-gradient/i.test(part);
|
||||
return part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);
|
||||
},
|
||||
|
||||
"<box>": function(part){
|
||||
|
|
@ -6134,6 +6149,18 @@ var ValidationTypes = {
|
|||
part,
|
||||
i, len;
|
||||
|
||||
/*
|
||||
<position> = [
|
||||
[ left | center | right | top | bottom | <percentage> | <length> ]
|
||||
|
|
||||
[ left | center | right | <percentage> | <length> ]
|
||||
[ top | center | bottom | <percentage> | <length> ]
|
||||
|
|
||||
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
|
||||
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
|
||||
]
|
||||
|
||||
*/
|
||||
|
||||
if (ValidationTypes.isAny(expression, "top | bottom")) {
|
||||
result = true;
|
||||
|
|
@ -6306,7 +6333,7 @@ var CSSLint = (function(){
|
|||
formatters = [],
|
||||
api = new parserlib.util.EventTarget();
|
||||
|
||||
api.version = "0.9.7";
|
||||
api.version = "0.9.8";
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Rule Management
|
||||
|
|
@ -7633,7 +7660,7 @@ CSSLint.addRule({
|
|||
parser.addListener("endstylesheet", function(){
|
||||
reporter.stat("important", count);
|
||||
if (count >= 10){
|
||||
reporter.rollupWarn("Too many !important declarations (" + count + "), try to use less than 10 to avoid specifity issues.", rule);
|
||||
reporter.rollupWarn("Too many !important declarations (" + count + "), try to use less than 10 to avoid specificity issues.", rule);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -8290,8 +8317,35 @@ CSSLint.addRule({
|
|||
|
||||
});
|
||||
/*
|
||||
* Rule: Don't use text-indent for image replacement if you need to support rtl.
|
||||
*
|
||||
* Rule: Don't use properties with a star prefix.
|
||||
*
|
||||
*/
|
||||
/*global CSSLint*/
|
||||
CSSLint.addRule({
|
||||
|
||||
//rule information
|
||||
id: "star-property-hack",
|
||||
name: "Disallow properties with a star prefix",
|
||||
desc: "Checks for the star property hack (targets IE6/7)",
|
||||
browsers: "All",
|
||||
|
||||
//initialization
|
||||
init: function(parser, reporter){
|
||||
var rule = this;
|
||||
|
||||
//check if property name starts with "*"
|
||||
parser.addListener("property", function(event){
|
||||
var property = event.property;
|
||||
|
||||
if (property.hack == "*") {
|
||||
reporter.report("Property with star prefix found.", event.property.line, event.property.col, rule);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
/*
|
||||
* Rule: Don't use text-indent for image replacement if you need to support rtl.
|
||||
*
|
||||
*/
|
||||
/*global CSSLint*/
|
||||
CSSLint.addRule({
|
||||
|
|
@ -8301,27 +8355,29 @@ CSSLint.addRule({
|
|||
name: "Disallow negative text-indent",
|
||||
desc: "Checks for text indent less than -99px",
|
||||
browsers: "All",
|
||||
|
||||
|
||||
//initialization
|
||||
init: function(parser, reporter){
|
||||
var rule = this,
|
||||
textIndent = false;
|
||||
|
||||
|
||||
textIndent,
|
||||
direction;
|
||||
|
||||
|
||||
function startRule(event){
|
||||
textIndent = false;
|
||||
direction = "inherit";
|
||||
}
|
||||
|
||||
|
||||
//event handler for end of rules
|
||||
function endRule(event){
|
||||
if (textIndent){
|
||||
if (textIndent && direction != "ltr"){
|
||||
reporter.report("Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.", textIndent.line, textIndent.col, rule);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
parser.addListener("startrule", startRule);
|
||||
parser.addListener("startfontface", startRule);
|
||||
|
||||
|
||||
//check for use of "font-size"
|
||||
parser.addListener("property", function(event){
|
||||
var name = event.property.toString().toLowerCase(),
|
||||
|
|
@ -8330,16 +8386,43 @@ CSSLint.addRule({
|
|||
if (name == "text-indent" && value.parts[0].value < -99){
|
||||
textIndent = event.property;
|
||||
} else if (name == "direction" && value == "ltr"){
|
||||
textIndent = false;
|
||||
direction = "ltr";
|
||||
}
|
||||
});
|
||||
|
||||
parser.addListener("endrule", endRule);
|
||||
parser.addListener("endfontface", endRule);
|
||||
parser.addListener("endfontface", endRule);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
/*
|
||||
* Rule: Don't use properties with a underscore prefix.
|
||||
*
|
||||
*/
|
||||
/*global CSSLint*/
|
||||
CSSLint.addRule({
|
||||
|
||||
//rule information
|
||||
id: "underscore-property-hack",
|
||||
name: "Disallow properties with an underscore prefix",
|
||||
desc: "Checks for the underscore property hack (targets IE6)",
|
||||
browsers: "All",
|
||||
|
||||
//initialization
|
||||
init: function(parser, reporter){
|
||||
var rule = this;
|
||||
|
||||
//check if property name starts with "_"
|
||||
parser.addListener("property", function(event){
|
||||
var property = event.property;
|
||||
|
||||
if (property.hack == "_") {
|
||||
reporter.report("Property with underscore prefix found.", event.property.line, event.property.col, rule);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
/*
|
||||
* Rule: Headings (h1-h6) should be defined only once.
|
||||
*/
|
||||
|
|
@ -8669,85 +8752,114 @@ CSSLint.addRule({
|
|||
|
||||
});
|
||||
/*global CSSLint*/
|
||||
CSSLint.addFormatter({
|
||||
//format information
|
||||
id: "checkstyle-xml",
|
||||
name: "Checkstyle XML format",
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* Return opening root XML tag.
|
||||
* @return {String} to prepend before all results
|
||||
* Replace special characters before write to output.
|
||||
*
|
||||
* Rules:
|
||||
* - single quotes is the escape sequence for double-quotes
|
||||
* - & is the escape sequence for &
|
||||
* - < is the escape sequence for <
|
||||
* - > is the escape sequence for >
|
||||
*
|
||||
* @param {String} message to escape
|
||||
* @return escaped message as {String}
|
||||
*/
|
||||
startFormat: function(){
|
||||
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>";
|
||||
},
|
||||
|
||||
/**
|
||||
* Return closing root XML tag.
|
||||
* @return {String} to append after all results
|
||||
*/
|
||||
endFormat: function(){
|
||||
return "</checkstyle>";
|
||||
},
|
||||
|
||||
/**
|
||||
* Given CSS Lint results for a file, return output for this format.
|
||||
* @param results {Object} with error and warning messages
|
||||
* @param filename {String} relative file path
|
||||
* @param options {Object} (UNUSED for now) specifies special handling of output
|
||||
* @return {String} output for results
|
||||
*/
|
||||
formatResults: function(results, filename, options) {
|
||||
var messages = results.messages,
|
||||
output = [];
|
||||
|
||||
/**
|
||||
* Generate a source string for a rule.
|
||||
* Checkstyle source strings usually resemble Java class names e.g
|
||||
* net.csslint.SomeRuleName
|
||||
* @param {Object} rule
|
||||
* @return rule source as {String}
|
||||
*/
|
||||
var generateSource = function(rule) {
|
||||
if (!rule || !('name' in rule)) {
|
||||
return "";
|
||||
}
|
||||
return 'net.csslint.' + rule.name.replace(/\s/g,'');
|
||||
};
|
||||
|
||||
/**
|
||||
* Replace special characters before write to output.
|
||||
*
|
||||
* Rules:
|
||||
* - single quotes is the escape sequence for double-quotes
|
||||
* - < is the escape sequence for <
|
||||
* - > is the escape sequence for >
|
||||
*
|
||||
* @param {String} message to escape
|
||||
* @return escaped message as {String}
|
||||
*/
|
||||
var escapeSpecialCharacters = function(str) {
|
||||
if (!str || str.constructor !== String) {
|
||||
return "";
|
||||
}
|
||||
return str.replace(/\"/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
||||
};
|
||||
|
||||
if (messages.length > 0) {
|
||||
output.push("<file name=\""+filename+"\">");
|
||||
CSSLint.Util.forEach(messages, function (message, i) {
|
||||
//ignore rollups for now
|
||||
if (!message.rollup) {
|
||||
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
|
||||
" message=\"" + escapeSpecialCharacters(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");
|
||||
}
|
||||
});
|
||||
output.push("</file>");
|
||||
var xmlEscape = function(str) {
|
||||
if (!str || str.constructor !== String) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return str.replace(/[\"&><]/g, function(match) {
|
||||
switch (match) {
|
||||
case "\"":
|
||||
return """;
|
||||
case "&":
|
||||
return "&";
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return output.join("");
|
||||
}
|
||||
});
|
||||
CSSLint.addFormatter({
|
||||
//format information
|
||||
id: "checkstyle-xml",
|
||||
name: "Checkstyle XML format",
|
||||
|
||||
/**
|
||||
* Return opening root XML tag.
|
||||
* @return {String} to prepend before all results
|
||||
*/
|
||||
startFormat: function(){
|
||||
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>";
|
||||
},
|
||||
|
||||
/**
|
||||
* Return closing root XML tag.
|
||||
* @return {String} to append after all results
|
||||
*/
|
||||
endFormat: function(){
|
||||
return "</checkstyle>";
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns message when there is a file read error.
|
||||
* @param {String} filename The name of the file that caused the error.
|
||||
* @param {String} message The error message
|
||||
* @return {String} The error message.
|
||||
*/
|
||||
readError: function(filename, message) {
|
||||
return "<file name=\"" + xmlEscape(filename) + "\"><error line=\"0\" column=\"0\" severty=\"error\" message=\"" + xmlEscape(message) + "\"></error></file>";
|
||||
},
|
||||
|
||||
/**
|
||||
* Given CSS Lint results for a file, return output for this format.
|
||||
* @param results {Object} with error and warning messages
|
||||
* @param filename {String} relative file path
|
||||
* @param options {Object} (UNUSED for now) specifies special handling of output
|
||||
* @return {String} output for results
|
||||
*/
|
||||
formatResults: function(results, filename, options) {
|
||||
var messages = results.messages,
|
||||
output = [];
|
||||
|
||||
/**
|
||||
* Generate a source string for a rule.
|
||||
* Checkstyle source strings usually resemble Java class names e.g
|
||||
* net.csslint.SomeRuleName
|
||||
* @param {Object} rule
|
||||
* @return rule source as {String}
|
||||
*/
|
||||
var generateSource = function(rule) {
|
||||
if (!rule || !('name' in rule)) {
|
||||
return "";
|
||||
}
|
||||
return 'net.csslint.' + rule.name.replace(/\s/g,'');
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (messages.length > 0) {
|
||||
output.push("<file name=\""+filename+"\">");
|
||||
CSSLint.Util.forEach(messages, function (message, i) {
|
||||
//ignore rollups for now
|
||||
if (!message.rollup) {
|
||||
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
|
||||
" message=\"" + xmlEscape(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");
|
||||
}
|
||||
});
|
||||
output.push("</file>");
|
||||
}
|
||||
|
||||
return output.join("");
|
||||
}
|
||||
});
|
||||
|
||||
}());
|
||||
/*global CSSLint*/
|
||||
CSSLint.addFormatter({
|
||||
//format information
|
||||
|
|
@ -8845,6 +8957,7 @@ CSSLint.addFormatter({
|
|||
*
|
||||
* Rules:
|
||||
* - single quotes is the escape sequence for double-quotes
|
||||
* - & is the escape sequence for &
|
||||
* - < is the escape sequence for <
|
||||
* - > is the escape sequence for >
|
||||
*
|
||||
|
|
@ -8855,7 +8968,7 @@ CSSLint.addFormatter({
|
|||
if (!str || str.constructor !== String) {
|
||||
return "";
|
||||
}
|
||||
return str.replace(/\"/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
||||
return str.replace(/\"/g, "'").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
};
|
||||
|
||||
if (messages.length > 0) {
|
||||
|
|
@ -8912,6 +9025,7 @@ CSSLint.addFormatter({
|
|||
*
|
||||
* Rules:
|
||||
* - single quotes is the escape sequence for double-quotes
|
||||
* - & is the escape sequence for &
|
||||
* - < is the escape sequence for <
|
||||
* - > is the escape sequence for >
|
||||
*
|
||||
|
|
@ -8922,7 +9036,7 @@ CSSLint.addFormatter({
|
|||
if (!str || str.constructor !== String) {
|
||||
return "";
|
||||
}
|
||||
return str.replace(/\"/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
||||
return str.replace(/\"/g, "'").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
};
|
||||
|
||||
if (messages.length > 0) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -8,11 +8,13 @@ var rootDir = __dirname + "/../lib/ace/"
|
|||
var deps = [{
|
||||
path: "worker/jshint.js",
|
||||
url: "https://raw.github.com/jshint/jshint/master/jshint.js",
|
||||
needsFixup: true
|
||||
}, {
|
||||
path: "worker/jslint.js",
|
||||
url: "https://raw.github.com/douglascrockford/JSLint/master/jslint.js",
|
||||
needsFixup: true
|
||||
needsFixup: true,
|
||||
postProcess: function(t) {
|
||||
return t.replace(
|
||||
/"Expected a conditional expression and instead saw an assignment."/g,
|
||||
'"Assignment in conditional expression"'
|
||||
);
|
||||
}
|
||||
}, {
|
||||
path: "mode/css/csslint.js",
|
||||
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js",
|
||||
|
|
@ -43,7 +45,9 @@ var getDep = function(dep) {
|
|||
data = "define(function(require, exports, module) {\n"
|
||||
+ data
|
||||
+ "\n});"
|
||||
|
||||
if (dep.postProcess)
|
||||
data = dep.postProcess(data)
|
||||
|
||||
fs.writeFile(rootDir + dep.path, data, "utf-8", function(err){
|
||||
if (err) throw err
|
||||
console.log("File " + dep.path + " saved.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue