From 90748c581be41ecadcc6a0b38687900d0f7d1bba Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 9 Nov 2018 13:51:04 +0100 Subject: [PATCH] widl: Add basic acf parser implementation. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- tools/widl/parser.y | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 542ee43e9ff..d979394182c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -266,8 +266,9 @@ static typelib_t *current_typelib; %token tWCHAR tWIREMARSHAL %token tAPARTMENT tNEUTRAL tSINGLE tFREE tBOTH -%type attribute type_qualifier function_specifier +%type attribute type_qualifier function_specifier acf_attribute %type m_attributes attributes attrib_list m_type_qual_list +%type acf_attributes acf_attribute_list %type str_list %type m_expr expr expr_const expr_int_const array m_bitfield %type m_exprs /* exprs expr_list */ expr_list_int_const @@ -1154,6 +1155,37 @@ version: acf_statements : /* empty */ + | acf_interface acf_statements + +acf_int_statements + : /* empty */ + | acf_int_statement acf_int_statements + +acf_int_statement + : tTYPEDEF acf_attributes aKNOWNTYPE ';' + { type_t *type = find_type_or_error($3, 0); + type->attrs = append_attr_list(type->attrs, $2); + } +acf_interface + : acf_attributes tINTERFACE aKNOWNTYPE '{' acf_int_statements '}' + { type_t *iface = find_type_or_error2($3, 0); + if (type_get_type(iface) != TYPE_INTERFACE) + error_loc("%s is not an interface\n", iface->name); + iface->attrs = append_attr_list(iface->attrs, $1); + } + +acf_attributes + : /* empty */ { $$ = NULL; }; + | '[' acf_attribute_list ']' { $$ = $2; }; + +acf_attribute_list + : acf_attribute { $$ = append_attr(NULL, $1); } + | acf_attribute_list ',' acf_attribute { $$ = append_attr($1, $3); } + +acf_attribute + : tENCODE { $$ = make_attr(ATTR_ENCODE); } + | tDECODE { $$ = make_attr(ATTR_DECODE); } + | tEXPLICITHANDLE { $$ = make_attr(ATTR_EXPLICIT_HANDLE); } %%