update jshint and coffee
This commit is contained in:
parent
290cf191d5
commit
505847681d
11 changed files with 5858 additions and 2700 deletions
|
|
@ -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 : */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue