Update PaperScript to work with new parse-js and beautify code so that line numbers in error messages remain correct.

This commit is contained in:
Jürg Lehni 2011-06-28 10:52:50 +02:00
parent dcc7d29726
commit 28921e9a76

View file

@ -88,8 +88,8 @@ var PaperScript = this.PaperScript = new function() {
// Use parse-js to translate the code into a AST structure which is then // Use parse-js to translate the code into a AST structure which is then
// walked and parsed for operators to overload. The resulting AST is // walked and parsed for operators to overload. The resulting AST is
// translated back to code and evaluated. // translated back to code and evaluated.
var ast = parse_js.parse(code), var ast = parse_js.parse(code, true),
walker = parse_js.walker(), walker = parse_js.ast_walker(),
walk = walker.walk; walk = walker.walk;
ast = walker.with_walkers({ ast = walker.with_walkers({
@ -125,7 +125,7 @@ var PaperScript = this.PaperScript = new function() {
return walk(ast); return walk(ast);
}); });
return parse_js.stringify(ast, true); return parse_js.gen_code(ast, true);
} }
function evaluate(code, scope) { function evaluate(code, scope) {