Fix "Better error messaging for unexpected tokens #6715" (#6875)

This commit is contained in:
Gidi Meir Morris
2017-11-22 21:31:03 +00:00
committed by Brian Ng
parent 8393a6d089
commit edbf5d33dc
141 changed files with 141 additions and 141 deletions

View File

@@ -1 +1 @@
SyntaxError: test.js: Unexpected token, expected ; (2:10)
SyntaxError: test.js: Unexpected token, expected ";" (2:10)

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (2:10)"
"throws": "Unexpected token, expected \";\" (2:10)"
}

View File

@@ -1361,7 +1361,7 @@ export default class StatementParser extends ExpressionParser {
// export async;
if (next.type !== tt._function) {
this.unexpected(next.start, "Unexpected token, expected function");
this.unexpected(next.start, `Unexpected token, expected "function"`);
}
}

View File

@@ -110,7 +110,7 @@ export default class UtilParser extends Tokenizer {
messageOrType: string | TokenType = "Unexpected token",
): empty {
if (typeof messageOrType !== "string") {
messageOrType = `Unexpected token, expected ${messageOrType.label}`;
messageOrType = `Unexpected token, expected "${messageOrType.label}"`;
}
throw this.raise(pos != null ? pos : this.state.start, messageOrType);
}

View File

@@ -1059,7 +1059,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
if (this.state.value === "-") {
this.next();
if (!this.match(tt.num)) {
this.unexpected(null, "Unexpected token, expected number");
this.unexpected(null, `Unexpected token, expected "number"`);
}
return this.parseLiteral(

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:9)"
"throws": "Unexpected token, expected \",\" (1:9)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:6)"
"throws": "Unexpected token, expected \";\" (1:6)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:6)"
"throws": "Unexpected token, expected \";\" (1:6)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:12)"
"throws": "Unexpected token, expected \",\" (1:12)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:16)"
"throws": "Unexpected token, expected \",\" (1:16)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:13)"
"throws": "Unexpected token, expected \",\" (1:13)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ) (1:18)"
"throws": "Unexpected token, expected \")\" (1:18)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:2)"
"throws": "Unexpected token, expected \";\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ( (1:2)"
"throws": "Unexpected token, expected \"(\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:2)"
"throws": "Unexpected token, expected \";\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:2)"
"throws": "Unexpected token, expected \";\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:15)"
"throws": "Unexpected token, expected \";\" (1:15)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:14)"
"throws": "Unexpected token, expected \";\" (1:14)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected while (1:9)"
"throws": "Unexpected token, expected \"while\" (1:9)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:9)"
"throws": "Unexpected token, expected \";\" (1:9)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:8)"
"throws": "Unexpected token, expected \";\" (1:8)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:9)"
"throws": "Unexpected token, expected \";\" (1:9)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:16)"
"throws": "Unexpected token, expected \";\" (1:16)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (2:4)"
"throws": "Unexpected token, expected \";\" (2:4)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (2:6)"
"throws": "Unexpected token, expected \";\" (2:6)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:16)"
"throws": "Unexpected token, expected \";\" (1:16)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:16)"
"throws": "Unexpected token, expected \";\" (1:16)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ] (1:9)"
"throws": "Unexpected token, expected \"]\" (1:9)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ( (1:17)"
"throws": "Unexpected token, expected \"(\" (1:17)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ( (1:7)"
"throws": "Unexpected token, expected \"(\" (1:7)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected } (1:18)"
"throws": "Unexpected token, expected \"}\" (1:18)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected } (1:11)"
"throws": "Unexpected token, expected \"}\" (1:11)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected { (1:13)"
"throws": "Unexpected token, expected \"{\" (1:13)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ) (1:18)"
"throws": "Unexpected token, expected \")\" (1:18)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ) (1:19)"
"throws": "Unexpected token, expected \")\" (1:19)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ) (1:5)"
"throws": "Unexpected token, expected \")\" (1:5)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected { (1:15)"
"throws": "Unexpected token, expected \"{\" (1:15)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected { (1:19)"
"throws": "Unexpected token, expected \"{\" (1:19)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected { (1:22)"
"throws": "Unexpected token, expected \"{\" (1:22)"
}

