From 1bbafa3445d2d72b36712423bf528a87c4e21cb4 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Wed, 11 Nov 2020 14:16:45 +0000 Subject: [PATCH] wsgl parser: Tweak top-level unexpected token error message I feel this reads better. Bug: tint:282 Change-Id: I04fe42a0347ea050e93e5cf5ccae7259bc79bb58 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32283 Commit-Queue: dan sinclair Reviewed-by: dan sinclair --- src/reader/wgsl/parser_impl.cc | 2 +- src/reader/wgsl/parser_impl_error_msg_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index ea0b5ae2bb..01d3678fdd 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -286,7 +286,7 @@ Expect ParserImpl::expect_global_decl() { if (decos.value.size() > 0) { add_error(peek(), "expected declaration after decorations"); } else { - add_error(peek(), "invalid token"); + add_error(peek(), "unexpected token"); } return Failure::kErrored; } diff --git a/src/reader/wgsl/parser_impl_error_msg_test.cc b/src/reader/wgsl/parser_impl_error_msg_test.cc index e72a80e073..3d70cd9e49 100644 --- a/src/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/reader/wgsl/parser_impl_error_msg_test.cc @@ -1262,7 +1262,7 @@ TEST_F(ParserImplErrorTest, UnaryInvalidExpr) { TEST_F(ParserImplErrorTest, UnexpectedToken) { EXPECT("unexpected", - "test.wgsl:1:1 error: invalid token\n" + "test.wgsl:1:1 error: unexpected token\n" "unexpected\n" "^^^^^^^^^^\n"); }