Directly expose Acorn parser through PaperScript.parse(), and replace options.inline with options.source.

This commit is contained in:
Jürg Lehni 2014-04-30 16:40:11 +02:00
parent c36712758b
commit 2d702d0247

View file

@ -279,8 +279,9 @@ Base.exports.PaperScript = (function() {
};
// Include the original code in the sourceMap if there is no linked
// source file so the debugger can still display it correctly.
if (!url || options.inline)
sourceMap.sourcesContent = [code];
var source = options.source || !url && code;
if (source)
sourceMap.sourcesContent = [source];
}
// Now do the parsing magic
walkAST(scope.acorn.parse(code, { ranges: true }));
@ -462,7 +463,7 @@ Base.exports.PaperScript = (function() {
compile: compile,
execute: execute,
load: load,
acorn: scope.acorn
parse: scope.acorn.parse
};
/*#*/ } else { // !__options.environment == 'browser'
@ -495,7 +496,7 @@ Base.exports.PaperScript = (function() {
return {
compile: compile,
execute: execute,
acorn: scope.acorn
parse: scope.acorn.parse
};
/*#*/ } // !__options.environment == 'browser'