aboutsummaryrefslogtreecommitdiff
path: root/lib/parse.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-05-27 14:36:44 +0300
committerMihai Bazon <mihai@bazon.net>2012-05-27 14:36:44 +0300
commit46e7507b44c93cb1d9e141e583dc58600bbc037f (patch)
tree4c828fd71fc4bde191e1a02bf973cbb26375fdfd /lib/parse.js
parent562b12f021c8b26f5cb52fb322f6465dac4aadc9 (diff)
downloadtracifyjs-46e7507b44c93cb1d9e141e583dc58600bbc037f.tar.gz
tracifyjs-46e7507b44c93cb1d9e141e583dc58600bbc037f.zip
Fixes some gotchas.
DynarchLIB (660K) now passes parsing in 440ms (about 30% slower than the parser in UglifyJS v1).
Diffstat (limited to 'lib/parse.js')
-rw-r--r--lib/parse.js7
1 files changed, 4 insertions, 3 deletions
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,