Slightly better error messages (#150)
* Slightly better errors Instead of "Unexpected token" we now print "Unexpected token, expected <type.label>"
This commit is contained in:
committed by
Henry Zhu
parent
4fc0a3839e
commit
d4d6d05d25
@@ -74,7 +74,7 @@ pp.semicolon = function () {
|
||||
// raise an unexpected token error at given pos.
|
||||
|
||||
pp.expect = function (type, pos) {
|
||||
return this.eat(type) || this.unexpected(pos);
|
||||
return this.eat(type) || this.unexpected(pos, `Unexpected token, expected ${type.label}`);
|
||||
};
|
||||
|
||||
// Raise an unexpected token error.
|
||||
|
||||
Reference in New Issue
Block a user