Fixes some gotchas.
DynarchLIB (660K) now passes parsing in 440ms (about 30% slower than the parser in UglifyJS v1).
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user