Skip to content

Commit 440f2be

Browse files
committed
Disambiguate let port names and types
A let port can start with its name (`let l(T) = T;`) or a named type (`let l(T value) = value;`). Parse the optional type, name and dimensions together using the existing declaration rule. This is in preparation for removing TYPE_IDENTIFIER. Keep the explicit `untyped` alternative separate and remove the unused let_formal_type rule. Let declarations remain unsupported. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
1 parent 6fa98d0 commit 440f2be

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎parse.y‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ Module::port_t *module_declare_interface_port(const YYLTYPE&loc, char *type,
12671267
%type <data_type> data_type data_type_opt data_type_or_implicit data_type_or_implicit_or_void
12681268
%type <data_type> block_reg_data_type for_decl_data_type
12691269
%type <data_type> implicit_type
1270-
%type <data_type> reg_prefixed_atomic_type let_formal_type
1270+
%type <data_type> reg_prefixed_atomic_type
12711271
%type <data_type> packed_array_data_type atomic_type
12721272

12731273
%type <data_type> ps_type_identifier ps_type_identifier_dim
@@ -6088,19 +6088,18 @@ let_port_list
60886088

60896089
// FIXME: What about the attributes?
60906090
let_port_item
6091-
: attribute_list_opt let_formal_type IDENTIFIER dimensions_opt initializer_opt
6091+
: attribute_list_opt data_type_or_implicit_plus_id_dim initializer_opt
6092+
{ perm_string tmp2 = lex_strings.make($2.id);
6093+
$$ = pform_make_let_port($2.type, tmp2, $2.ranges, $3);
6094+
delete[]$2.id;
6095+
}
6096+
| attribute_list_opt K_untyped IDENTIFIER dimensions_opt initializer_opt
60926097
{ perm_string tmp3 = lex_strings.make($3);
6093-
$$ = pform_make_let_port($2, tmp3, $4, $5);
6098+
$$ = pform_make_let_port(nullptr, tmp3, $4, $5);
6099+
delete[]$3;
60946100
}
60956101
;
60966102

6097-
let_formal_type
6098-
: data_type_or_implicit
6099-
{ $$ = $1; }
6100-
| K_untyped
6101-
{ $$ = 0; }
6102-
;
6103-
61046103
module_item_list
61056104
: module_item_list module_item
61066105
| module_item

0 commit comments

Comments
 (0)