From: Mihai Bazon Date: Sun, 27 May 2012 11:36:44 +0000 (+0300) Subject: Fixes some gotchas. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=46e7507b44c93cb1d9e141e583dc58600bbc037f;p=UglifyJS.git Fixes some gotchas. DynarchLIB (660K) now passes parsing in 440ms (about 30% slower than the parser in UglifyJS v1). --- diff --git a/lib/parse.js b/lib/parse.js index 468e348a..7164f3ee 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -203,6 +203,8 @@ JS_Parse_Error.prototype.toString = function() { }; function js_error(message, line, col, pos) { + console.log("***", message); + console.log("*** LINE:", line, "COL:", col, "POS:", pos); throw new JS_Parse_Error(message, line, col, pos); }; @@ -676,7 +678,7 @@ function parse($TEXT, exigent_mode) { if (is(type, val)) { return next(); } - token_error(S.token, "Unexpected token " + S.token.type + ", expected " + type); + token_error(S.token, "Unexpected token " + S.token.type + " «" + S.token.value + "»" + ", expected " + type + " «" + val + "»"); }; function expect(punc) { return expect_token("punc", punc); }; @@ -762,7 +764,7 @@ function parse($TEXT, exigent_mode) { case "do": return new AST_Do({ body : in_loop(statement), - condition : (expect_token("while"), prog1(parenthesised, semicolon)) + condition : (expect_token("keyword", "while"), prog1(parenthesised, semicolon)) }); case "while": @@ -988,7 +990,6 @@ function parse($TEXT, exigent_mode) { next(); expect("("); var name = as_symbol(); - next(); expect(")"); bcatch = new AST_Catch({ argname : name,