mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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/
|
mkdir ../dist/
|
||||||
fi
|
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
|
#./preprocess.sh $MODE ../src/paper.js '{ "server": true }' ../src/constants.js ../dist/paper-server.js
|
||||||
|
|
|
@ -33,5 +33,5 @@ cd ..
|
||||||
if [ $MODE = "docs" ]
|
if [ $MODE = "docs" ]
|
||||||
then
|
then
|
||||||
# Build paper.js library for documentation
|
# 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
|
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");
|
return finishNode(node, "Literal");
|
||||||
|
|
||||||
case _parenL:
|
case _parenL:
|
||||||
|
var tokStartLoc1 = tokStartLoc, tokStart1 = tokStart;
|
||||||
next();
|
next();
|
||||||
var val = parseExpression();
|
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);
|
expect(_parenR);
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
|
@ -1592,4 +1601,4 @@
|
||||||
return finishNode(node, "Identifier");
|
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({
|
var context = vm.createContext({
|
||||||
options: {
|
options: {
|
||||||
server: true,
|
server: true,
|
||||||
|
parser: 'acorn',
|
||||||
version: 'dev'
|
version: 'dev'
|
||||||
},
|
},
|
||||||
fs: fs,
|
fs: fs,
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
/*#*/ if (options.parser == 'acorn') {
|
/*#*/ if (options.parser == 'acorn') {
|
||||||
/*#*/ include('../../lib/acorn-min.js');
|
/*#*/ include('../../lib/acorn-min.js');
|
||||||
/*#*/ } else {
|
/*#*/ } else if (options.parser == 'esprima') {
|
||||||
/*#*/ include('../../lib/esprima-min.js');
|
/*#*/ include('../../lib/esprima-min.js');
|
||||||
/*#*/ }
|
/*#*/ }
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ var PaperScript = this.PaperScript = new function() {
|
||||||
// Now do the parsing magic
|
// Now do the parsing magic
|
||||||
/*#*/ if (options.parser == 'acorn') {
|
/*#*/ if (options.parser == 'acorn') {
|
||||||
walkAst(acorn.parse(code, { ranges: true }));
|
walkAst(acorn.parse(code, { ranges: true }));
|
||||||
/*#*/ } else {
|
/*#*/ } else if (options.parser == 'esprima') {
|
||||||
walkAst(esprima.parse(code, { range: true }));
|
walkAst(esprima.parse(code, { range: true }));
|
||||||
/*#*/ }
|
/*#*/ }
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
var options = {
|
var options = {
|
||||||
browser: true,
|
browser: true,
|
||||||
stats: true,
|
stats: true,
|
||||||
version: 'dev'
|
version: 'dev',
|
||||||
|
parser: 'acorn'
|
||||||
};
|
};
|
||||||
|
|
||||||
// This folder is specified relatively to the lib folder from which prepro.js is
|
// This folder is specified relatively to the lib folder from which prepro.js is
|
||||||
|
|
Loading…
Reference in a new issue