parser: Fix parameter assignment grammar conflict
The parameter declaration grammar allows a visible type identifier to be used
as a parameter name. The assignment continuation rule still used
`identifier_name`, which made Bison reduce a `TYPE_IDENTIFIER` before it had
seen whether following dimensions belonged to the parameter name or to an
explicit type identifier.
Match ordinary and type identifiers directly in `parameter_assign` so the
parser can shift dimensions before deciding between a parameter name and an
explicit parameter type.
Fixes: e56c93a2be ("Support shadowing type identifiers in parameter declarations")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
2b67d9f754
commit
ff0b4a3154
11
parse.y
11
parse.y
|
|
@ -5991,10 +5991,17 @@ value_parameter_assign_with_explicit_type
|
||||||
;
|
;
|
||||||
|
|
||||||
parameter_assign
|
parameter_assign
|
||||||
: identifier_name dimensions_opt initializer_opt parameter_value_ranges_opt
|
: IDENTIFIER dimensions_opt initializer_opt parameter_value_ranges_opt
|
||||||
{ pform_set_parameter(@1, $1, param_is_local,
|
{ pform_set_parameter(@1, lex_strings.make($1), param_is_local,
|
||||||
param_is_type, param_type_restrict,
|
param_is_type, param_type_restrict,
|
||||||
param_data_type, $2, $3, $4);
|
param_data_type, $2, $3, $4);
|
||||||
|
delete[]$1;
|
||||||
|
}
|
||||||
|
| TYPE_IDENTIFIER dimensions_opt initializer_opt parameter_value_ranges_opt
|
||||||
|
{ pform_set_parameter(@1, lex_strings.make($1.text), param_is_local,
|
||||||
|
param_is_type, param_type_restrict,
|
||||||
|
param_data_type, $2, $3, $4);
|
||||||
|
delete[]$1.text;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue