Accept type-identifier tokens in named binding selectors
A named binding selector such as `.T(expr)` names an existing formal port, parameter, task or function argument, or constructor argument. It is not a declaration of a new identifier. If a visible typedef named `T` exists at the use site the lexer returns `TYPE_IDENTIFIER`, which made the parser reject the binding selector. Modport simple port aliases use the same grammar, but are slightly different: the selector is the modport-visible port name and can shadow a visible typedef name in the interface scope. Use `identifier_name` for the selector name in `named_expression` and `named_expression_opt`. This covers named parameter overrides, named task and function arguments, named constructor arguments, and modport simple port aliases. Also use `identifier_name` in the named module port connection rules, including implicit named port connections and error recovery. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
e02a0bc2ec
commit
6844ed4194
8
parse.y
8
parse.y
|
|
@ -6089,7 +6089,7 @@ parameter_value_opt
|
|||
;
|
||||
|
||||
named_expression
|
||||
: '.' IDENTIFIER '(' expression ')'
|
||||
: '.' identifier_name '(' expression ')'
|
||||
{ named_pexpr_t*tmp = new named_pexpr_t;
|
||||
FILE_NAME(tmp, @$);
|
||||
tmp->name = lex_strings.make($2);
|
||||
|
|
@ -6100,7 +6100,7 @@ named_expression
|
|||
|
||||
named_expression_opt
|
||||
: named_expression
|
||||
| '.' IDENTIFIER '(' ')'
|
||||
| '.' identifier_name '(' ')'
|
||||
{ named_pexpr_t*tmp = new named_pexpr_t;
|
||||
FILE_NAME(tmp, @$);
|
||||
tmp->name = lex_strings.make($2);
|
||||
|
|
@ -6190,7 +6190,7 @@ port_name
|
|||
{ delete $1;
|
||||
$$ = $2;
|
||||
}
|
||||
| attribute_list_opt '.' IDENTIFIER '(' error ')'
|
||||
| attribute_list_opt '.' identifier_name '(' error ')'
|
||||
{ yyerror(@3, "error: Invalid port connection expression.");
|
||||
named_pexpr_t*tmp = new named_pexpr_t;
|
||||
FILE_NAME(tmp, @$);
|
||||
|
|
@ -6200,7 +6200,7 @@ port_name
|
|||
delete $1;
|
||||
$$ = tmp;
|
||||
}
|
||||
| attribute_list_opt '.' IDENTIFIER
|
||||
| attribute_list_opt '.' identifier_name
|
||||
{ pform_requires_sv(@3, "Implicit named port connections");
|
||||
named_pexpr_t*tmp = new named_pexpr_t;
|
||||
FILE_NAME(tmp, @$);
|
||||
|
|
|
|||
Loading…
Reference in New Issue