View File

@@ -1,5 +1,5 @@
{
"sourceType": "module",
"throws": "Unexpected token, expected { (1:7)"
"throws": "Unexpected token, expected \"{\" (1:7)"
}

View File

@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token, expected { (1:7)"
"throws": "Unexpected token, expected \"{\" (1:7)"
}

View File

@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token, expected { (1:7)"
"throws": "Unexpected token, expected \"{\" (1:7)"
}

View File

@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token, expected { (1:7)"
"throws": "Unexpected token, expected \"{\" (1:7)"
}

View File

@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token, expected { (1:7)"
"throws": "Unexpected token, expected \"{\" (1:7)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected { (1:22)"
"throws": "Unexpected token, expected \"{\" (1:22)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:6)"
"throws": "Unexpected token, expected \";\" (1:6)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:21)"
"throws": "Unexpected token, expected \";\" (1:21)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (2:8)"
"throws": "Unexpected token, expected \";\" (2:8)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (2:4)"
"throws": "Unexpected token, expected \";\" (2:4)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ( (1:11)"
"throws": "Unexpected token, expected \"(\" (1:11)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ( (1:10)"
"throws": "Unexpected token, expected \"(\" (1:10)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:14)"
"throws": "Unexpected token, expected \";\" (1:14)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:30)"
"throws": "Unexpected token, expected \";\" (1:30)"
}

View File

@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token, expected function (1:12)"
"throws": "Unexpected token, expected \"function\" (1:12)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ) (1:19)"
"throws": "Unexpected token, expected \")\" (1:19)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:3)"
"throws": "Unexpected token, expected \",\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ) (1:5)"
"throws": "Unexpected token, expected \")\" (1:5)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:20)"
"throws": "Unexpected token, expected \";\" (1:20)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:17)"
"throws": "Unexpected token, expected \";\" (1:17)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:15)"
"throws": "Unexpected token, expected \";\" (1:15)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:15)"
"throws": "Unexpected token, expected \";\" (1:15)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ] (1:11)"
"throws": "Unexpected token, expected \"]\" (1:11)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected { (1:7)"
"throws": "Unexpected token, expected \"{\" (1:7)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected { (1:12)"
"throws": "Unexpected token, expected \"{\" (1:12)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:17)"
"throws": "Unexpected token, expected \";\" (1:17)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:15)"
"throws": "Unexpected token, expected \";\" (1:15)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ( (1:7)"
"throws": "Unexpected token, expected \"(\" (1:7)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected } (1:11)"
"throws": "Unexpected token, expected \"}\" (1:11)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected } (1:18)"
"throws": "Unexpected token, expected \"}\" (1:18)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:18)"
"throws": "Unexpected token, expected \",\" (1:18)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:20)"
"throws": "Unexpected token, expected \";\" (1:20)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:28)"
"throws": "Unexpected token, expected \";\" (1:28)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:3)"
"throws": "Unexpected token, expected \";\" (1:3)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:9)"
"throws": "Unexpected token, expected \",\" (1:9)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:6)"
"throws": "Unexpected token, expected \";\" (1:6)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:6)"
"throws": "Unexpected token, expected \";\" (1:6)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:12)"
"throws": "Unexpected token, expected \",\" (1:12)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:16)"
"throws": "Unexpected token, expected \",\" (1:16)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:13)"
"throws": "Unexpected token, expected \",\" (1:13)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ] (1:4)"
"throws": "Unexpected token, expected \"]\" (1:4)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ] (1:7)"
"throws": "Unexpected token, expected \"]\" (1:7)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:5)"
"throws": "Unexpected token, expected \",\" (1:5)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:5)"
"throws": "Unexpected token, expected \",\" (1:5)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected , (1:7)"
"throws": "Unexpected token, expected \",\" (1:7)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:2)"
"throws": "Unexpected token, expected \";\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ( (1:2)"
"throws": "Unexpected token, expected \"(\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:2)"
"throws": "Unexpected token, expected \";\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:2)"
"throws": "Unexpected token, expected \";\" (1:2)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected ; (1:15)"
"throws": "Unexpected token, expected \";\" (1:15)"
}

Some files were not shown because too many files have changed in this diff Show More