Dan Hipschman : widl: Factor a small part of the grammar.

Alexandre Julliard julliard at winehq.org
Wed Jul 2 06:03:31 CDT 2008


Module: wine
Branch: master
Commit: d87bc0520f1bc6f6201b8b44bd25cf6dff69184c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d87bc0520f1bc6f6201b8b44bd25cf6dff69184c

Author: Dan Hipschman <dsh at linux.ucla.edu>
Date:   Tue Jul  1 13:09:56 2008 -0700

widl: Factor a small part of the grammar.

---

 tools/widl/parser.y |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index fc27b2d..180ca98 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -311,7 +311,7 @@ static func_list_t *append_func_from_statement(func_list_t *list, statement_t *s
 %type <type> dispinterface dispinterfacehdr dispinterfacedef
 %type <type> module modulehdr moduledef
 %type <type> base_type int_std
-%type <type> enumdef structdef uniondef
+%type <type> enumdef structdef uniondef typedecl
 %type <type> type
 %type <ifref> coclass_int
 %type <ifref_list> coclass_ints
@@ -401,7 +401,7 @@ semicolon_opt:
 
 statement:
 	  cppquote				{ $$ = make_statement_cppquote($1); }
-	| enumdef ';'				{ $$ = make_statement_type_decl($1);
+	| typedecl ';'				{ $$ = make_statement_type_decl($1);
 						  if (!parse_only && do_header) {
 						    write_type_def_or_decl(header, $1, FALSE, NULL);
 						    fprintf(header, ";\n\n");
@@ -411,19 +411,13 @@ statement:
 						  if (!parse_only && do_header) write_declaration($1, is_in_interface);
 						}
 	| import				{ $$ = make_statement_import($1); }
-	| structdef ';'				{ $$ = make_statement_type_decl($1);
-						  if (!parse_only && do_header) {
-						    write_type_def_or_decl(header, $1, FALSE, NULL);
-						    fprintf(header, ";\n\n");
-						  }
-						}
 	| typedef ';'				{ $$ = $1; }
-	| uniondef ';'				{ $$ = make_statement_type_decl($1);
-						  if (!parse_only && do_header) {
-						    write_type_def_or_decl(header, $1, FALSE, NULL);
-						    fprintf(header, ";\n\n");
-						  }
-						}
+	;
+
+typedecl:
+	  enumdef
+	| structdef
+	| uniondef
 	;
 
 cppquote: tCPPQUOTE '(' aSTRING ')'		{ $$ = $3; if (!parse_only && do_header) fprintf(header, "%s\n", $3); }




More information about the wine-cvs mailing list