Rename brace and bracket to match spec
The names for brace and bracket got flipped in the spec, update Tint to match. Change-Id: Ifbad5f239834b77b9aa27ef21b9d704cab742f4f Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/21260 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
1f1f08f94a
commit
4dfda012b2
|
@ -351,21 +351,21 @@ Token Lexer::try_punctuation() {
|
|||
pos_ += 1;
|
||||
column_ += 1;
|
||||
} else if (matches(pos_, "[")) {
|
||||
type = Token::Type::kBraceLeft;
|
||||
pos_ += 1;
|
||||
column_ += 1;
|
||||
} else if (matches(pos_, "]")) {
|
||||
type = Token::Type::kBraceRight;
|
||||
pos_ += 1;
|
||||
column_ += 1;
|
||||
} else if (matches(pos_, "{")) {
|
||||
type = Token::Type::kBracketLeft;
|
||||
pos_ += 1;
|
||||
column_ += 1;
|
||||
} else if (matches(pos_, "}")) {
|
||||
} else if (matches(pos_, "]")) {
|
||||
type = Token::Type::kBracketRight;
|
||||
pos_ += 1;
|
||||
column_ += 1;
|
||||
} else if (matches(pos_, "{")) {
|
||||
type = Token::Type::kBraceLeft;
|
||||
pos_ += 1;
|
||||
column_ += 1;
|
||||
} else if (matches(pos_, "}")) {
|
||||
type = Token::Type::kBraceRight;
|
||||
pos_ += 1;
|
||||
column_ += 1;
|
||||
} else if (matches(pos_, "&&")) {
|
||||
type = Token::Type::kAndAnd;
|
||||
pos_ += 2;
|
||||
|
|
|
@ -366,10 +366,10 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
TokenData{"]]", Token::Type::kAttrRight},
|
||||
TokenData{"/", Token::Type::kForwardSlash},
|
||||
TokenData{"!", Token::Type::kBang},
|
||||
TokenData{"[", Token::Type::kBraceLeft},
|
||||
TokenData{"]", Token::Type::kBraceRight},
|
||||
TokenData{"{", Token::Type::kBracketLeft},
|
||||
TokenData{"}", Token::Type::kBracketRight},
|
||||
TokenData{"[", Token::Type::kBracketLeft},
|
||||
TokenData{"]", Token::Type::kBracketRight},
|
||||
TokenData{"{", Token::Type::kBraceLeft},
|
||||
TokenData{"}", Token::Type::kBraceRight},
|
||||
TokenData{":", Token::Type::kColon},
|
||||
TokenData{",", Token::Type::kComma},
|
||||
TokenData{"=", Token::Type::kEqual},
|
||||
|
|
|
@ -987,7 +987,7 @@ std::unique_ptr<ast::type::StructType> ParserImpl::struct_decl() {
|
|||
}
|
||||
|
||||
t = peek();
|
||||
if (!t.IsBracketLeft()) {
|
||||
if (!t.IsBraceLeft()) {
|
||||
set_error(t, "missing { for struct declaration");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1042,13 +1042,13 @@ ast::StructDecoration ParserImpl::struct_decoration() {
|
|||
// : BRACKET_LEFT struct_member* BRACKET_RIGHT
|
||||
ast::StructMemberList ParserImpl::struct_body_decl() {
|
||||
auto t = peek();
|
||||
if (!t.IsBracketLeft())
|
||||
if (!t.IsBraceLeft())
|
||||
return {};
|
||||
|
||||
next(); // Consume the peek
|
||||
|
||||
t = peek();
|
||||
if (t.IsBracketRight())
|
||||
if (t.IsBraceRight())
|
||||
return {};
|
||||
|
||||
ast::StructMemberList members;
|
||||
|
@ -1064,12 +1064,12 @@ ast::StructMemberList ParserImpl::struct_body_decl() {
|
|||
members.push_back(std::move(mem));
|
||||
|
||||
t = peek();
|
||||
if (t.IsBracketRight() || t.IsEof())
|
||||
if (t.IsBraceRight() || t.IsEof())
|
||||
break;
|
||||
}
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketRight()) {
|
||||
if (!t.IsBraceRight()) {
|
||||
set_error(t, "missing } for struct declaration");
|
||||
return {};
|
||||
}
|
||||
|
@ -1376,7 +1376,7 @@ ast::PipelineStage ParserImpl::pipeline_stage() {
|
|||
// : BRACKET_LEFT statements BRACKET_RIGHT
|
||||
ast::StatementList ParserImpl::body_stmt() {
|
||||
auto t = peek();
|
||||
if (!t.IsBracketLeft())
|
||||
if (!t.IsBraceLeft())
|
||||
return {};
|
||||
|
||||
next(); // Consume the peek
|
||||
|
@ -1386,7 +1386,7 @@ ast::StatementList ParserImpl::body_stmt() {
|
|||
return {};
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketRight()) {
|
||||
if (!t.IsBraceRight()) {
|
||||
set_error(t, "missing }");
|
||||
return {};
|
||||
}
|
||||
|
@ -1733,7 +1733,7 @@ std::unique_ptr<ast::IfStatement> ParserImpl::if_stmt() {
|
|||
}
|
||||
|
||||
t = peek();
|
||||
if (!t.IsBracketLeft()) {
|
||||
if (!t.IsBraceLeft()) {
|
||||
set_error(t, "missing {");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1781,7 +1781,7 @@ ast::ElseStatementList ParserImpl::elseif_stmt() {
|
|||
}
|
||||
|
||||
t = peek();
|
||||
if (!t.IsBracketLeft()) {
|
||||
if (!t.IsBraceLeft()) {
|
||||
set_error(t, "missing {");
|
||||
return {};
|
||||
}
|
||||
|
@ -1812,7 +1812,7 @@ std::unique_ptr<ast::ElseStatement> ParserImpl::else_stmt() {
|
|||
next(); // Consume the peek
|
||||
|
||||
t = peek();
|
||||
if (!t.IsBracketLeft()) {
|
||||
if (!t.IsBraceLeft()) {
|
||||
set_error(t, "missing {");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1869,7 +1869,7 @@ std::unique_ptr<ast::SwitchStatement> ParserImpl::switch_stmt() {
|
|||
}
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketLeft()) {
|
||||
if (!t.IsBraceLeft()) {
|
||||
set_error(t, "missing { for switch statement");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1886,7 +1886,7 @@ std::unique_ptr<ast::SwitchStatement> ParserImpl::switch_stmt() {
|
|||
}
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketRight()) {
|
||||
if (!t.IsBraceRight()) {
|
||||
set_error(t, "missing } for switch statement");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1925,7 +1925,7 @@ std::unique_ptr<ast::CaseStatement> ParserImpl::switch_body() {
|
|||
}
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketLeft()) {
|
||||
if (!t.IsBraceLeft()) {
|
||||
set_error(t, "missing { for case statement");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1937,7 +1937,7 @@ std::unique_ptr<ast::CaseStatement> ParserImpl::switch_body() {
|
|||
stmt->set_body(std::move(body));
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketRight()) {
|
||||
if (!t.IsBraceRight()) {
|
||||
set_error(t, "missing } for case statement");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1990,7 +1990,7 @@ std::unique_ptr<ast::LoopStatement> ParserImpl::loop_stmt() {
|
|||
next(); // Consume the peek
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketLeft()) {
|
||||
if (!t.IsBraceLeft()) {
|
||||
set_error(t, "missing { for loop");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2004,7 +2004,7 @@ std::unique_ptr<ast::LoopStatement> ParserImpl::loop_stmt() {
|
|||
return nullptr;
|
||||
|
||||
t = next();
|
||||
if (!t.IsBracketRight()) {
|
||||
if (!t.IsBraceRight()) {
|
||||
set_error(t, "missing } for loop");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2298,7 +2298,7 @@ std::unique_ptr<ast::Expression> ParserImpl::postfix_expr(
|
|||
|
||||
auto t = peek();
|
||||
auto source = t.source();
|
||||
if (t.IsBraceLeft()) {
|
||||
if (t.IsBracketLeft()) {
|
||||
next(); // Consume the peek
|
||||
|
||||
auto param = logical_or_expression();
|
||||
|
@ -2310,7 +2310,7 @@ std::unique_ptr<ast::Expression> ParserImpl::postfix_expr(
|
|||
}
|
||||
|
||||
t = next();
|
||||
if (!t.IsBraceRight()) {
|
||||
if (!t.IsBracketRight()) {
|
||||
set_error(t, "missing ] for array accessor");
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -54,13 +54,13 @@ std::string Token::TypeToName(Type type) {
|
|||
return "/";
|
||||
case Token::Type::kBang:
|
||||
return "!";
|
||||
case Token::Type::kBraceLeft:
|
||||
return "[";
|
||||
case Token::Type::kBraceRight:
|
||||
return "]";
|
||||
case Token::Type::kBracketLeft:
|
||||
return "{";
|
||||
return "[";
|
||||
case Token::Type::kBracketRight:
|
||||
return "]";
|
||||
case Token::Type::kBraceLeft:
|
||||
return "{";
|
||||
case Token::Type::kBraceRight:
|
||||
return "}";
|
||||
case Token::Type::kColon:
|
||||
return ":";
|
||||
|
|
|
@ -66,13 +66,13 @@ class Token {
|
|||
/// A '!'
|
||||
kBang,
|
||||
/// A '['
|
||||
kBraceLeft,
|
||||
/// A ']'
|
||||
kBraceRight,
|
||||
/// A '{'
|
||||
kBracketLeft,
|
||||
/// A '}'
|
||||
/// A ']'
|
||||
kBracketRight,
|
||||
/// A '{'
|
||||
kBraceLeft,
|
||||
/// A '}'
|
||||
kBraceRight,
|
||||
/// A ':'
|
||||
kColon,
|
||||
/// A ','
|
||||
|
@ -375,13 +375,13 @@ class Token {
|
|||
/// @returns true if token is a '!'
|
||||
bool IsBang() const { return type_ == Type::kBang; }
|
||||
/// @returns true if token is a '['
|
||||
bool IsBraceLeft() const { return type_ == Type::kBraceLeft; }
|
||||
/// @returns true if token is a ']'
|
||||
bool IsBraceRight() const { return type_ == Type::kBraceRight; }
|
||||
/// @returns true if token is a '{'
|
||||
bool IsBracketLeft() const { return type_ == Type::kBracketLeft; }
|
||||
/// @returns true if token is a '}'
|
||||
/// @returns true if token is a ']'
|
||||
bool IsBracketRight() const { return type_ == Type::kBracketRight; }
|
||||
/// @returns true if token is a '{'
|
||||
bool IsBraceLeft() const { return type_ == Type::kBraceLeft; }
|
||||
/// @returns true if token is a '}'
|
||||
bool IsBraceRight() const { return type_ == Type::kBraceRight; }
|
||||
/// @returns true if token is a ':'
|
||||
bool IsColon() const { return type_ == Type::kColon; }
|
||||
/// @returns true if token is a ','
|
||||
|
|
Loading…
Reference in New Issue