Rémi Bernon (@rbernon) commented about tools/widl/parser.y:
| contract_req { $$ = $1; } /* activatable on the default activation factory */ ;
+access
- : tPUBLIC
- | tPROTECTED
- ;
+composable_attr:
decl_spec ',' access ',' contract_req { if ($1->type->type_type != TYPE_INTERFACE)
error_loc("type %s is not an interface\n", $1->type->name);
$$ = make_exprt(EXPR_MEMBER, declare_var(NULL, $1, make_declarator(NULL), 0), $5);
}
- ;
```suggestion:-11+0 access_attr : tPUBLIC { $$ = attr_int( @$, ATTR_PUBLIC, 0 ); } | tPROTECTED { $$ = attr_int( @$, ATTR_PROTECTED, 0 ); } ;
composable_attr : decl_spec ',' access_attr ',' contract_req { if ($1->type->type_type != TYPE_INTERFACE) error_loc( "type %s is not an interface\n", $1->type->name ); $$ = make_exprt( EXPR_MEMBER, declare_var( append_attr( NULL, $3 ), $1, make_declarator( NULL ), 0 ), $5 ); } ;
```
I'd suggest something like that, with `access_attr` type added at the top. This makes sure the `composable` attribute properties are all available somewhere in the expression.
Using an expression is probably fine for now, especially for consistency as other attributes are parsed the same, but I think that at some point we should instead have specific structs to describe attributes in a less obfuscated way.
Note also that I've started to progressively convert this file to using spaces only, and to use julliard style spacing too for readability. Tabs alignment gets often messed up and will look differently depending on the editor settings.