mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Update acorn to latest version.
Should hopefully solve issues with node.js
This commit is contained in:
parent
7b8e27ddd9
commit
e6f5786261
2 changed files with 23 additions and 14 deletions
2
lib/acorn-min.js
vendored
2
lib/acorn-min.js
vendored
File diff suppressed because one or more lines are too long
35
lib/acorn.js
35
lib/acorn.js
|
@ -20,10 +20,14 @@
|
|||
// [dammit]: acorn_loose.js
|
||||
// [walk]: util/walk.js
|
||||
|
||||
(function(exports) {
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") return mod(exports); // CommonJS
|
||||
if (typeof define == "function" && define.amd) return define(["exports"], mod); // AMD
|
||||
mod(self.acorn || (self.acorn = {})); // Plain browser env
|
||||
})(function(exports) {
|
||||
"use strict";
|
||||
|
||||
exports.version = "0.1.01";
|
||||
exports.version = "0.2.01";
|
||||
|
||||
// The main exported interface (under `self.acorn` when in the
|
||||
// browser) is a `parse` function that takes a code string and
|
||||
|
@ -418,17 +422,17 @@
|
|||
|
||||
// Test whether a given character code starts an identifier.
|
||||
|
||||
function isIdentifierStart(code) {
|
||||
var isIdentifierStart = exports.isIdentifierStart = function(code) {
|
||||
if (code < 65) return code === 36;
|
||||
if (code < 91) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code < 123)return true;
|
||||
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
||||
}
|
||||
};
|
||||
|
||||
// Test whether a given character is part of an identifier.
|
||||
|
||||
function isIdentifierChar(code) {
|
||||
var isIdentifierChar = exports.isIdentifierChar = function(code) {
|
||||
if (code < 48) return code === 36;
|
||||
if (code < 58) return true;
|
||||
if (code < 65) return false;
|
||||
|
@ -436,7 +440,7 @@
|
|||
if (code < 97) return code === 95;
|
||||
if (code < 123)return true;
|
||||
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
||||
}
|
||||
};
|
||||
|
||||
// ## Tokenizer
|
||||
|
||||
|
@ -679,7 +683,8 @@
|
|||
}
|
||||
|
||||
function readToken(forceRegexp) {
|
||||
tokStart = tokPos;
|
||||
if (!forceRegexp) tokStart = tokPos;
|
||||
else tokPos = tokStart + 1;
|
||||
if (options.locations) tokStartLoc = new line_loc_t;
|
||||
if (forceRegexp) return readRegexp();
|
||||
if (tokPos >= inputLen) return finishToken(_eof);
|
||||
|
@ -821,7 +826,7 @@
|
|||
case 85: out += String.fromCharCode(readHexChar(8)); break; // 'U'
|
||||
case 116: out += "\t"; break; // 't' -> '\t'
|
||||
case 98: out += "\b"; break; // 'b' -> '\b'
|
||||
case 118: out += "\v"; break; // 'v' -> '\u000b'
|
||||
case 118: out += "\u000b"; break; // 'v' -> '\u000b'
|
||||
case 102: out += "\f"; break; // 'f' -> '\f'
|
||||
case 48: out += "\0"; break; // 0 -> '\0'
|
||||
case 13: if (input.charCodeAt(tokPos) === 10) ++tokPos; // '\r\n'
|
||||
|
@ -940,6 +945,10 @@
|
|||
function setStrict(strct) {
|
||||
strict = strct;
|
||||
tokPos = lastEnd;
|
||||
while (tokPos < tokLineStart) {
|
||||
tokLineStart = input.lastIndexOf("\n", tokLineStart - 2) + 1;
|
||||
--tokCurLine;
|
||||
}
|
||||
skipSpace();
|
||||
readToken();
|
||||
}
|
||||
|
@ -1226,8 +1235,8 @@
|
|||
case _try:
|
||||
next();
|
||||
node.block = parseBlock();
|
||||
node.handlers = [];
|
||||
while (tokType === _catch) {
|
||||
node.handler = null;
|
||||
if (tokType === _catch) {
|
||||
var clause = startNode();
|
||||
next();
|
||||
expect(_parenL);
|
||||
|
@ -1237,10 +1246,10 @@
|
|||
expect(_parenR);
|
||||
clause.guard = null;
|
||||
clause.body = parseBlock();
|
||||
node.handlers.push(finishNode(clause, "CatchClause"));
|
||||
node.handler = finishNode(clause, "CatchClause");
|
||||
}
|
||||
node.finalizer = eat(_finally) ? parseBlock() : null;
|
||||
if (!node.handlers.length && !node.finalizer)
|
||||
if (!node.handler && !node.finalizer)
|
||||
raise(node.start, "Missing catch or finally clause");
|
||||
return finishNode(node, "TryStatement");
|
||||
|
||||
|
@ -1707,4 +1716,4 @@
|
|||
return finishNode(node, "Identifier");
|
||||
}
|
||||
|
||||
})(typeof exports === "undefined" ? (self.acorn = {}) : exports);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue