} import_stack[MAX_IMPORT_DEPTH];
int import_stack_ptr = 0;
-static void pop_import(void);
-
UUID *parse_uuid(const char *u)
{
UUID* uuid = xmalloc(sizeof(UUID));
<INITIAL,ATTR>\>\> return SHR;
<INITIAL,ATTR>. return yytext[0];
<<EOF>> {
- if (import_stack_ptr) {
- pop_import();
+ if (import_stack_ptr)
return aEOF;
- }
else yyterminate();
}
%%
return xstrdup(cbuffer);
}
-static void pop_import(void)
+void pop_import(void)
{
int ptr = import_stack_ptr-1;
%type <num> pointer_type version
%type <str> libraryhdr
%type <uuid> uuid_string
+%type <num> import_start
%left ','
%right '?' ':'
| int_statements statement { $$ = $1; }
;
-statement: ';' {}
- | constdef ';' { if (!parse_only && do_header) { write_constdef($1); } }
+semicolon_opt:
+ | ';'
+ ;
+
+statement: constdef ';' { if (!parse_only && do_header) { write_constdef($1); } }
| cppquote {}
| enumdef ';' { if (!parse_only && do_header) {
write_type_def_or_decl(header, $1, FALSE, NULL);
cppquote: tCPPQUOTE '(' aSTRING ')' { if (!parse_only && do_header) fprintf(header, "%s\n", $3); }
;
import_start: tIMPORT aSTRING ';' { assert(yychar == YYEMPTY);
- if (!do_import($2)) yychar = aEOF; }
+ $$ = do_import($2);
+ if (!$$) yychar = aEOF;
+ }
;
-import: import_start imp_statements aEOF {}
+
+import: import_start imp_statements aEOF
+ { if ($1) pop_import(); }
;
-importlib: tIMPORTLIB '(' aSTRING ')' { if(!parse_only) add_importlib($3); }
+importlib: tIMPORTLIB '(' aSTRING ')'
+ semicolon_opt { if(!parse_only) add_importlib($3); }
;
libraryhdr: tLIBRARY aIDENTIFIER { $$ = $2; }
if (!parse_only && do_idfile) write_libid($2, $1);
}
;
-librarydef: library_start imp_statements '}' { if (!parse_only) end_typelib(); }
+librarydef: library_start imp_statements '}'
+ semicolon_opt { if (!parse_only) end_typelib(); }
;
m_args: { $$ = NULL; }
}
;
-coclassdef: coclasshdr '{' coclass_ints '}' { $$ = $1;
+coclassdef: coclasshdr '{' coclass_ints '}' semicolon_opt
+ { $$ = $1;
$$->ifaces = $3;
$$->defined = TRUE;
}
if (!parse_only && do_idfile) write_diid($$);
}
| dispinterfacehdr
- '{' interface ';' '}' { $$ = $1;
+ '{' interface ';' '}' { $$ = $1;
$$->fields = $3->fields;
$$->funcs = $3->funcs;
if (!parse_only && do_header) write_dispinterface($$);
;
interfacedef: interfacehdr inherit
- '{' int_statements '}' { $$ = $1.interface;
+ '{' int_statements '}' semicolon_opt { $$ = $1.interface;
$$->ref = $2;
$$->funcs = $4;
compute_method_indexes($$);
/* MIDL is able to import the definition of a base class from inside the
* definition of a derived class, I'll try to support it with this rule */
| interfacehdr ':' aIDENTIFIER
- '{' import int_statements '}' { $$ = $1.interface;
+ '{' import int_statements '}'
+ semicolon_opt { $$ = $1.interface;
$$->ref = find_type2($3, 0);
if (!$$->ref) error_loc("base class '%s' not found in import\n", $3);
$$->funcs = $6;
if (!parse_only && do_idfile) write_iid($$);
pointer_default = $1.old_pointer_default;
}
- | dispinterfacedef { $$ = $1; }
+ | dispinterfacedef semicolon_opt { $$ = $1; }
;
interfacedec:
}
;
-moduledef: modulehdr '{' int_statements '}' { $$ = $1;
+moduledef: modulehdr '{' int_statements '}'
+ semicolon_opt { $$ = $1;
$$->funcs = $3;
/* FIXME: if (!parse_only && do_header) write_module($$); */
}