mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Update Acorn.js and use it now by default, thanks to Marijn's fast bugfix:
https://github.com/marijnh/acorn/issues/14
This commit is contained in:
parent
14642e63b3
commit
302f23bc5a
7 changed files with 18 additions and 7 deletions
|
@ -34,5 +34,5 @@ then
|
|||
mkdir ../dist/
|
||||
fi
|
||||
|
||||
./preprocess.sh $MODE ../src/paper.js '{ "browser": true }' ../src/constants.js ../dist/paper.js
|
||||
./preprocess.sh $MODE ../src/paper.js '{ "browser": true, "parser": "acorn" }' ../src/constants.js ../dist/paper.js
|
||||
#./preprocess.sh $MODE ../src/paper.js '{ "server": true }' ../src/constants.js ../dist/paper-server.js
|
||||
|
|
|
@ -33,5 +33,5 @@ cd ..
|
|||
if [ $MODE = "docs" ]
|
||||
then
|
||||
# Build paper.js library for documentation
|
||||
./preprocess.sh stripped ../src/paper.js '{ "browser": true }' ../src/constants.js ../dist/docs/resources/js/paper.js
|
||||
./preprocess.sh stripped ../src/paper.js '{ "browser": true, "parser": "acorn" }' ../src/constants.js ../dist/docs/resources/js/paper.js
|
||||
fi
|
||||
|
|
2
lib/acorn-min.js
vendored
2
lib/acorn-min.js
vendored
File diff suppressed because one or more lines are too long
11
lib/acorn.js
11
lib/acorn.js
|
@ -1433,8 +1433,17 @@
|
|||
return finishNode(node, "Literal");
|
||||
|
||||
case _parenL:
|
||||
var tokStartLoc1 = tokStartLoc, tokStart1 = tokStart;
|
||||
next();
|
||||
var val = parseExpression();
|
||||
val.start = tokStart1;
|
||||
val.end = tokEnd;
|
||||
if (options.locations) {
|
||||
val.loc.start = tokStartLoc1;
|
||||
val.loc.end = tokEndLoc;
|
||||
}
|
||||
if (options.ranges)
|
||||
val.range = [tokStart1, tokEnd];
|
||||
expect(_parenR);
|
||||
return val;
|
||||
|
||||
|
@ -1592,4 +1601,4 @@
|
|||
return finishNode(node, "Identifier");
|
||||
}
|
||||
|
||||
})(typeof exports === "undefined" ? (window.acorn = {}) : exports);
|
||||
})(typeof exports === "undefined" ? (window.acorn = {}) : exports);
|
||||
|
|
|
@ -9,6 +9,7 @@ __dirname = path.resolve(__dirname, '../src/');
|
|||
var context = vm.createContext({
|
||||
options: {
|
||||
server: true,
|
||||
parser: 'acorn',
|
||||
version: 'dev'
|
||||
},
|
||||
fs: fs,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/*#*/ if (options.parser == 'acorn') {
|
||||
/*#*/ include('../../lib/acorn-min.js');
|
||||
/*#*/ } else {
|
||||
/*#*/ } else if (options.parser == 'esprima') {
|
||||
/*#*/ include('../../lib/esprima-min.js');
|
||||
/*#*/ }
|
||||
|
||||
|
@ -189,7 +189,7 @@ var PaperScript = this.PaperScript = new function() {
|
|||
// Now do the parsing magic
|
||||
/*#*/ if (options.parser == 'acorn') {
|
||||
walkAst(acorn.parse(code, { ranges: true }));
|
||||
/*#*/ } else {
|
||||
/*#*/ } else if (options.parser == 'esprima') {
|
||||
walkAst(esprima.parse(code, { range: true }));
|
||||
/*#*/ }
|
||||
return code;
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
var options = {
|
||||
browser: true,
|
||||
stats: true,
|
||||
version: 'dev'
|
||||
version: 'dev',
|
||||
parser: 'acorn'
|
||||
};
|
||||
|
||||
// This folder is specified relatively to the lib folder from which prepro.js is
|
||||
|
|
Loading…
Reference in a new issue