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:
Daniel Tschinder
2016-10-12 16:38:26 +02:00
committed by Henry Zhu
parent 4fc0a3839e
commit d4d6d05d25
71 changed files with 127 additions and 469 deletions

View File

@@ -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.