Update type_decl grammar element name.
The `type_decl` term in the spec was updated to `type_specifier`. This CL updates Tint to match. Bug: tint:1633 Change-Id: I264ae78a4b09c3c69d8673e24fe4f60975539b8f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104421 Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
cf47d6147c
commit
7a69a3411f
|
@ -703,8 +703,8 @@ Maybe<ParserImpl::VarDeclInfo> ParserImpl::variable_decl() {
|
||||||
// texture_and_sampler_types
|
// texture_and_sampler_types
|
||||||
// : sampler_type
|
// : sampler_type
|
||||||
// | depth_texture_type
|
// | depth_texture_type
|
||||||
// | sampled_texture_type LESS_THAN type_decl GREATER_THAN
|
// | sampled_texture_type LESS_THAN type_specifier GREATER_THAN
|
||||||
// | multisampled_texture_type LESS_THAN type_decl GREATER_THAN
|
// | multisampled_texture_type LESS_THAN type_specifier GREATER_THAN
|
||||||
// | storage_texture_type LESS_THAN texel_format
|
// | storage_texture_type LESS_THAN texel_format
|
||||||
// COMMA access_mode GREATER_THAN
|
// COMMA access_mode GREATER_THAN
|
||||||
Maybe<const ast::Type*> ParserImpl::texture_and_sampler_types() {
|
Maybe<const ast::Type*> ParserImpl::texture_and_sampler_types() {
|
||||||
|
@ -928,7 +928,7 @@ Expect<ast::TexelFormat> ParserImpl::expect_texel_format(std::string_view use) {
|
||||||
return fmt;
|
return fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_ident_with_optional_type_decl(
|
Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_ident_with_optional_type_specifier(
|
||||||
std::string_view use,
|
std::string_view use,
|
||||||
bool allow_inferred) {
|
bool allow_inferred) {
|
||||||
auto ident = expect_ident(use);
|
auto ident = expect_ident(use);
|
||||||
|
@ -945,7 +945,7 @@ Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_ident_with_optional_type_
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& t = peek();
|
auto& t = peek();
|
||||||
auto type = type_decl();
|
auto type = type_specifier();
|
||||||
if (type.errored) {
|
if (type.errored) {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
@ -960,13 +960,14 @@ Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_ident_with_optional_type_
|
||||||
// : ident ( COLON typed_decl ) ?
|
// : ident ( COLON typed_decl ) ?
|
||||||
Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_optionally_typed_ident(
|
Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_optionally_typed_ident(
|
||||||
std::string_view use) {
|
std::string_view use) {
|
||||||
return expect_ident_with_optional_type_decl(use, true);
|
return expect_ident_with_optional_type_specifier(use, /* allow_inferred */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ident_with_type_decl
|
// ident_with_type_specifier
|
||||||
// : IDENT COLON type_decl
|
// : IDENT COLON type_specifier
|
||||||
Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_ident_with_type_decl(std::string_view use) {
|
Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_ident_with_type_specifier(
|
||||||
return expect_ident_with_optional_type_decl(use, false);
|
std::string_view use) {
|
||||||
|
return expect_ident_with_optional_type_specifier(use, /* allow_inferred */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// access_mode
|
// access_mode
|
||||||
|
@ -1025,7 +1026,7 @@ Maybe<ParserImpl::VariableQualifier> ParserImpl::variable_qualifier() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// type_alias_decl
|
// type_alias_decl
|
||||||
// : TYPE IDENT EQUAL type_decl
|
// : TYPE IDENT EQUAL type_specifier
|
||||||
Maybe<const ast::Alias*> ParserImpl::type_alias_decl() {
|
Maybe<const ast::Alias*> ParserImpl::type_alias_decl() {
|
||||||
if (!peek_is(Token::Type::kType)) {
|
if (!peek_is(Token::Type::kType)) {
|
||||||
return Failure::kNoMatch;
|
return Failure::kNoMatch;
|
||||||
|
@ -1043,7 +1044,7 @@ Maybe<const ast::Alias*> ParserImpl::type_alias_decl() {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto type = type_decl();
|
auto type = type_specifier();
|
||||||
if (type.errored) {
|
if (type.errored) {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
@ -1106,19 +1107,19 @@ Maybe<ParserImpl::MatrixDimensions> ParserImpl::mat_prefix() {
|
||||||
return MatrixDimensions{columns, 2};
|
return MatrixDimensions{columns, 2};
|
||||||
}
|
}
|
||||||
|
|
||||||
// type_decl_without_ident:
|
// type_specifier_without_ident:
|
||||||
// : BOOL
|
// : BOOL
|
||||||
// | F16
|
// | F16
|
||||||
// | F32
|
// | F32
|
||||||
// | I32
|
// | I32
|
||||||
// | U32
|
// | U32
|
||||||
// | ARRAY LESS_THAN type_decl ( COMMA element_count_expression )? GREATER_THAN
|
// | ARRAY LESS_THAN type_specifier ( COMMA element_count_expression )? GREATER_THAN
|
||||||
// | ATOMIC LESS_THAN type_decl GREATER_THAN
|
// | ATOMIC LESS_THAN type_specifier GREATER_THAN
|
||||||
// | PTR LESS_THAN address_space COMMA type_decl ( COMMA access_mode )? GREATER_THAN
|
// | PTR LESS_THAN address_space COMMA type_specifier ( COMMA access_mode )? GREATER_THAN
|
||||||
// | mat_prefix LESS_THAN type_decl GREATER_THAN
|
// | mat_prefix LESS_THAN type_specifier GREATER_THAN
|
||||||
// | vec_prefix LESS_THAN type_decl GREATER_THAN
|
// | vec_prefix LESS_THAN type_specifier GREATER_THAN
|
||||||
// | texture_and_sampler_types
|
// | texture_and_sampler_types
|
||||||
Maybe<const ast::Type*> ParserImpl::type_decl_without_ident() {
|
Maybe<const ast::Type*> ParserImpl::type_specifier_without_ident() {
|
||||||
auto& t = peek();
|
auto& t = peek();
|
||||||
|
|
||||||
if (match(Token::Type::kBool)) {
|
if (match(Token::Type::kBool)) {
|
||||||
|
@ -1143,29 +1144,29 @@ Maybe<const ast::Type*> ParserImpl::type_decl_without_ident() {
|
||||||
|
|
||||||
if (t.Is(Token::Type::kArray) && peek_is(Token::Type::kLessThan, 1)) {
|
if (t.Is(Token::Type::kArray) && peek_is(Token::Type::kLessThan, 1)) {
|
||||||
if (match(Token::Type::kArray)) {
|
if (match(Token::Type::kArray)) {
|
||||||
return expect_type_decl_array(t.source());
|
return expect_type_specifier_array(t.source());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match(Token::Type::kAtomic)) {
|
if (match(Token::Type::kAtomic)) {
|
||||||
return expect_type_decl_atomic(t.source());
|
return expect_type_specifier_atomic(t.source());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match(Token::Type::kPtr)) {
|
if (match(Token::Type::kPtr)) {
|
||||||
return expect_type_decl_pointer(t.source());
|
return expect_type_specifier_pointer(t.source());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.IsMatrix() && peek_is(Token::Type::kLessThan, 1)) {
|
if (t.IsMatrix() && peek_is(Token::Type::kLessThan, 1)) {
|
||||||
auto mat = mat_prefix();
|
auto mat = mat_prefix();
|
||||||
if (mat.matched) {
|
if (mat.matched) {
|
||||||
return expect_type_decl_matrix(t.source(), mat.value);
|
return expect_type_specifier_matrix(t.source(), mat.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.IsVector() && peek_is(Token::Type::kLessThan, 1)) {
|
if (t.IsVector() && peek_is(Token::Type::kLessThan, 1)) {
|
||||||
auto vec = vec_prefix();
|
auto vec = vec_prefix();
|
||||||
if (vec.matched) {
|
if (vec.matched) {
|
||||||
return expect_type_decl_vector(t.source(), vec.value);
|
return expect_type_specifier_vector(t.source(), vec.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1180,21 +1181,21 @@ Maybe<const ast::Type*> ParserImpl::type_decl_without_ident() {
|
||||||
return Failure::kNoMatch;
|
return Failure::kNoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
// type_decl
|
// type_specifier
|
||||||
// : IDENTIFIER
|
// : IDENTIFIER
|
||||||
// | type_decl_without_ident
|
// | type_specifier_without_ident
|
||||||
Maybe<const ast::Type*> ParserImpl::type_decl() {
|
Maybe<const ast::Type*> ParserImpl::type_specifier() {
|
||||||
auto& t = peek();
|
auto& t = peek();
|
||||||
Source source;
|
Source source;
|
||||||
if (match(Token::Type::kIdentifier, &source)) {
|
if (match(Token::Type::kIdentifier, &source)) {
|
||||||
return builder_.create<ast::TypeName>(source, builder_.Symbols().Register(t.to_str()));
|
return builder_.create<ast::TypeName>(source, builder_.Symbols().Register(t.to_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return type_decl_without_ident();
|
return type_specifier_without_ident();
|
||||||
}
|
}
|
||||||
|
|
||||||
Expect<const ast::Type*> ParserImpl::expect_type(std::string_view use) {
|
Expect<const ast::Type*> ParserImpl::expect_type(std::string_view use) {
|
||||||
auto type = type_decl();
|
auto type = type_specifier();
|
||||||
if (type.errored) {
|
if (type.errored) {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
@ -1204,8 +1205,8 @@ Expect<const ast::Type*> ParserImpl::expect_type(std::string_view use) {
|
||||||
return type.value;
|
return type.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LESS_THAN address_space COMMA type_decl ( COMMA access_mode )? GREATER_THAN
|
// LESS_THAN address_space COMMA type_specifier ( COMMA access_mode )? GREATER_THAN
|
||||||
Expect<const ast::Type*> ParserImpl::expect_type_decl_pointer(const Source& s) {
|
Expect<const ast::Type*> ParserImpl::expect_type_specifier_pointer(const Source& s) {
|
||||||
const char* use = "ptr declaration";
|
const char* use = "ptr declaration";
|
||||||
|
|
||||||
auto address_space = ast::AddressSpace::kNone;
|
auto address_space = ast::AddressSpace::kNone;
|
||||||
|
@ -1245,8 +1246,8 @@ Expect<const ast::Type*> ParserImpl::expect_type_decl_pointer(const Source& s) {
|
||||||
return builder_.ty.pointer(make_source_range_from(s), subtype.value, address_space, access);
|
return builder_.ty.pointer(make_source_range_from(s), subtype.value, address_space, access);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LESS_THAN type_decl GREATER_THAN
|
// LESS_THAN type_specifier GREATER_THAN
|
||||||
Expect<const ast::Type*> ParserImpl::expect_type_decl_atomic(const Source& s) {
|
Expect<const ast::Type*> ParserImpl::expect_type_specifier_atomic(const Source& s) {
|
||||||
const char* use = "atomic declaration";
|
const char* use = "atomic declaration";
|
||||||
|
|
||||||
auto subtype = expect_lt_gt_block(use, [&] { return expect_type(use); });
|
auto subtype = expect_lt_gt_block(use, [&] { return expect_type(use); });
|
||||||
|
@ -1257,8 +1258,8 @@ Expect<const ast::Type*> ParserImpl::expect_type_decl_atomic(const Source& s) {
|
||||||
return builder_.ty.atomic(make_source_range_from(s), subtype.value);
|
return builder_.ty.atomic(make_source_range_from(s), subtype.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LESS_THAN type_decl GREATER_THAN
|
// LESS_THAN type_specifier GREATER_THAN
|
||||||
Expect<const ast::Type*> ParserImpl::expect_type_decl_vector(const Source& s, uint32_t count) {
|
Expect<const ast::Type*> ParserImpl::expect_type_specifier_vector(const Source& s, uint32_t count) {
|
||||||
const char* use = "vector";
|
const char* use = "vector";
|
||||||
auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); });
|
auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); });
|
||||||
if (ty.errored) {
|
if (ty.errored) {
|
||||||
|
@ -1268,8 +1269,8 @@ Expect<const ast::Type*> ParserImpl::expect_type_decl_vector(const Source& s, ui
|
||||||
return builder_.ty.vec(make_source_range_from(s), ty.value, count);
|
return builder_.ty.vec(make_source_range_from(s), ty.value, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LESS_THAN type_decl ( COMMA element_count_expression )? GREATER_THAN
|
// LESS_THAN type_specifier ( COMMA element_count_expression )? GREATER_THAN
|
||||||
Expect<const ast::Type*> ParserImpl::expect_type_decl_array(const Source& s) {
|
Expect<const ast::Type*> ParserImpl::expect_type_specifier_array(const Source& s) {
|
||||||
const char* use = "array declaration";
|
const char* use = "array declaration";
|
||||||
|
|
||||||
struct TypeAndSize {
|
struct TypeAndSize {
|
||||||
|
@ -1309,8 +1310,8 @@ Expect<const ast::Type*> ParserImpl::expect_type_decl_array(const Source& s) {
|
||||||
return builder_.ty.array(make_source_range_from(s), type_size->type, type_size->size);
|
return builder_.ty.array(make_source_range_from(s), type_size->type, type_size->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LESS_THAN type_decl GREATER_THAN
|
// LESS_THAN type_specifier GREATER_THAN
|
||||||
Expect<const ast::Type*> ParserImpl::expect_type_decl_matrix(const Source& s,
|
Expect<const ast::Type*> ParserImpl::expect_type_specifier_matrix(const Source& s,
|
||||||
const MatrixDimensions& dims) {
|
const MatrixDimensions& dims) {
|
||||||
const char* use = "matrix";
|
const char* use = "matrix";
|
||||||
auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); });
|
auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); });
|
||||||
|
@ -1402,14 +1403,14 @@ Expect<ParserImpl::StructMemberList> ParserImpl::expect_struct_body_decl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// struct_member
|
// struct_member
|
||||||
// : attribute* ident_with_type_decl
|
// : attribute* ident_with_type_specifier
|
||||||
Expect<ast::StructMember*> ParserImpl::expect_struct_member() {
|
Expect<ast::StructMember*> ParserImpl::expect_struct_member() {
|
||||||
auto attrs = attribute_list();
|
auto attrs = attribute_list();
|
||||||
if (attrs.errored) {
|
if (attrs.errored) {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decl = expect_ident_with_type_decl("struct member");
|
auto decl = expect_ident_with_type_specifier("struct member");
|
||||||
if (decl.errored) {
|
if (decl.errored) {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
@ -1477,10 +1478,10 @@ Maybe<const ast::Function*> ParserImpl::function_decl(AttributeList& attrs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// function_header
|
// function_header
|
||||||
// : FN IDENT PAREN_LEFT param_list PAREN_RIGHT return_type_decl_optional
|
// : FN IDENT PAREN_LEFT param_list PAREN_RIGHT return_type_specifier_optional
|
||||||
// return_type_decl_optional
|
// return_type_specifier_optional
|
||||||
// :
|
// :
|
||||||
// | ARROW attribute_list* type_decl
|
// | ARROW attribute_list* type_specifier
|
||||||
Maybe<ParserImpl::FunctionHeader> ParserImpl::function_header() {
|
Maybe<ParserImpl::FunctionHeader> ParserImpl::function_header() {
|
||||||
Source source;
|
Source source;
|
||||||
if (!match(Token::Type::kFn, &source)) {
|
if (!match(Token::Type::kFn, &source)) {
|
||||||
|
@ -1516,7 +1517,7 @@ Maybe<ParserImpl::FunctionHeader> ParserImpl::function_header() {
|
||||||
}
|
}
|
||||||
return_attributes = attrs.value;
|
return_attributes = attrs.value;
|
||||||
|
|
||||||
auto type = type_decl();
|
auto type = type_specifier();
|
||||||
if (type.errored) {
|
if (type.errored) {
|
||||||
errored = true;
|
errored = true;
|
||||||
} else if (!type.matched) {
|
} else if (!type.matched) {
|
||||||
|
@ -1565,11 +1566,11 @@ Expect<ParserImpl::ParameterList> ParserImpl::expect_param_list() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// param
|
// param
|
||||||
// : attribute_list* ident COLON type_decl
|
// : attribute_list* ident COLON type_specifier
|
||||||
Expect<ast::Parameter*> ParserImpl::expect_param() {
|
Expect<ast::Parameter*> ParserImpl::expect_param() {
|
||||||
auto attrs = attribute_list();
|
auto attrs = attribute_list();
|
||||||
|
|
||||||
auto decl = expect_ident_with_type_decl("parameter");
|
auto decl = expect_ident_with_type_specifier("parameter");
|
||||||
if (decl.errored) {
|
if (decl.errored) {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
@ -2468,7 +2469,7 @@ Maybe<const ast::BlockStatement*> ParserImpl::continuing_statement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// callable
|
// callable
|
||||||
// : type_decl_without_ident
|
// : type_specifier_without_ident
|
||||||
// | ARRAY
|
// | ARRAY
|
||||||
// | mat_prefix
|
// | mat_prefix
|
||||||
// | vec_prefix
|
// | vec_prefix
|
||||||
|
@ -2479,10 +2480,10 @@ Maybe<const ast::BlockStatement*> ParserImpl::continuing_statement() {
|
||||||
Maybe<const ast::Type*> ParserImpl::callable() {
|
Maybe<const ast::Type*> ParserImpl::callable() {
|
||||||
auto& t = peek();
|
auto& t = peek();
|
||||||
|
|
||||||
// This _must_ match `type_decl_without_ident` before any of the other types as they're all
|
// This _must_ match `type_specifier_without_ident` before any of the other types as they're
|
||||||
// prefixes of the types and we want to match the longer `vec3<f32>` then the shorter
|
// all prefixes of the types and we want to match the longer `vec3<f32>` then the shorter
|
||||||
// prefix match of `vec3`.
|
// prefix match of `vec3`.
|
||||||
auto ty = type_decl_without_ident();
|
auto ty = type_specifier_without_ident();
|
||||||
if (ty.errored) {
|
if (ty.errored) {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
@ -2509,7 +2510,7 @@ Maybe<const ast::Type*> ParserImpl::callable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// primary_expression
|
// primary_expression
|
||||||
// : BITCAST LESS_THAN type_decl GREATER_THAN paren_expression
|
// : BITCAST LESS_THAN type_specifier GREATER_THAN paren_expression
|
||||||
// | callable argument_expression_list
|
// | callable argument_expression_list
|
||||||
// | const_literal
|
// | const_literal
|
||||||
// | IDENT argument_expression_list?
|
// | IDENT argument_expression_list?
|
||||||
|
|
|
@ -427,7 +427,7 @@ 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.
|
||||||
/// @param allow_inferred allow the identifier to be parsed without a type
|
/// @param allow_inferred allow the identifier to be parsed without a type
|
||||||
/// @returns the parsed identifier, and possibly type, or empty otherwise
|
/// @returns the parsed identifier, and possibly type, or empty otherwise
|
||||||
Expect<TypedIdentifier> expect_ident_with_optional_type_decl(std::string_view use,
|
Expect<TypedIdentifier> expect_ident_with_optional_type_specifier(std::string_view use,
|
||||||
bool allow_inferred);
|
bool allow_inferred);
|
||||||
/// Parses a `ident` or a `variable_ident_decl` grammar element, erroring on parse failure.
|
/// Parses a `ident` or a `variable_ident_decl` grammar element, erroring on parse failure.
|
||||||
/// @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.
|
||||||
|
@ -436,7 +436,7 @@ class ParserImpl {
|
||||||
/// Parses a `variable_ident_decl` grammar element, erroring on parse failure.
|
/// Parses a `variable_ident_decl` grammar element, erroring on parse failure.
|
||||||
/// @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 identifier and type parsed or empty otherwise
|
/// @returns the identifier and type parsed or empty otherwise
|
||||||
Expect<TypedIdentifier> expect_ident_with_type_decl(std::string_view use);
|
Expect<TypedIdentifier> expect_ident_with_type_specifier(std::string_view use);
|
||||||
/// Parses a `variable_qualifier` grammar element
|
/// Parses a `variable_qualifier` grammar element
|
||||||
/// @returns the variable qualifier information
|
/// @returns the variable qualifier information
|
||||||
Maybe<VariableQualifier> variable_qualifier();
|
Maybe<VariableQualifier> variable_qualifier();
|
||||||
|
@ -452,12 +452,12 @@ class ParserImpl {
|
||||||
/// Parses a `mat_prefix` grammar element
|
/// Parses a `mat_prefix` grammar element
|
||||||
/// @returns the matrix dimensions or nullptr
|
/// @returns the matrix dimensions or nullptr
|
||||||
Maybe<MatrixDimensions> mat_prefix();
|
Maybe<MatrixDimensions> mat_prefix();
|
||||||
/// Parses a `type_decl_without_ident` grammar element
|
/// Parses a `type_specifier_without_ident` grammar element
|
||||||
/// @returns the parsed Type or nullptr if none matched.
|
/// @returns the parsed Type or nullptr if none matched.
|
||||||
Maybe<const ast::Type*> type_decl_without_ident();
|
Maybe<const ast::Type*> type_specifier_without_ident();
|
||||||
/// Parses a `type_decl` grammar element
|
/// Parses a `type_specifier` grammar element
|
||||||
/// @returns the parsed Type or nullptr if none matched.
|
/// @returns the parsed Type or nullptr if none matched.
|
||||||
Maybe<const ast::Type*> type_decl();
|
Maybe<const ast::Type*> type_specifier();
|
||||||
/// Parses an `address_space` grammar element, erroring on parse failure.
|
/// Parses an `address_space` grammar element, erroring on parse failure.
|
||||||
/// @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 address space or ast::AddressSpace::kNone if none matched
|
/// @returns the address space or ast::AddressSpace::kNone if none matched
|
||||||
|
@ -861,11 +861,12 @@ class ParserImpl {
|
||||||
/// Used to ensure that all attributes are consumed.
|
/// Used to ensure that all attributes are consumed.
|
||||||
bool expect_attributes_consumed(utils::VectorRef<const ast::Attribute*> list);
|
bool expect_attributes_consumed(utils::VectorRef<const ast::Attribute*> list);
|
||||||
|
|
||||||
Expect<const ast::Type*> expect_type_decl_pointer(const Source& s);
|
Expect<const ast::Type*> expect_type_specifier_pointer(const Source& s);
|
||||||
Expect<const ast::Type*> expect_type_decl_atomic(const Source& s);
|
Expect<const ast::Type*> expect_type_specifier_atomic(const Source& s);
|
||||||
Expect<const ast::Type*> expect_type_decl_vector(const Source& s, uint32_t count);
|
Expect<const ast::Type*> expect_type_specifier_vector(const Source& s, uint32_t count);
|
||||||
Expect<const ast::Type*> expect_type_decl_array(const Source& s);
|
Expect<const ast::Type*> expect_type_specifier_array(const Source& s);
|
||||||
Expect<const ast::Type*> expect_type_decl_matrix(const Source& s, const MatrixDimensions& dims);
|
Expect<const ast::Type*> expect_type_specifier_matrix(const Source& s,
|
||||||
|
const MatrixDimensions& dims);
|
||||||
|
|
||||||
Expect<const ast::Type*> expect_type(std::string_view use);
|
Expect<const ast::Type*> expect_type(std::string_view use);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Invalid) {
|
TEST_F(ParserImplTest, TypeDecl_Invalid) {
|
||||||
auto p = parser("1234");
|
auto p = parser("1234");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_EQ(t.errored, false);
|
EXPECT_EQ(t.errored, false);
|
||||||
EXPECT_EQ(t.matched, false);
|
EXPECT_EQ(t.matched, false);
|
||||||
EXPECT_EQ(t.value, nullptr);
|
EXPECT_EQ(t.value, nullptr);
|
||||||
|
@ -34,7 +34,7 @@ TEST_F(ParserImplTest, TypeDecl_Invalid) {
|
||||||
TEST_F(ParserImplTest, TypeDecl_Identifier) {
|
TEST_F(ParserImplTest, TypeDecl_Identifier) {
|
||||||
auto p = parser("A");
|
auto p = parser("A");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -47,7 +47,7 @@ TEST_F(ParserImplTest, TypeDecl_Identifier) {
|
||||||
TEST_F(ParserImplTest, TypeDecl_Bool) {
|
TEST_F(ParserImplTest, TypeDecl_Bool) {
|
||||||
auto p = parser("bool");
|
auto p = parser("bool");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -58,7 +58,7 @@ TEST_F(ParserImplTest, TypeDecl_Bool) {
|
||||||
TEST_F(ParserImplTest, TypeDecl_F16) {
|
TEST_F(ParserImplTest, TypeDecl_F16) {
|
||||||
auto p = parser("f16");
|
auto p = parser("f16");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -69,7 +69,7 @@ TEST_F(ParserImplTest, TypeDecl_F16) {
|
||||||
TEST_F(ParserImplTest, TypeDecl_F32) {
|
TEST_F(ParserImplTest, TypeDecl_F32) {
|
||||||
auto p = parser("f32");
|
auto p = parser("f32");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -80,7 +80,7 @@ TEST_F(ParserImplTest, TypeDecl_F32) {
|
||||||
TEST_F(ParserImplTest, TypeDecl_I32) {
|
TEST_F(ParserImplTest, TypeDecl_I32) {
|
||||||
auto p = parser("i32");
|
auto p = parser("i32");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -91,7 +91,7 @@ TEST_F(ParserImplTest, TypeDecl_I32) {
|
||||||
TEST_F(ParserImplTest, TypeDecl_U32) {
|
TEST_F(ParserImplTest, TypeDecl_U32) {
|
||||||
auto p = parser("u32");
|
auto p = parser("u32");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -114,7 +114,7 @@ class VecTest : public ParserImplTestWithParam<VecData> {};
|
||||||
TEST_P(VecTest, Parse) {
|
TEST_P(VecTest, Parse) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -134,7 +134,7 @@ class VecMissingGreaterThanTest : public ParserImplTestWithParam<VecData> {};
|
||||||
TEST_P(VecMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
TEST_P(VecMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -152,7 +152,7 @@ class VecMissingType : public ParserImplTestWithParam<VecData> {};
|
||||||
TEST_P(VecMissingType, Handles_Missing_Type) {
|
TEST_P(VecMissingType, Handles_Missing_Type) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -167,7 +167,7 @@ INSTANTIATE_TEST_SUITE_P(ParserImplTest,
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr) {
|
||||||
auto p = parser("ptr<function, f32>");
|
auto p = parser("ptr<function, f32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -182,7 +182,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_WithAccess) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_WithAccess) {
|
||||||
auto p = parser("ptr<function, f32, read>");
|
auto p = parser("ptr<function, f32, read>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -198,7 +198,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_WithAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_ToVec) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_ToVec) {
|
||||||
auto p = parser("ptr<function, vec2<f32>>");
|
auto p = parser("ptr<function, vec2<f32>>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -217,7 +217,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_ToVec) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingLessThan) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingLessThan) {
|
||||||
auto p = parser("ptr private, f32>");
|
auto p = parser("ptr private, f32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -227,7 +227,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingLessThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThanAfterType) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThanAfterType) {
|
||||||
auto p = parser("ptr<function, f32");
|
auto p = parser("ptr<function, f32");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -237,7 +237,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThanAfterType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThanAfterAccess) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThanAfterAccess) {
|
||||||
auto p = parser("ptr<function, f32, read");
|
auto p = parser("ptr<function, f32, read");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -247,7 +247,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThanAfterAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingCommaAfterAddressSpace) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingCommaAfterAddressSpace) {
|
||||||
auto p = parser("ptr<function f32>");
|
auto p = parser("ptr<function f32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -257,7 +257,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingCommaAfterAddressSpace) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingCommaAfterAccess) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingCommaAfterAccess) {
|
||||||
auto p = parser("ptr<function, f32 read>");
|
auto p = parser("ptr<function, f32 read>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -267,7 +267,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingCommaAfterAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingAddressSpace) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingAddressSpace) {
|
||||||
auto p = parser("ptr<, f32>");
|
auto p = parser("ptr<, f32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -277,7 +277,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingAddressSpace) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingType) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingType) {
|
||||||
auto p = parser("ptr<function,>");
|
auto p = parser("ptr<function,>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -287,7 +287,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingAccess) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingAccess) {
|
||||||
auto p = parser("ptr<function, i32, >");
|
auto p = parser("ptr<function, i32, >");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -297,7 +297,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingParams) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingParams) {
|
||||||
auto p = parser("ptr<>");
|
auto p = parser("ptr<>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -307,7 +307,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingParams) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_BadAddressSpace) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_BadAddressSpace) {
|
||||||
auto p = parser("ptr<unknown, f32>");
|
auto p = parser("ptr<unknown, f32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -317,7 +317,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_BadAddressSpace) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Ptr_BadAccess) {
|
TEST_F(ParserImplTest, TypeDecl_Ptr_BadAccess) {
|
||||||
auto p = parser("ptr<function, i32, unknown>");
|
auto p = parser("ptr<function, i32, unknown>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -327,7 +327,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_BadAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Atomic) {
|
TEST_F(ParserImplTest, TypeDecl_Atomic) {
|
||||||
auto p = parser("atomic<f32>");
|
auto p = parser("atomic<f32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -341,7 +341,7 @@ TEST_F(ParserImplTest, TypeDecl_Atomic) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Atomic_ToVec) {
|
TEST_F(ParserImplTest, TypeDecl_Atomic_ToVec) {
|
||||||
auto p = parser("atomic<vec2<f32>>");
|
auto p = parser("atomic<vec2<f32>>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -359,7 +359,7 @@ TEST_F(ParserImplTest, TypeDecl_Atomic_ToVec) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Atomic_MissingLessThan) {
|
TEST_F(ParserImplTest, TypeDecl_Atomic_MissingLessThan) {
|
||||||
auto p = parser("atomic f32>");
|
auto p = parser("atomic f32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -369,7 +369,7 @@ TEST_F(ParserImplTest, TypeDecl_Atomic_MissingLessThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Atomic_MissingGreaterThan) {
|
TEST_F(ParserImplTest, TypeDecl_Atomic_MissingGreaterThan) {
|
||||||
auto p = parser("atomic<f32");
|
auto p = parser("atomic<f32");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -379,7 +379,7 @@ TEST_F(ParserImplTest, TypeDecl_Atomic_MissingGreaterThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Atomic_MissingType) {
|
TEST_F(ParserImplTest, TypeDecl_Atomic_MissingType) {
|
||||||
auto p = parser("atomic<>");
|
auto p = parser("atomic<>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -389,7 +389,7 @@ TEST_F(ParserImplTest, TypeDecl_Atomic_MissingType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_AbstractIntLiteralSize) {
|
TEST_F(ParserImplTest, TypeDecl_Array_AbstractIntLiteralSize) {
|
||||||
auto p = parser("array<f32, 5>");
|
auto p = parser("array<f32, 5>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -410,7 +410,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_AbstractIntLiteralSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_SintLiteralSize) {
|
TEST_F(ParserImplTest, TypeDecl_Array_SintLiteralSize) {
|
||||||
auto p = parser("array<f32, 5i>");
|
auto p = parser("array<f32, 5i>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -431,7 +431,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_SintLiteralSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_UintLiteralSize) {
|
TEST_F(ParserImplTest, TypeDecl_Array_UintLiteralSize) {
|
||||||
auto p = parser("array<f32, 5u>");
|
auto p = parser("array<f32, 5u>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -451,7 +451,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_UintLiteralSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_ConstantSize) {
|
TEST_F(ParserImplTest, TypeDecl_Array_ConstantSize) {
|
||||||
auto p = parser("array<f32, size>");
|
auto p = parser("array<f32, size>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -471,7 +471,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_ConstantSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_ExpressionSize) {
|
TEST_F(ParserImplTest, TypeDecl_Array_ExpressionSize) {
|
||||||
auto p = parser("array<f32, size + 2>");
|
auto p = parser("array<f32, size + 2>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -498,7 +498,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_ExpressionSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_Runtime) {
|
TEST_F(ParserImplTest, TypeDecl_Array_Runtime) {
|
||||||
auto p = parser("array<u32>");
|
auto p = parser("array<u32>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -513,7 +513,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Runtime) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Vec) {
|
TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Vec) {
|
||||||
auto p = parser("array<vec4<u32>>");
|
auto p = parser("array<vec4<u32>>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -530,7 +530,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Vec) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_BadSize) {
|
TEST_F(ParserImplTest, TypeDecl_Array_BadSize) {
|
||||||
auto p = parser("array<f32, !>");
|
auto p = parser("array<f32, !>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -540,7 +540,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_BadSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_MissingSize) {
|
TEST_F(ParserImplTest, TypeDecl_Array_MissingSize) {
|
||||||
auto p = parser("array<f32,>");
|
auto p = parser("array<f32,>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -550,7 +550,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_MissingGreaterThan) {
|
TEST_F(ParserImplTest, TypeDecl_Array_MissingGreaterThan) {
|
||||||
auto p = parser("array<f32");
|
auto p = parser("array<f32");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -560,7 +560,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingGreaterThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Array_MissingComma) {
|
TEST_F(ParserImplTest, TypeDecl_Array_MissingComma) {
|
||||||
auto p = parser("array<f32 3>");
|
auto p = parser("array<f32 3>");
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -584,7 +584,7 @@ class MatrixTest : public ParserImplTestWithParam<MatrixData> {};
|
||||||
TEST_P(MatrixTest, Parse) {
|
TEST_P(MatrixTest, Parse) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -612,7 +612,7 @@ class MatrixMissingGreaterThanTest : public ParserImplTestWithParam<MatrixData>
|
||||||
TEST_P(MatrixMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
TEST_P(MatrixMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -636,7 +636,7 @@ class MatrixMissingType : public ParserImplTestWithParam<MatrixData> {};
|
||||||
TEST_P(MatrixMissingType, Handles_Missing_Type) {
|
TEST_P(MatrixMissingType, Handles_Missing_Type) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -658,7 +658,7 @@ INSTANTIATE_TEST_SUITE_P(ParserImplTest,
|
||||||
TEST_F(ParserImplTest, TypeDecl_Sampler) {
|
TEST_F(ParserImplTest, TypeDecl_Sampler) {
|
||||||
auto p = parser("sampler");
|
auto p = parser("sampler");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -670,7 +670,7 @@ TEST_F(ParserImplTest, TypeDecl_Sampler) {
|
||||||
TEST_F(ParserImplTest, TypeDecl_Texture) {
|
TEST_F(ParserImplTest, TypeDecl_Texture) {
|
||||||
auto p = parser("texture_cube<f32>");
|
auto p = parser("texture_cube<f32>");
|
||||||
|
|
||||||
auto t = p->type_decl();
|
auto t = p->type_specifier();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Invalid) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Invalid) {
|
||||||
auto p = parser("1234");
|
auto p = parser("1234");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_EQ(t.errored, false);
|
EXPECT_EQ(t.errored, false);
|
||||||
EXPECT_EQ(t.matched, false);
|
EXPECT_EQ(t.matched, false);
|
||||||
EXPECT_EQ(t.value, nullptr);
|
EXPECT_EQ(t.value, nullptr);
|
||||||
|
@ -33,7 +33,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Invalid) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Identifier) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Identifier) {
|
||||||
auto p = parser("A");
|
auto p = parser("A");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -42,7 +42,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Identifier) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Bool) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Bool) {
|
||||||
auto p = parser("bool");
|
auto p = parser("bool");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -52,7 +52,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Bool) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_F16) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_F16) {
|
||||||
auto p = parser("f16");
|
auto p = parser("f16");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -62,7 +62,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_F16) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_F32) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_F32) {
|
||||||
auto p = parser("f32");
|
auto p = parser("f32");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -72,7 +72,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_F32) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_I32) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_I32) {
|
||||||
auto p = parser("i32");
|
auto p = parser("i32");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -82,7 +82,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_I32) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_U32) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_U32) {
|
||||||
auto p = parser("u32");
|
auto p = parser("u32");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -105,7 +105,7 @@ class TypeDeclWithoutIdent_VecTest : public ParserImplTestWithParam<VecData> {};
|
||||||
TEST_P(TypeDeclWithoutIdent_VecTest, Parse) {
|
TEST_P(TypeDeclWithoutIdent_VecTest, Parse) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -125,7 +125,7 @@ class TypeDeclWithoutIdent_VecMissingGreaterThanTest : public ParserImplTestWith
|
||||||
TEST_P(TypeDeclWithoutIdent_VecMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
TEST_P(TypeDeclWithoutIdent_VecMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -143,7 +143,7 @@ class TypeDeclWithoutIdent_VecMissingType : public ParserImplTestWithParam<VecDa
|
||||||
TEST_P(TypeDeclWithoutIdent_VecMissingType, Handles_Missing_Type) {
|
TEST_P(TypeDeclWithoutIdent_VecMissingType, Handles_Missing_Type) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -158,7 +158,7 @@ INSTANTIATE_TEST_SUITE_P(ParserImplTest,
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr) {
|
||||||
auto p = parser("ptr<function, f32>");
|
auto p = parser("ptr<function, f32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -173,7 +173,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_WithAccess) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_WithAccess) {
|
||||||
auto p = parser("ptr<function, f32, read>");
|
auto p = parser("ptr<function, f32, read>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -189,7 +189,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_WithAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_ToVec) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_ToVec) {
|
||||||
auto p = parser("ptr<function, vec2<f32>>");
|
auto p = parser("ptr<function, vec2<f32>>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -208,7 +208,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_ToVec) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingLessThan) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingLessThan) {
|
||||||
auto p = parser("ptr private, f32>");
|
auto p = parser("ptr private, f32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -218,7 +218,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingLessThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterType) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterType) {
|
||||||
auto p = parser("ptr<function, f32");
|
auto p = parser("ptr<function, f32");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -228,7 +228,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterAccess) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterAccess) {
|
||||||
auto p = parser("ptr<function, f32, read");
|
auto p = parser("ptr<function, f32, read");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -238,7 +238,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAddressSpace) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAddressSpace) {
|
||||||
auto p = parser("ptr<function f32>");
|
auto p = parser("ptr<function f32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -248,7 +248,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAddressSpace) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAccess) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAccess) {
|
||||||
auto p = parser("ptr<function, f32 read>");
|
auto p = parser("ptr<function, f32 read>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -258,7 +258,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAddressSpace) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAddressSpace) {
|
||||||
auto p = parser("ptr<, f32>");
|
auto p = parser("ptr<, f32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -268,7 +268,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAddressSpace) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingType) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingType) {
|
||||||
auto p = parser("ptr<function,>");
|
auto p = parser("ptr<function,>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -278,7 +278,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAccess) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAccess) {
|
||||||
auto p = parser("ptr<function, i32, >");
|
auto p = parser("ptr<function, i32, >");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -288,7 +288,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingParams) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingParams) {
|
||||||
auto p = parser("ptr<>");
|
auto p = parser("ptr<>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -298,7 +298,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingParams) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadAddressSpace) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadAddressSpace) {
|
||||||
auto p = parser("ptr<unknown, f32>");
|
auto p = parser("ptr<unknown, f32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -308,7 +308,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadAddressSpace) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadAccess) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadAccess) {
|
||||||
auto p = parser("ptr<function, i32, unknown>");
|
auto p = parser("ptr<function, i32, unknown>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -318,7 +318,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadAccess) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic) {
|
||||||
auto p = parser("atomic<f32>");
|
auto p = parser("atomic<f32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -332,7 +332,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_ToVec) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_ToVec) {
|
||||||
auto p = parser("atomic<vec2<f32>>");
|
auto p = parser("atomic<vec2<f32>>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -350,7 +350,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_ToVec) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingLessThan) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingLessThan) {
|
||||||
auto p = parser("atomic f32>");
|
auto p = parser("atomic f32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -360,7 +360,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingLessThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingGreaterThan) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingGreaterThan) {
|
||||||
auto p = parser("atomic<f32");
|
auto p = parser("atomic<f32");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -370,7 +370,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingGreaterThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingType) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingType) {
|
||||||
auto p = parser("atomic<>");
|
auto p = parser("atomic<>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -380,7 +380,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_AbstractIntLiteralSize) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_AbstractIntLiteralSize) {
|
||||||
auto p = parser("array<f32, 5>");
|
auto p = parser("array<f32, 5>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -401,7 +401,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_AbstractIntLiteralSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_SintLiteralSize) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_SintLiteralSize) {
|
||||||
auto p = parser("array<f32, 5i>");
|
auto p = parser("array<f32, 5i>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -422,7 +422,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_SintLiteralSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_UintLiteralSize) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_UintLiteralSize) {
|
||||||
auto p = parser("array<f32, 5u>");
|
auto p = parser("array<f32, 5u>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -442,7 +442,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_UintLiteralSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ConstantSize) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ConstantSize) {
|
||||||
auto p = parser("array<f32, size>");
|
auto p = parser("array<f32, size>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -462,7 +462,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ConstantSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ExpressionSize) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ExpressionSize) {
|
||||||
auto p = parser("array<f32, size + 2>");
|
auto p = parser("array<f32, size + 2>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -489,7 +489,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ExpressionSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime) {
|
||||||
auto p = parser("array<u32>");
|
auto p = parser("array<u32>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -504,7 +504,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime_Vec) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime_Vec) {
|
||||||
auto p = parser("array<vec4<u32>>");
|
auto p = parser("array<vec4<u32>>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -521,7 +521,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime_Vec) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_BadSize) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_BadSize) {
|
||||||
auto p = parser("array<f32, !>");
|
auto p = parser("array<f32, !>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -531,7 +531,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_BadSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingSize) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingSize) {
|
||||||
auto p = parser("array<f32,>");
|
auto p = parser("array<f32,>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -541,7 +541,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingSize) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingGreaterThan) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingGreaterThan) {
|
||||||
auto p = parser("array<f32");
|
auto p = parser("array<f32");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -551,7 +551,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingGreaterThan) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingComma) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingComma) {
|
||||||
auto p = parser("array<f32 3>");
|
auto p = parser("array<f32 3>");
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -575,7 +575,7 @@ class TypeDeclWithoutIdent_MatrixTest : public ParserImplTestWithParam<MatrixDat
|
||||||
TEST_P(TypeDeclWithoutIdent_MatrixTest, Parse) {
|
TEST_P(TypeDeclWithoutIdent_MatrixTest, Parse) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -604,7 +604,7 @@ class TypeDeclWithoutIdent_MatrixMissingGreaterThanTest
|
||||||
TEST_P(TypeDeclWithoutIdent_MatrixMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
TEST_P(TypeDeclWithoutIdent_MatrixMissingGreaterThanTest, Handles_Missing_GreaterThan) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -628,7 +628,7 @@ class TypeDeclWithoutIdent_MatrixMissingType : public ParserImplTestWithParam<Ma
|
||||||
TEST_P(TypeDeclWithoutIdent_MatrixMissingType, Handles_Missing_Type) {
|
TEST_P(TypeDeclWithoutIdent_MatrixMissingType, Handles_Missing_Type) {
|
||||||
auto params = GetParam();
|
auto params = GetParam();
|
||||||
auto p = parser(params.input);
|
auto p = parser(params.input);
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.errored);
|
EXPECT_TRUE(t.errored);
|
||||||
EXPECT_FALSE(t.matched);
|
EXPECT_FALSE(t.matched);
|
||||||
ASSERT_EQ(t.value, nullptr);
|
ASSERT_EQ(t.value, nullptr);
|
||||||
|
@ -650,7 +650,7 @@ INSTANTIATE_TEST_SUITE_P(ParserImplTest,
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Sampler) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Sampler) {
|
||||||
auto p = parser("sampler");
|
auto p = parser("sampler");
|
||||||
|
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
|
@ -662,7 +662,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Sampler) {
|
||||||
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Texture) {
|
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Texture) {
|
||||||
auto p = parser("texture_cube<f32>");
|
auto p = parser("texture_cube<f32>");
|
||||||
|
|
||||||
auto t = p->type_decl_without_ident();
|
auto t = p->type_specifier_without_ident();
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, VariableIdentDecl_Parses) {
|
TEST_F(ParserImplTest, VariableIdentDecl_Parses) {
|
||||||
auto p = parser("my_var : f32");
|
auto p = parser("my_var : f32");
|
||||||
auto decl = p->expect_ident_with_type_decl("test");
|
auto decl = p->expect_ident_with_type_specifier("test");
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
ASSERT_FALSE(decl.errored);
|
ASSERT_FALSE(decl.errored);
|
||||||
ASSERT_EQ(decl->name, "my_var");
|
ASSERT_EQ(decl->name, "my_var");
|
||||||
|
@ -45,7 +45,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_Parses_AllowInferredType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, VariableIdentDecl_Inferred_Parse_Failure) {
|
TEST_F(ParserImplTest, VariableIdentDecl_Inferred_Parse_Failure) {
|
||||||
auto p = parser("my_var = 1.0");
|
auto p = parser("my_var = 1.0");
|
||||||
auto decl = p->expect_ident_with_type_decl("test");
|
auto decl = p->expect_ident_with_type_specifier("test");
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_EQ(p->error(), "1:8: expected ':' for test");
|
ASSERT_EQ(p->error(), "1:8: expected ':' for test");
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_Inferred_Parses_AllowInferredType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent) {
|
TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent) {
|
||||||
auto p = parser(": f32");
|
auto p = parser(": f32");
|
||||||
auto decl = p->expect_ident_with_type_decl("test");
|
auto decl = p->expect_ident_with_type_specifier("test");
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_TRUE(decl.errored);
|
ASSERT_TRUE(decl.errored);
|
||||||
ASSERT_EQ(p->error(), "1:1: expected identifier for test");
|
ASSERT_EQ(p->error(), "1:1: expected identifier for test");
|
||||||
|
@ -79,7 +79,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent_AllowInferredType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, VariableIdentDecl_MissingType) {
|
TEST_F(ParserImplTest, VariableIdentDecl_MissingType) {
|
||||||
auto p = parser("my_var :");
|
auto p = parser("my_var :");
|
||||||
auto decl = p->expect_ident_with_type_decl("test");
|
auto decl = p->expect_ident_with_type_specifier("test");
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_TRUE(decl.errored);
|
ASSERT_TRUE(decl.errored);
|
||||||
ASSERT_EQ(p->error(), "1:9: invalid type for test");
|
ASSERT_EQ(p->error(), "1:9: invalid type for test");
|
||||||
|
@ -95,7 +95,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_MissingType_AllowInferredType) {
|
||||||
|
|
||||||
TEST_F(ParserImplTest, VariableIdentDecl_InvalidIdent) {
|
TEST_F(ParserImplTest, VariableIdentDecl_InvalidIdent) {
|
||||||
auto p = parser("123 : f32");
|
auto p = parser("123 : f32");
|
||||||
auto decl = p->expect_ident_with_type_decl("test");
|
auto decl = p->expect_ident_with_type_specifier("test");
|
||||||
ASSERT_TRUE(p->has_error());
|
ASSERT_TRUE(p->has_error());
|
||||||
ASSERT_TRUE(decl.errored);
|
ASSERT_TRUE(decl.errored);
|
||||||
ASSERT_EQ(p->error(), "1:1: expected identifier for test");
|
ASSERT_EQ(p->error(), "1:1: expected identifier for test");
|
||||||
|
|
Loading…
Reference in New Issue