update cssLint and coffee

This commit is contained in:
nightwing 2013-12-15 21:18:13 +04:00
commit 6285bf5d5a
7 changed files with 1086 additions and 987 deletions

View file

@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4 /** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.8+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * @license RequireJS 2.1.9+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details * see: http://github.com/jrburke/requirejs for details
*/ */
@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) { (function (global) {
var req, s, head, baseElement, dataMain, src, var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath, interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.8+', version = '2.1.9+',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/, jsSuffixRegExp = /\.js$/,
@ -22,7 +22,7 @@ var requirejs, require, define;
hasOwn = op.hasOwnProperty, hasOwn = op.hasOwnProperty,
ap = Array.prototype, ap = Array.prototype,
apsp = ap.splice, apsp = ap.splice,
isBrowser = !!(typeof window !== 'undefined' && navigator && window.document), isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
isWebWorker = !isBrowser && typeof importScripts !== 'undefined', isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
//PS3 indicates loaded and complete, but need to wait for complete //PS3 indicates loaded and complete, but need to wait for complete
//specifically. Sequence is 'loading', 'loaded', execution, //specifically. Sequence is 'loading', 'loaded', execution,
@ -373,7 +373,6 @@ var requirejs, require, define;
function hasPathFallback(id) { function hasPathFallback(id) {
var pathConfig = getOwn(config.paths, id); var pathConfig = getOwn(config.paths, id);
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) { if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
removeScript(id);
//Pop off the first array value, since it failed, and //Pop off the first array value, since it failed, and
//retry //retry
pathConfig.shift(); pathConfig.shift();
@ -549,7 +548,7 @@ var requirejs, require, define;
//local var ref to defQueue, so cannot just reassign the one //local var ref to defQueue, so cannot just reassign the one
//on context. //on context.
apsp.apply(defQueue, apsp.apply(defQueue,
[defQueue.length - 1, 0].concat(globalDefQueue)); [defQueue.length, 0].concat(globalDefQueue));
globalDefQueue = []; globalDefQueue = [];
} }
} }
@ -629,7 +628,7 @@ var requirejs, require, define;
} }
function checkLoaded() { function checkLoaded() {
var map, modId, err, usingPathFallback, var err, usingPathFallback,
waitInterval = config.waitSeconds * 1000, waitInterval = config.waitSeconds * 1000,
//It is possible to disable the wait interval by using waitSeconds of 0. //It is possible to disable the wait interval by using waitSeconds of 0.
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(), expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
@ -647,8 +646,8 @@ var requirejs, require, define;
//Figure out the state of all the modules. //Figure out the state of all the modules.
eachProp(enabledRegistry, function (mod) { eachProp(enabledRegistry, function (mod) {
map = mod.map; var map = mod.map,
modId = map.id; modId = map.id;
//Skip things that are not enabled or in error state. //Skip things that are not enabled or in error state.
if (!mod.enabled) { if (!mod.enabled) {
@ -1464,10 +1463,21 @@ var requirejs, require, define;
var map = makeModuleMap(id, relMap, true), var map = makeModuleMap(id, relMap, true),
mod = getOwn(registry, id); mod = getOwn(registry, id);
removeScript(id);
delete defined[id]; delete defined[id];
delete urlFetched[map.url]; delete urlFetched[map.url];
delete undefEvents[id]; delete undefEvents[id];
//Clean queued defines too. Go backwards
//in array so that the splices do not
//mess up the iteration.
eachReverse(defQueue, function(args, i) {
if(args[0] === id) {
defQueue.splice(i, 1);
}
});
if (mod) { if (mod) {
//Hold on to listeners in case the //Hold on to listeners in case the
//module will be attempted to be reloaded //module will be attempted to be reloaded
@ -1918,7 +1928,7 @@ var requirejs, require, define;
} }
//Look for a data-main script attribute, which could also adjust the baseUrl. //Look for a data-main script attribute, which could also adjust the baseUrl.
if (isBrowser) { if (isBrowser && !cfg.skipDataMain) {
//Figure out baseUrl. Get it from the script tag with require.js in it. //Figure out baseUrl. Get it from the script tag with require.js in it.
eachReverse(scripts(), function (script) { eachReverse(scripts(), function (script) {
//Set the 'head' where we can append children by //Set the 'head' where we can append children by

View file

@ -194,7 +194,7 @@ define(function(require, exports, module) {
pathSep = useWinPathSep ? /\\|\// : /\//; pathSep = useWinPathSep ? /\\|\// : /\//;
parts = file.split(pathSep); parts = file.split(pathSep);
file = parts[parts.length - 1]; file = parts[parts.length - 1];
if (!stripExt) { if (!(stripExt && file.indexOf('.') >= 0)) {
return file; return file;
} }
parts = file.split('.'); parts = file.split('.');

View file

@ -193,30 +193,25 @@ define(function(require, exports, module) {
}; };
Lexer.prototype.stringToken = function() { Lexer.prototype.stringToken = function() {
var match, octalEsc, string; var octalEsc, quote, string, trimmed;
switch (this.chunk.charAt(0)) { switch (quote = this.chunk.charAt(0)) {
case "'": case "'":
if (!(match = SIMPLESTR.exec(this.chunk))) { string = SIMPLESTR.exec(this.chunk)[0];
return 0;
}
string = match[0];
this.token('STRING', string.replace(MULTILINER, '\\\n'), 0, string.length);
break; break;
case '"': case '"':
if (!(string = this.balancedString(this.chunk, '"'))) { string = this.balancedString(this.chunk, '"');
return 0; }
} if (!string) {
if (0 < string.indexOf('#{', 1)) { return 0;
this.interpolateString(string.slice(1, -1), { }
strOffset: 1, trimmed = this.removeNewlines(string.slice(1, -1));
lexedLength: string.length if (quote === '"' && 0 < string.indexOf('#{', 1)) {
}); this.interpolateString(trimmed, {
} else { strOffset: 1,
this.token('STRING', this.escapeLines(string, 0, string.length)); lexedLength: string.length
} });
break; } else {
default: this.token('STRING', quote + this.escapeLines(trimmed) + quote, 0, string.length);
return 0;
} }
if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) { if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) {
this.error("octal escape sequences " + string + " are not allowed"); this.error("octal escape sequences " + string + " are not allowed");
@ -302,7 +297,7 @@ define(function(require, exports, module) {
var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4; var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
heregex = match[0], body = match[1], flags = match[2]; heregex = match[0], body = match[1], flags = match[2];
if (0 > body.indexOf('#{')) { if (0 > body.indexOf('#{')) {
re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); re = this.escapeLines(body.replace(HEREGEX_OMIT, '$1$2').replace(/\//g, '\\/'), true);
if (re.match(/^\*/)) { if (re.match(/^\*/)) {
this.error('regular expressions cannot begin with `*`'); this.error('regular expressions cannot begin with `*`');
} }
@ -321,7 +316,7 @@ define(function(require, exports, module) {
if (tag === 'TOKENS') { if (tag === 'TOKENS') {
tokens.push.apply(tokens, value); tokens.push.apply(tokens, value);
} else if (tag === 'NEOSTRING') { } else if (tag === 'NEOSTRING') {
if (!(value = value.replace(HEREGEX_OMIT, ''))) { if (!(value = value.replace(HEREGEX_OMIT, '$1$2'))) {
continue; continue;
} }
value = value.replace(/\\/g, '\\\\'); value = value.replace(/\\/g, '\\\\');
@ -628,10 +623,6 @@ define(function(require, exports, module) {
offsetInChunk = offsetInChunk || 0; offsetInChunk = offsetInChunk || 0;
strOffset = strOffset || 0; strOffset = strOffset || 0;
lexedLength = lexedLength || str.length; lexedLength = lexedLength || str.length;
if (heredoc && str.length > 0 && str[0] === '\n') {
str = str.slice(1);
strOffset++;
}
tokens = []; tokens = [];
pi = 0; pi = 0;
i = -1; i = -1;
@ -789,16 +780,31 @@ define(function(require, exports, module) {
return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS');
}; };
Lexer.prototype.removeNewlines = function(str) {
return str.replace(/^\s*\n\s*/, '').replace(/([^\\]|\\\\)\s*\n\s*$/, '$1');
};
Lexer.prototype.escapeLines = function(str, heredoc) { Lexer.prototype.escapeLines = function(str, heredoc) {
return str.replace(MULTILINER, heredoc ? '\\n' : ''); str = str.replace(/\\[^\S\n]*(\n|\\)\s*/g, function(escaped, character) {
if (character === '\n') {
return '';
} else {
return escaped;
}
});
if (heredoc) {
return str.replace(MULTILINER, '\\n');
} else {
return str.replace(/\s*\n\s*/g, ' ');
}
}; };
Lexer.prototype.makeString = function(body, quote, heredoc) { Lexer.prototype.makeString = function(body, quote, heredoc) {
if (!body) { if (!body) {
return quote + quote; return quote + quote;
} }
body = body.replace(/\\([\s\S])/g, function(match, contents) { body = body.replace(RegExp("\\\\(" + quote + "|\\\\)", "g"), function(match, contents) {
if (contents === '\n' || contents === quote) { if (contents === quote) {
return contents; return contents;
} else { } else {
return match; return match;
@ -867,27 +873,27 @@ define(function(require, exports, module) {
NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;
HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; HEREDOC = /^("""|''')((?:\\[\s\S]|[^\\])*?)(?:\n[^\n\S]*)?\1/;
OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/; OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/;
WHITESPACE = /^[^\n\S]+/; WHITESPACE = /^[^\n\S]+/;
COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/; COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|###$)|^(?:\s*#(?!##[^#]).*)+/;
CODE = /^[-=]>/; CODE = /^[-=]>/;
MULTI_DENT = /^(?:\n[^\n\S]*)+/; MULTI_DENT = /^(?:\n[^\n\S]*)+/;
SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; SIMPLESTR = /^'[^\\']*(?:\\[\s\S][^\\']*)*'/;
JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/;
REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/; REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/;
HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; HEREGEX = /^\/{3}((?:\\?[\s\S])+?)\/{3}([imgy]{0,4})(?!\w)/;
HEREGEX_OMIT = /\s+(?:#.*)?/g; HEREGEX_OMIT = /((?:\\\\)+)|\\(\s|\/)|\s+(?:#.*)?/g;
MULTILINER = /\n/g; MULTILINER = /\n/g;

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@
define(function(require, exports, module) { define(function(require, exports, module) {
// Generated by CoffeeScript 1.6.3 // Generated by CoffeeScript 1.6.3
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref, var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, 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; }, __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; },
__slice = [].slice; __slice = [].slice;
@ -44,10 +44,9 @@ define(function(require, exports, module) {
Rewriter.prototype.rewrite = function(tokens) { Rewriter.prototype.rewrite = function(tokens) {
this.tokens = tokens; this.tokens = tokens;
this.removeLeadingNewlines(); this.removeLeadingNewlines();
this.removeMidExpressionNewlines();
this.closeOpenCalls(); this.closeOpenCalls();
this.closeOpenIndexes(); this.closeOpenIndexes();
this.addImplicitIndentation(); this.normalizeLines();
this.tagPostfixConditionals(); this.tagPostfixConditionals();
this.addImplicitBracesAndParens(); this.addImplicitBracesAndParens();
this.addLocationDataToGeneratedTokens(); this.addLocationDataToGeneratedTokens();
@ -99,17 +98,6 @@ define(function(require, exports, module) {
} }
}; };
Rewriter.prototype.removeMidExpressionNewlines = function() {
return this.scanTokens(function(token, i, tokens) {
var _ref;
if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) {
return 1;
}
tokens.splice(i, 1);
return 0;
});
};
Rewriter.prototype.closeOpenCalls = function() { Rewriter.prototype.closeOpenCalls = function() {
var action, condition; var action, condition;
condition = function(token, i) { condition = function(token, i) {
@ -188,9 +176,9 @@ define(function(require, exports, module) {
var stack; var stack;
stack = []; stack = [];
return this.scanTokens(function(token, i, tokens) { return this.scanTokens(function(token, i, tokens) {
var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; var endAllImplicitCalls, endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, prevToken, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
tag = token[0]; tag = token[0];
prevTag = (i > 0 ? tokens[i - 1] : [])[0]; prevTag = (prevToken = i > 0 ? tokens[i - 1] : [])[0];
nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0]; nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
stackTop = function() { stackTop = function() {
return stack[stack.length - 1]; return stack[stack.length - 1];
@ -233,6 +221,11 @@ define(function(require, exports, module) {
tokens.splice(i, 0, generate('CALL_END', ')')); tokens.splice(i, 0, generate('CALL_END', ')'));
return i += 1; return i += 1;
}; };
endAllImplicitCalls = function() {
while (inImplicitCall()) {
endImplicitCall();
}
};
startImplicitObject = function(j, startsLine) { startImplicitObject = function(j, startsLine) {
var idx; var idx;
if (startsLine == null) { if (startsLine == null) {
@ -324,9 +317,15 @@ define(function(require, exports, module) {
startImplicitObject(s, !!startsLine); startImplicitObject(s, !!startsLine);
return forward(2); return forward(2);
} }
if (prevTag === 'OUTDENT' && inImplicitCall() && (tag === '.' || tag === '?.' || tag === '::' || tag === '?::')) { if (inImplicitCall() && __indexOf.call(CALL_CLOSERS, tag) >= 0) {
endImplicitCall(); if (prevTag === 'OUTDENT') {
return forward(1); endImplicitCall();
return forward(1);
}
if (prevToken.newLine) {
endAllImplicitCalls();
return forward(1);
}
} }
if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) { if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) {
stackTop()[2].sameLine = false; stackTop()[2].sameLine = false;
@ -381,30 +380,32 @@ define(function(require, exports, module) {
}); });
}; };
Rewriter.prototype.addImplicitIndentation = function() { Rewriter.prototype.normalizeLines = function() {
var action, condition, indent, outdent, starter; var action, condition, indent, outdent, starter;
starter = indent = outdent = null; starter = indent = outdent = null;
condition = function(token, i) { condition = function(token, i) {
var _ref, _ref1; var _ref, _ref1, _ref2, _ref3;
return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref1 = token[0]) === 'CATCH' || _ref1 === 'FINALLY') && (starter === '->' || starter === '=>')); return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'TERMINATOR' && (_ref1 = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref1) >= 0)) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref2 = token[0]) === 'CATCH' || _ref2 === 'FINALLY') && (starter === '->' || starter === '=>')) || (_ref3 = token[0], __indexOf.call(CALL_CLOSERS, _ref3) >= 0) && this.tokens[i - 1].newLine;
}; };
action = function(token, i) { action = function(token, i) {
return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
}; };
return this.scanTokens(function(token, i, tokens) { return this.scanTokens(function(token, i, tokens) {
var j, tag, _i, _ref, _ref1; var j, tag, _i, _ref, _ref1, _ref2;
tag = token[0]; tag = token[0];
if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { if (tag === 'TERMINATOR') {
tokens.splice(i, 1); if (this.tag(i + 1) === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
return 0; tokens.splice.apply(tokens, [i, 1].concat(__slice.call(this.indentation())));
} return 1;
if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { }
tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation()))); if (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0) {
return 2; tokens.splice(i, 1);
return 0;
}
} }
if (tag === 'CATCH') { if (tag === 'CATCH') {
for (j = _i = 1; _i <= 2; j = ++_i) { for (j = _i = 1; _i <= 2; j = ++_i) {
if (!((_ref = this.tag(i + j)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { if (!((_ref1 = this.tag(i + j)) === 'OUTDENT' || _ref1 === 'TERMINATOR' || _ref1 === 'FINALLY')) {
continue; continue;
} }
tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation()))); tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation())));
@ -413,7 +414,7 @@ define(function(require, exports, module) {
} }
if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
starter = tag; starter = tag;
_ref1 = this.indentation(true), indent = _ref1[0], outdent = _ref1[1]; _ref2 = this.indentation(true), indent = _ref2[0], outdent = _ref2[1];
if (starter === 'THEN') { if (starter === 'THEN') {
indent.fromThen = true; indent.fromThen = true;
} }
@ -493,7 +494,7 @@ define(function(require, exports, module) {
EXPRESSION_END.push(INVERSES[left] = rite); EXPRESSION_END.push(INVERSES[left] = rite);
} }
EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); EXPRESSION_CLOSE = ['CATCH', 'THEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
@ -509,5 +510,7 @@ define(function(require, exports, module) {
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
CALL_CLOSERS = ['.', '?.', '::', '?::'];
}); });

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) { define(function(require, exports, module) {
/*! /*!
CSSLint CSSLint
Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved. Copyright (c) 2013 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* Build time: 17-January-2013 10:55:01 */ /* Build: v0.10.0 15-August-2013 01:07:22 */
/*! /*!
Parser-Lib Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@ -46,7 +46,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* Version v0.2.2, Build time: 17-January-2013 10:26:34 */ /* Version v0.2.3, Build time: 19-June-2013 11:16:15 */
var parserlib = {}; var parserlib = {};
(function(){ (function(){
@ -956,7 +956,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* Version v0.2.2, Build time: 17-January-2013 10:26:34 */ /* Version v0.2.3, Build time: 19-June-2013 11:16:15 */
(function(){ (function(){
var EventTarget = parserlib.util.EventTarget, var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase, TokenStreamBase = parserlib.util.TokenStreamBase,
@ -1377,6 +1377,10 @@ Parser.prototype = function(){
this._keyframes(); this._keyframes();
this._skipCruft(); this._skipCruft();
break; break;
case Tokens.VIEWPORT_SYM:
this._viewport();
this._skipCruft();
break;
case Tokens.UNKNOWN_SYM: //unknown @ rule case Tokens.UNKNOWN_SYM: //unknown @ rule
tokenStream.get(); tokenStream.get();
if (!this.options.strict){ if (!this.options.strict){
@ -1614,6 +1618,8 @@ Parser.prototype = function(){
while(true) { while(true) {
if (tokenStream.peek() == Tokens.PAGE_SYM){ if (tokenStream.peek() == Tokens.PAGE_SYM){
this._page(); this._page();
} else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){
this._font_face();
} else if (!this._ruleset()){ } else if (!this._ruleset()){
break; break;
} }
@ -1962,6 +1968,39 @@ Parser.prototype = function(){
}); });
}, },
_viewport: function(){
/*
* viewport
* : VIEWPORT_SYM S*
* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
* ;
*/
var tokenStream = this._tokenStream,
line,
col;
tokenStream.mustMatch(Tokens.VIEWPORT_SYM);
line = tokenStream.token().startLine;
col = tokenStream.token().startCol;
this._readWhitespace();
this.fire({
type: "startviewport",
line: line,
col: col
});
this._readDeclarations(true);
this.fire({
type: "endviewport",
line: line,
col: col
});
},
_operator: function(inFunction){ _operator: function(inFunction){
/* /*
@ -3238,7 +3277,7 @@ Parser.prototype = function(){
* or * or
* S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
* Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.
* A semicolon is only necessary following a delcaration is there's another declaration * A semicolon is only necessary following a declaration is there's another declaration
* or margin afterwards. * or margin afterwards.
*/ */
var tokenStream = this._tokenStream, var tokenStream = this._tokenStream,
@ -3489,6 +3528,7 @@ nth
['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S*
; ;
*/ */
/*global Validation, ValidationTypes, ValidationError*/ /*global Validation, ValidationTypes, ValidationError*/
var Properties = { var Properties = {
@ -3586,7 +3626,7 @@ var Properties = {
"bookmark-target" : "none | <uri> | <attr>", "bookmark-target" : "none | <uri> | <attr>",
"border" : "<border-width> || <border-style> || <color>", "border" : "<border-width> || <border-style> || <color>",
"border-bottom" : "<border-width> || <border-style> || <color>", "border-bottom" : "<border-width> || <border-style> || <color>",
"border-bottom-color" : "<color>", "border-bottom-color" : "<color> | inherit",
"border-bottom-left-radius" : "<x-one-radius>", "border-bottom-left-radius" : "<x-one-radius>",
"border-bottom-right-radius" : "<x-one-radius>", "border-bottom-right-radius" : "<x-one-radius>",
"border-bottom-style" : "<border-style>", "border-bottom-style" : "<border-style>",
@ -3643,7 +3683,7 @@ var Properties = {
"border-radius" : function(expression) { "border-radius" : function(expression) {
var valid = false, var valid = false,
numeric = "<length> | <percentage>", simple = "<length> | <percentage> | inherit",
slash = false, slash = false,
fill = false, fill = false,
count = 0, count = 0,
@ -3651,7 +3691,7 @@ var Properties = {
part; part;
while (expression.hasNext() && count < max) { while (expression.hasNext() && count < max) {
valid = ValidationTypes.isAny(expression, numeric); valid = ValidationTypes.isAny(expression, simple);
if (!valid) { if (!valid) {
if (expression.peek() == "/" && count > 0 && !slash) { if (expression.peek() == "/" && count > 0 && !slash) {
@ -3742,7 +3782,7 @@ var Properties = {
//D //D
"direction" : "ltr | rtl | inherit", "direction" : "ltr | rtl | inherit",
"display" : "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | box | inline-box | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker", "display" : "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | box | inline-box | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box",
"dominant-baseline" : 1, "dominant-baseline" : 1,
"drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>", "drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>",
"drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
@ -3970,6 +4010,7 @@ var Properties = {
"z-index" : "<integer> | auto | inherit", "z-index" : "<integer> | auto | inherit",
"zoom" : "<number> | <percentage> | normal" "zoom" : "<number> | <percentage> | normal"
}; };
/*global SyntaxUnit, Parser*/ /*global SyntaxUnit, Parser*/
/** /**
* Represents a selector combinator (whitespace, +, >). * Represents a selector combinator (whitespace, +, >).
@ -4203,6 +4244,9 @@ function PropertyValuePart(text, line, col){
case "pt": case "pt":
case "pc": case "pc":
case "ch": case "ch":
case "vh":
case "vw":
case "vm":
this.type = "length"; this.type = "length";
break; break;
@ -5617,6 +5661,7 @@ var Tokens = [
{ name: "FONT_FACE_SYM", text: "@font-face"}, { name: "FONT_FACE_SYM", text: "@font-face"},
{ name: "CHARSET_SYM", text: "@charset"}, { name: "CHARSET_SYM", text: "@charset"},
{ name: "NAMESPACE_SYM", text: "@namespace"}, { name: "NAMESPACE_SYM", text: "@namespace"},
{ name: "VIEWPORT_SYM", text: "@viewport"},
{ name: "UNKNOWN_SYM" }, { name: "UNKNOWN_SYM" },
//{ name: "ATKEYWORD"}, //{ name: "ATKEYWORD"},
@ -6341,14 +6386,11 @@ var ValidationTypes = {
"<x-one-radius>": function(expression) { "<x-one-radius>": function(expression) {
//[ <length> | <percentage> ] [ <length> | <percentage> ]? //[ <length> | <percentage> ] [ <length> | <percentage> ]?
var result = false, var result = false,
count = 0, simple = "<length> | <percentage> | inherit";
numeric = "<length> | <percentage>",
part;
if (ValidationTypes.isAny(expression, numeric)){ if (ValidationTypes.isAny(expression, simple)){
result = true; result = true;
ValidationTypes.isAny(expression, simple);
ValidationTypes.isAny(expression, numeric);
} }
return result; return result;
@ -6378,6 +6420,15 @@ ValidationError :ValidationError
})(); })();
(function(){
for(var prop in parserlib){
exports[prop] = parserlib[prop];
}
})();
/** /**
* Main CSSLint object. * Main CSSLint object.
* @class CSSLint * @class CSSLint
@ -6392,7 +6443,7 @@ var CSSLint = (function(){
embeddedRuleset = /\/\*csslint([^\*]*)\*\//, embeddedRuleset = /\/\*csslint([^\*]*)\*\//,
api = new parserlib.util.EventTarget(); api = new parserlib.util.EventTarget();
api.version = "0.9.10"; api.version = "0.10.0";
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Rule Management // Rule Management
@ -6615,6 +6666,7 @@ var CSSLint = (function(){
return api; return api;
})(); })();
/*global CSSLint*/ /*global CSSLint*/
/** /**
* An instance of Report is used to report results of the * An instance of Report is used to report results of the
@ -7763,6 +7815,7 @@ CSSLint.addRule({
} }
}); });
/* /*
* Rule: Don't use IDs for selectors. * Rule: Don't use IDs for selectors.
*/ */
@ -8176,6 +8229,7 @@ CSSLint.addRule({
} }
}); });
/* /*
* Rule: Warn people past the IE 4095 limit * Rule: Warn people past the IE 4095 limit
*/ */

View file

@ -11,7 +11,7 @@ var rootDir = __dirname + "/../lib/ace/";
var deps = { var deps = {
csslint: { csslint: {
path: "mode/css/csslint.js", path: "mode/css/csslint.js",
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js", url: "https://raw.github.com/stubbornella/csslint/master/release/csslint.js",
needsFixup: true needsFixup: true
}, },
requirejs: { requirejs: {