Remove support for Esprima as Acorn.js does everything we need.

This commit is contained in:
Jürg Lehni 2014-04-30 16:26:04 +02:00
parent e96ec6a2f1
commit 43f319e762
3 changed files with 3 additions and 13 deletions

View file

@ -26,7 +26,6 @@
"devDependencies": {
"straps": "~1.5.2",
"acorn": "git://github.com/paperjs/acorn#0.3.2",
"esprima": "~1.0.3",
"stats.js": "r11"
},
"keywords": [

View file

@ -10,5 +10,4 @@
#
# All rights reserved.
../node_modules/.bin/uglifyjs ../bower_components/acorn/acorn.js -o ../bower_components/acorn/acorn.min.js -c -m -b ascii_only=true,beautify=false
../node_modules/.bin/uglifyjs ../bower_components/esprima/esprima.js -o ../bower_components/esprima/esprima.min.js -c -m -b ascii_only=true,beautify=false
../node_modules/.bin/uglifyjs ../bower_components/acorn/acorn.js -o ../bower_components/acorn/acorn.min.js -c -m -b ascii_only=true,beautify=falsefy=false

View file

@ -15,16 +15,12 @@
* @namespace
*/
Base.exports.PaperScript = (function() {
// Locally turn of exports and define for inlined acorn / esprima.
// Locally turn of exports and define for inlined acorn.
// Just declaring the local vars is enough, as they will be undefined.
var exports, define,
// The scope into which the library is loaded.
scope = this;
/*#*/ if (__options.parser == 'acorn') {
/*#*/ include('../../bower_components/acorn/acorn.min.js', { exports: false });
/*#*/ } else if (__options.parser == 'esprima') {
/*#*/ include('../../bower_components/esprima/esprima.min.js', { exports: false });
/*#*/ }
// We need some browser info for dealing with source maps and code offsets
var ua = navigator.userAgent,
@ -287,11 +283,7 @@ Base.exports.PaperScript = (function() {
sourceMap.sourcesContent = [code];
}
// Now do the parsing magic
/*#*/ if (__options.parser == 'acorn') {
walkAST(scope.acorn.parse(code, { ranges: true, locations: true }));
/*#*/ } else if (__options.parser == 'esprima') {
walkAST(scope.esprima.parse(code, { range: true, loc: true }));
/*#*/ }
walkAST(scope.acorn.parse(code, { ranges: true }));
if (sourceMap) {
// Adjust the line offset of the resulting code if required.