updated main()

git-svn-id: svn://anubis/misc/llvm@74 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2008-11-07 04:41:55 +00:00
parent 416f9a3b8e
commit 4862781f5b

View File

@ -1,6 +1,8 @@
%{ %{
#include <stdio.h> #include <stdio.h>
#include <iostream>
using namespace std;
extern "C" { extern "C" {
int yylex(void); int yylex(void);
@ -153,6 +155,11 @@ int main(int argc, char * argv[])
if (argc > 0) if (argc > 0)
{ {
yyin = fopen(argv[1], "r"); yyin = fopen(argv[1], "r");
if (yyin == NULL)
{
cerr << "Failed to open file '" << argv[1] << "'" << endl;
return -1;
}
} }
yyparse(); yyparse();
} }