};
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);
};
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); };
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":
next();
expect("(");
var name = as_symbol();
- next();
expect(")");
bcatch = new AST_Catch({
argname : name,