update jshint and coffee

This commit is contained in:
nightwing 2013-05-23 01:11:10 +04:00
commit 505847681d
11 changed files with 5858 additions and 2700 deletions

View file

@ -25,7 +25,7 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.3
var buildLocationData, extend, flatten, last, repeat, _ref;
@ -214,11 +214,11 @@ define(function(require, exports, module) {
};
exports.throwSyntaxError = function(message, location) {
var error, _ref1, _ref2;
if ((_ref1 = location.last_line) == null) {
var error;
if (location.last_line == null) {
location.last_line = location.first_line;
}
if ((_ref2 = location.last_column) == null) {
if (location.last_column == null) {
location.last_column = location.first_column;
}
error = new SyntaxError(message);
@ -226,11 +226,13 @@ define(function(require, exports, module) {
throw error;
};
exports.prettyErrorMessage = function(error, fileName, code, useColors) {
exports.prettyErrorMessage = function(error, filename, code, useColors) {
var codeLine, colorize, end, first_column, first_line, last_column, last_line, marker, message, start, _ref1;
if (!error.location) {
return error.stack || ("" + error);
}
filename = error.filename || filename;
code = error.code || code;
_ref1 = error.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column;
codeLine = code.split('\n')[first_line];
start = first_column;
@ -243,7 +245,7 @@ define(function(require, exports, module) {
codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
marker = colorize(marker);
}
message = "" + fileName + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + error.message + "\n" + codeLine + "\n" + marker;
message = "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + error.message + "\n" + codeLine + "\n" + marker;
return message;
};

View file

@ -25,14 +25,14 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.3
var BOM, 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, invertLiterate, key, last, locationDataToString, starts, throwSyntaxError, _ref, _ref1,
var BOM, 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, invertLiterate, key, last, locationDataToString, repeat, starts, throwSyntaxError, _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; };
_ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES;
_ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
_ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, repeat = _ref1.repeat, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
exports.Lexer = Lexer = (function() {
function Lexer() {}
@ -182,10 +182,10 @@ define(function(require, exports, module) {
}
lexedLength = number.length;
if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16);
number = '0x' + parseInt(octalLiteral[1], 8).toString(16);
}
if (binaryLiteral = /^0b([01]+)/.exec(number)) {
number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16);
number = '0x' + parseInt(binaryLiteral[1], 2).toString(16);
}
this.token('NUMBER', number, 0, lexedLength);
return lexedLength;
@ -255,7 +255,7 @@ define(function(require, exports, module) {
if (here) {
this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
herecomment: true,
indent: Array(this.indent + 1).join(' ')
indent: repeat(' ', this.indent)
}), 0, comment.length);
}
return comment.length;
@ -737,7 +737,7 @@ define(function(require, exports, module) {
column = this.chunkColumn;
if (lineCount > 0) {
lines = string.split('\n');
column = (last(lines)).length;
column = last(lines).length;
} else {
column += string.length;
}
@ -903,9 +903,9 @@ define(function(require, exports, module) {
BOOL = ['TRUE', 'FALSE'];
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']'];
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--'];
NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING');
NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING', ']');
CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];

View file

@ -25,7 +25,7 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.3
var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, CodeFragment, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, last, locationDataToString, merge, multident, some, starts, throwSyntaxError, unfoldSoak, utility, _ref, _ref1, _ref2, _ref3,
__hasProp = {}.hasOwnProperty,
@ -71,7 +71,7 @@ define(function(require, exports, module) {
}
CodeFragment.prototype.toString = function() {
return "" + this.code + [this.locationData ? ": " + locationDataToString(this.locationData) : void 0];
return "" + this.code + (this.locationData ? ": " + locationDataToString(this.locationData) : '');
};
return CodeFragment;
@ -503,6 +503,8 @@ define(function(require, exports, module) {
fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB))));
}
fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : '')));
} else if (fragments.length && post.length) {
fragments.push(this.makeCode("\n"));
}
}
return fragments.concat(post);
@ -662,7 +664,7 @@ define(function(require, exports, module) {
Return.prototype.compileNode = function(o) {
var answer;
answer = [];
answer.push(this.makeCode(this.tab + ("return" + [this.expression ? " " : void 0])));
answer.push(this.makeCode(this.tab + ("return" + (this.expression ? " " : ""))));
if (this.expression) {
answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN));
}
@ -801,17 +803,16 @@ define(function(require, exports, module) {
};
Value.prototype.unfoldSoak = function(o) {
var _ref4,
_this = this;
return (_ref4 = this.unfoldedSoak) != null ? _ref4 : this.unfoldedSoak = (function() {
var fst, i, ifn, prop, ref, snd, _i, _len, _ref5, _ref6;
var _this = this;
return this.unfoldedSoak != null ? this.unfoldedSoak : this.unfoldedSoak = (function() {
var fst, i, ifn, prop, ref, snd, _i, _len, _ref4, _ref5;
if (ifn = _this.base.unfoldSoak(o)) {
(_ref5 = ifn.body.properties).push.apply(_ref5, _this.properties);
(_ref4 = ifn.body.properties).push.apply(_ref4, _this.properties);
return ifn;
}
_ref6 = _this.properties;
for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) {
prop = _ref6[i];
_ref5 = _this.properties;
for (i = _i = 0, _len = _ref5.length; _i < _len; i = ++_i) {
prop = _ref5[i];
if (!prop.soak) {
continue;
}
@ -1336,7 +1337,7 @@ define(function(require, exports, module) {
}
answer.push.apply(answer, fragments);
}
if ((fragmentsToText(answer)).indexOf('\n') >= 0) {
if (fragmentsToText(answer).indexOf('\n') >= 0) {
answer.unshift(this.makeCode("[\n" + o.indent));
answer.push(this.makeCode("\n" + this.tab + "]"));
} else {
@ -2334,7 +2335,7 @@ define(function(require, exports, module) {
Op.prototype.compileExistence = function(o) {
var fst, ref;
if (this.first.isComplex()) {
if (!o.isExistentialEquals && this.first.isComplex()) {
ref = new Literal(o.scope.freeVariable('ref'));
fst = new Parens(new Assign(ref, this.first));
} else {
@ -2438,7 +2439,7 @@ define(function(require, exports, module) {
var fragments, ref, sub, _ref4;
_ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1];
fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0')));
if ((fragmentsToText(sub)) === (fragmentsToText(ref))) {
if (fragmentsToText(sub) === fragmentsToText(ref)) {
return fragments;
}
fragments = sub.concat(this.makeCode(', '), fragments);
@ -2610,6 +2611,9 @@ define(function(require, exports, module) {
if (this.range && this.pattern) {
this.name.error('cannot pattern match over range loops');
}
if (this.own && !this.object) {
this.index.error('cannot use own with for-in');
}
this.returns = false;
}

View file

@ -25,9 +25,9 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.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, generate, left, rite, _i, _len, _ref,
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,
__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;
@ -300,7 +300,7 @@ define(function(require, exports, module) {
startImplicitCall(i + 1);
return forward(2);
}
if (this.matchTags(i, IMPLICIT_FUNC, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
startImplicitCall(i + 1);
stack.push(['INDENT', i + 2]);
return forward(3);
@ -385,8 +385,8 @@ define(function(require, exports, module) {
var action, condition, indent, outdent, starter;
starter = indent = outdent = null;
condition = function(token, i) {
var _ref;
return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN'));
var _ref, _ref1;
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 === '=>'));
};
action = function(token, i) {
return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
@ -501,8 +501,6 @@ define(function(require, exports, module) {
IMPLICIT_UNSPACED_CALL = ['+', '-'];
IMPLICIT_BLOCK = ['->', '=>', '{', '[', ','];
IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];

View file

@ -25,7 +25,7 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.3
var Scope, extend, last, _ref;

File diff suppressed because it is too large Load diff

View file

@ -1,20 +1,42 @@
define(function(require, exports, module) {
/*global exports:true require:true define:true console:true */
/*global exports:true module:true require:true define:true global:true */
(function (root, name, factory) {
'use strict';
if (typeof exports !== 'undefined') {
factory(exports);
} else if (typeof define === 'function' && define.amd) {
var freeExports = typeof exports === 'object' && exports
// While CommonJS defines `module` as an object, component define it as a
// function
, freeModule = (typeof module === 'object' || typeof module === 'function') &&
module && module.exports === freeExports && module;
// Detect free variable `global`, from Node.js or Browserified code, and use
// it as `root`
var freeGlobal = typeof global === 'object' && global;
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)
root = freeGlobal;
// Some AMD build optimizers, like r.js, check for specific condition
// patterns like the following:
if (typeof define === 'function' && define.amd) {
define(['exports'], factory);
} else {
}
// check for `exports` after `define` in case a build optimizer adds an
// `exports` object
else if (freeExports && !freeExports.nodeType) {
// in Node.js or RingoJS v0.8.0+
if (freeModule) factory(freeModule.exports);
// in Narwhal or RingoJS v0.7.0-
else factory(freeExports);
}
// in a browser or Rhino
else {
factory((root[name] = {}));
}
}(this, 'luaparse', function (exports) {
'use strict';
exports.version = '0.0.11';
exports.version = '0.0.14';
var input, options, length;
@ -306,10 +328,9 @@ define(function(require, exports, module) {
var slice = Array.prototype.slice
, toString = Object.prototype.toString
// Simple indexOf implementation which only provides what's required.
, indexOf = Array.prototype.indexOf || function indexOf(element) {
for (var i = 0, length = this.length; i < length; i++) {
if (this[i] === element) return i;
, indexOf = function indexOf(array, element) {
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === element) return i;
}
return -1;
};
@ -446,7 +467,7 @@ define(function(require, exports, module) {
// containing its value and as well as its position in the input string (this
// is always enabled to provide proper debug messages).
//
// `readToken()` starts lexing and returns the following token in the stream.
// `lex()` starts lexing and returns the following token in the stream.
var index
, token
@ -456,7 +477,9 @@ define(function(require, exports, module) {
, line
, lineStart;
function readToken() {
exports.lex = lex;
function lex() {
skipWhiteSpace();
// Skip comments beginning with --
@ -887,7 +910,6 @@ define(function(require, exports, module) {
// Once the delimiter is found, iterate through the depth count and see
// if it matches.
if (']' === character) {
terminator = true;
for (var i = 0; i < level; i++) {
@ -914,7 +936,7 @@ define(function(require, exports, module) {
function next() {
token = lookahead;
lookahead = readToken();
lookahead = lex();
}
// Consume a token if its value matches. Once consumed or not, return the
@ -1045,7 +1067,7 @@ define(function(require, exports, module) {
// Add identifier name to the current scope if it doesnt already exist.
function scopeIdentifierName(name) {
if (-1 !== indexOf.call(scopes[scopeDepth], name)) return;
if (-1 !== indexOf(scopes[scopeDepth], name)) return;
scopes[scopeDepth].push(name);
}
@ -1058,7 +1080,7 @@ define(function(require, exports, module) {
// Attach scope information to node. If the node is global, store it in the
// globals array so we can return the information to the user.
function attachScope(node, isLocal) {
if (!isLocal && -1 === indexOf.call(globalNames, node.name)) {
if (!isLocal && -1 === indexOf(globalNames, node.name)) {
globalNames.push(node.name);
globals.push(node);
}
@ -1068,7 +1090,7 @@ define(function(require, exports, module) {
// Is the identifier name available in this scope.
function scopeHasName(name) {
return (-1 !== indexOf.call(scopes[scopeDepth], name));
return (-1 !== indexOf(scopes[scopeDepth], name));
}
@ -1285,9 +1307,9 @@ define(function(require, exports, module) {
expect('end');
return ast.forNumericStatement(variable, start, end, step, body);
}
// If not, it's a Generic For Statement
} else {
else {
// The namelist can contain one or more identifiers.
var variables = [variable];
while (consume(',')) {
@ -1446,8 +1468,9 @@ define(function(require, exports, module) {
if (consume(',')) continue;
else if (consume(')')) break;
}
// No arguments are allowed after a vararg.
} else if (VarargLiteral === token.type) {
else if (VarargLiteral === token.type) {
parameters.push(parsePrimaryExpression());
expect(')');
break;
@ -1729,7 +1752,6 @@ define(function(require, exports, module) {
var table = parseTableConstructor();
return ast.tableCallExpression(base, table);
}
} else if (StringLiteral === token.type) {
return ast.stringCallExpression(base, parsePrimaryExpression());
}
@ -1815,7 +1837,7 @@ define(function(require, exports, module) {
length = input.length;
// Initialize with a lookahead token.
lookahead = readToken();
lookahead = lex();
var chunk = parseChunk();
if (options.comments) chunk.comments = comments;
@ -1823,9 +1845,6 @@ define(function(require, exports, module) {
return chunk;
}
// Expose the lex function
exports.lex = readToken;
}));
/* vim: set sw=2 ts=2 et tw=79 : */

View file

@ -220,6 +220,6 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
UIWorkerClient.prototype = WorkerClient.prototype;
exports.UIWorkerClient = UIWorkerClient;
exports.WorkerClient = WorkerClient;
exports.WorkerClient = UIWorkerClient;
});