Rename primary_expression.

This CL updates the name of primary_expression to match spec.

Bug: tint:1633
Change-Id: Iba0f681a47f80f80913a5ce3efb6f753201b072c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106581
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-10-24 14:41:44 +00:00 committed by Dawn LUCI CQ
parent f4baf2713c
commit a7014a969e
2 changed files with 13 additions and 11 deletions

View File

@ -2629,12 +2629,13 @@ Maybe<const ast::Expression*> ParserImpl::primary_expression() {
return Failure::kNoMatch; return Failure::kNoMatch;
} }
// postfix_expression // component_or_swizzle_specifier
// : // :
// | BRACE_LEFT expression BRACE_RIGHT postfix_expression? // | BRACE_LEFT expression BRACE_RIGHT component_or_swizzle_specifier?
// | PERIOD member_ident postfix_expression? // | PERIOD member_ident component_or_swizzle_specifier?
// | PERIOD swizzle_name postfix_expression? // | PERIOD swizzle_name component_or_swizzle_specifier?
Maybe<const ast::Expression*> ParserImpl::postfix_expression(const ast::Expression* prefix) { Maybe<const ast::Expression*> ParserImpl::component_or_swizzle_specifier(
const ast::Expression* prefix) {
Source source; Source source;
while (continue_parsing()) { while (continue_parsing()) {
@ -3116,7 +3117,7 @@ Maybe<const ast::Expression*> ParserImpl::singular_expression() {
return Failure::kNoMatch; return Failure::kNoMatch;
} }
return postfix_expression(prefix.value); return component_or_swizzle_specifier(prefix.value);
} }
// unary_expression // unary_expression
@ -3127,7 +3128,8 @@ Maybe<const ast::Expression*> ParserImpl::singular_expression() {
// | STAR unary_expression // | STAR unary_expression
// | AND unary_expression // | AND unary_expression
// //
// The `primary_expression postfix_expression ?` is moved out into a `singular_expression` // The `primary_expression component_or_swizzle_specifier ?` is moved out into a
// `singular_expression`
Maybe<const ast::Expression*> ParserImpl::unary_expression() { Maybe<const ast::Expression*> ParserImpl::unary_expression() {
auto& t = peek(); auto& t = peek();
@ -3246,7 +3248,7 @@ Maybe<const ast::Expression*> ParserImpl::core_lhs_expression() {
} }
// lhs_expression // lhs_expression
// : ( STAR | AND )* core_lhs_expression postfix_expression? // : ( STAR | AND )* core_lhs_expression component_or_swizzle_specifier?
Maybe<const ast::Expression*> ParserImpl::lhs_expression() { Maybe<const ast::Expression*> ParserImpl::lhs_expression() {
std::vector<const Token*> prefixes; std::vector<const Token*> prefixes;
while (peek_is(Token::Type::kStar) || peek_is(Token::Type::kAnd) || while (peek_is(Token::Type::kStar) || peek_is(Token::Type::kAnd) ||
@ -3282,7 +3284,7 @@ Maybe<const ast::Expression*> ParserImpl::lhs_expression() {
expr = create<ast::UnaryOpExpression>(t.source(), op, expr); expr = create<ast::UnaryOpExpression>(t.source(), op, expr);
} }
auto e = postfix_expression(expr); auto e = component_or_swizzle_specifier(expr);
if (e.errored) { if (e.errored) {
return Failure::kErrored; return Failure::kErrored;
} }

View File

@ -614,10 +614,10 @@ class ParserImpl {
/// @param use a description of what was being parsed if an error was raised /// @param use a description of what was being parsed if an error was raised
/// @returns the list of arguments /// @returns the list of arguments
Expect<ExpressionList> expect_argument_expression_list(std::string_view use); Expect<ExpressionList> expect_argument_expression_list(std::string_view use);
/// Parses the recursive portion of the postfix_expression /// Parses the recursive portion of the component_or_swizzle_specifier
/// @param prefix the left side of the expression /// @param prefix the left side of the expression
/// @returns the parsed expression or nullptr /// @returns the parsed expression or nullptr
Maybe<const ast::Expression*> postfix_expression(const ast::Expression* prefix); Maybe<const ast::Expression*> component_or_swizzle_specifier(const ast::Expression* prefix);
/// Parses a `singular_expression` grammar elment /// Parses a `singular_expression` grammar elment
/// @returns the parsed expression or nullptr /// @returns the parsed expression or nullptr
Maybe<const ast::Expression*> singular_expression(); Maybe<const ast::Expression*> singular_expression();