Hi Rémi,
On 15.02.2021 11:09, Rémi Bernon wrote:
+parameterized_type: qualified_type '<' parameterized_type_args '>'
{ $$ = find_parameterized_type($1, $3); }
- ;
+parameterized_type_args:
base_type { $$ = append_type(NULL, $1); }
- | qualified_type { $$ = append_type(NULL, $1); }
- | qualified_type '*' { $$ = append_type(NULL, type_new_pointer($1)); }
- | parameterized_type { $$ = append_type(NULL, $1); }
- | parameterized_type '*' { $$ = append_type(NULL, type_new_pointer($1)); }
- | parameterized_type_args ',' parameterized_type_args
{ $$ = append_types($1, $3); }
- ;
- coclass: tCOCLASS typename { $$ = type_coclass_declare($2); } ;
@@ -965,6 +982,7 @@ dispinterfacedef:
(...)
@@ -1839,6 +1860,16 @@ static type_list_t *append_type(type_list_t *list, type_t *type) return entry; }
+static type_list_t *append_types(type_list_t *list, type_list_t *types) +{
- type_list_t *entry;
- if (!list) return types;
- if (!types) return list;
- for (entry = list; entry->next; entry = entry->next) {}
- entry->next = types;
- return list;
+}
The usual practice in such cases would be to write grammatical rule (probably with a separate parameterized_type_arg rule) to append one element at a time to the list. This would avoid need for append_types (and its additional list traversal).
Thanks,
Jacek