Update parser comments.
This CL updates a few parser comments to match spec.
Bug: tint:1633
Change-Id: I8cde5ea9a85f0ca58b914d2741ad131d1fa374c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99700
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc
index 6459ce7..733a2ea 100644
--- a/src/tint/reader/wgsl/parser_impl.cc
+++ b/src/tint/reader/wgsl/parser_impl.cc
@@ -1533,7 +1533,7 @@
}
// param
-// : attribute_list* ident_with_type_decl
+// : attribute_list* ident COLON type_decl
Expect<ast::Parameter*> ParserImpl::expect_param() {
auto attrs = attribute_list();
@@ -2563,20 +2563,6 @@
return Failure::kErrored;
}
-// singular_expression
-// : primary_expression postfix_expr
-Maybe<const ast::Expression*> ParserImpl::singular_expression() {
- auto prefix = primary_expression();
- if (prefix.errored) {
- return Failure::kErrored;
- }
- if (!prefix.matched) {
- return Failure::kNoMatch;
- }
-
- return postfix_expression(prefix.value);
-}
-
// argument_expression_list
// : PAREN_LEFT ((expression COMMA)* expression COMMA?)? PAREN_RIGHT
Expect<ParserImpl::ExpressionList> ParserImpl::expect_argument_expression_list(
@@ -2814,6 +2800,20 @@
return math.value;
}
+// singular_expression
+// : primary_expression postfix_expr
+Maybe<const ast::Expression*> ParserImpl::singular_expression() {
+ auto prefix = primary_expression();
+ if (prefix.errored) {
+ return Failure::kErrored;
+ }
+ if (!prefix.matched) {
+ return Failure::kNoMatch;
+ }
+
+ return postfix_expression(prefix.value);
+}
+
// unary_expression
// : singular_expression
// | MINUS unary_expression
@@ -2821,6 +2821,8 @@
// | TILDE unary_expression
// | STAR unary_expression
// | AND unary_expression
+//
+// The `primary_expression postfix_expression ?` is moved out into a `singular_expression`
Maybe<const ast::Expression*> ParserImpl::unary_expression() {
auto& t = peek();